[ros-diffs] [reactos] 01/01: [SERVICES] Separate the start tag and the service tag of the manages services

2024-01-21 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d3d67bf5bd99c03371f82497bf82f0c84e98658b

commit d3d67bf5bd99c03371f82497bf82f0c84e98658b
Author: Eric Kohl 
AuthorDate: Sun Jan 21 22:42:26 2024 +0100
Commit: Eric Kohl 
CommitDate: Sun Jan 21 22:42:26 2024 +0100

[SERVICES] Separate the start tag and the service tag of the manages 
services

This fixes two winetest errors.
---
 base/system/services/database.c | 8 
 base/system/services/services.h | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/base/system/services/database.c b/base/system/services/database.c
index 3ec18104158..1b7b2e67af9 100644
--- a/base/system/services/database.c
+++ b/base/system/services/database.c
@@ -4,7 +4,7 @@
  * FILE:base/system/services/database.c
  * PURPOSE: Database control interface
  * COPYRIGHT:   Copyright 2002-2006 Eric Kohl
- *  Copyright 2006 Herv� Poussineau 
+ *  Copyright 2006 Hervé Poussineau 
  *  Copyright 2007 Ged Murphy 
  * Gregor Brunmar 
  *
@@ -201,7 +201,7 @@ ScmGetServiceNameFromTag(IN 
PTAG_INFO_NAME_FROM_TAG_IN_PARAMS InParams,
ServiceListEntry);
 
 /* We must match the tag */
-if (CurrentService->dwTag == InParams->dwTag &&
+if (CurrentService->dwServiceTag == InParams->dwTag &&
 CurrentService->lpImage != NULL)
 {
 CurrentImage = CurrentService->lpImage;
@@ -757,7 +757,7 @@ ScmGenerateServiceTag(PSERVICE lpServiceRecord)
 
 /* Increment the tag counter and set it */
 ServiceTag = ServiceTag % 0x + 1;
-lpServiceRecord->dwTag = ServiceTag;
+lpServiceRecord->dwServiceTag = ServiceTag;
 
 return ERROR_SUCCESS;
 }
@@ -1536,7 +1536,7 @@ ScmSendStartCommand(PSERVICE Service,
? SERVICE_CONTROL_START_OWN
: SERVICE_CONTROL_START_SHARE;
 ControlPacket->hServiceStatus = (SERVICE_STATUS_HANDLE)Service;
-ControlPacket->dwServiceTag = Service->dwTag;
+ControlPacket->dwServiceTag = Service->dwServiceTag;
 
 /* Copy the start command line */
 ControlPacket->dwServiceNameOffset = sizeof(SCM_CONTROL_PACKET);
diff --git a/base/system/services/services.h b/base/system/services/services.h
index 204375c17c6..c333c10d476 100644
--- a/base/system/services/services.h
+++ b/base/system/services/services.h
@@ -73,6 +73,7 @@ typedef struct _SERVICE
 DWORD dwTag;
 
 DWORD dwServiceBits;
+DWORD dwServiceTag;
 
 ULONG Flags;
 


[ros-diffs] [reactos] 01/01: [ADVAPI32][IDL][SERVICES] Implement I_ScValidatePnPService

2023-12-31 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f5346cbc1b0c08559b77ded0ef76a27a484c20fa

commit f5346cbc1b0c08559b77ded0ef76a27a484c20fa
Author: Eric Kohl 
AuthorDate: Sun Dec 31 15:33:19 2023 +0100
Commit: Eric Kohl 
CommitDate: Sun Dec 31 15:33:19 2023 +0100

[ADVAPI32][IDL][SERVICES] Implement I_ScValidatePnPService

This is actually a Vista+ function, but we need it enable umpnpmgr.dll to 
notify services of device events. Up until WinXP it was possible to make direct 
calls to the service manager by umpnpmgr.dll because umpnpmgr.dll was loaded 
into the service manager process. From Vista onwards umpnpmgr.dll is run as a 
separate service host process. And since ReactOS always ran umpnpmgr.dll as a 
separate process, we have to use the Vista RPC functions to notify services.
---
 base/system/services/rpcserver.c   | 41 ++
 dll/win32/advapi32/advapi32.spec   |  1 +
 dll/win32/advapi32/service/scm.c   | 52 ++
 sdk/include/reactos/idl/svcctl.idl |  6 +++--
 4 files changed, 93 insertions(+), 7 deletions(-)

diff --git a/base/system/services/rpcserver.c b/base/system/services/rpcserver.c
index cad1f3b0487..c84b67e6b24 100644
--- a/base/system/services/rpcserver.c
+++ b/base/system/services/rpcserver.c
@@ -4,7 +4,7 @@
  * FILE:base/system/services/rpcserver.c
  * PURPOSE: RPC server interface for the advapi32 calls
  * COPYRIGHT:   Copyright 2005-2006 Eric Kohl
- *  Copyright 2006-2007 Herv� Poussineau 
+ *  Copyright 2006-2007 Hervé Poussineau 
  *  Copyright 2007 Ged Murphy 
  */
 
@@ -6711,11 +6711,42 @@ RSendPnPMessage(
 /* Function 53 */
 DWORD
 WINAPI
-RValidatePnPService(
-handle_t BindingHandle)  /* FIXME */
+RI_ScValidatePnPService(
+_In_ SC_RPC_HANDLE hSCManager,
+_In_ LPWSTR pszServiceName,
+_Out_ RPC_SERVICE_STATUS_HANDLE *phServiceStatus)
 {
-UNIMPLEMENTED;
-return ERROR_CALL_NOT_IMPLEMENTED;
+PMANAGER_HANDLE hManager;
+PSERVICE pService;
+
+DPRINT("RI_ScValidatePnPService(%p %S %p)\n", hSCManager, pszServiceName, 
phServiceStatus);
+
+/* Validate handle */
+hManager = ScmGetServiceManagerFromHandle(hSCManager);
+if (hManager == NULL)
+{
+DPRINT1("Invalid handle!\n");
+return ERROR_INVALID_HANDLE;
+}
+
+/* FIXME: should check whether client is local */
+
+/* Check access rights */
+if (!RtlAreAllAccessesGranted(hManager->Handle.DesiredAccess,
+  SC_MANAGER_CONNECT))
+{
+DPRINT1("No SC_MANAGER_CONNECT access!\n");
+return ERROR_ACCESS_DENIED;
+}
+
+pService = ScmGetServiceEntryByName(pszServiceName);
+DPRINT("pService: %p\n", pService);
+if (pService == NULL)
+return ERROR_SERVICE_DOES_NOT_EXIST;
+
+*phServiceStatus = (RPC_SERVICE_STATUS_HANDLE)pService;
+
+return ERROR_SUCCESS;
 }
 
 
diff --git a/dll/win32/advapi32/advapi32.spec b/dll/win32/advapi32/advapi32.spec
index 3a02c1362ab..e158d6a5c48 100644
--- a/dll/win32/advapi32/advapi32.spec
+++ b/dll/win32/advapi32/advapi32.spec
@@ -306,6 +306,7 @@
 @ stub I_ScSendTSMessage
 @ stdcall I_ScSetServiceBitsA(ptr long long long str)
 @ stdcall I_ScSetServiceBitsW(ptr long long long wstr)
+@ stdcall I_ScValidatePnpService(wstr wstr ptr)
 @ stub IdentifyCodeAuthzLevelW
 @ stdcall ImpersonateAnonymousToken(ptr)
 @ stdcall ImpersonateLoggedOnUser(long)
diff --git a/dll/win32/advapi32/service/scm.c b/dll/win32/advapi32/service/scm.c
index 621e5753247..aee23c5750d 100644
--- a/dll/win32/advapi32/service/scm.c
+++ b/dll/win32/advapi32/service/scm.c
@@ -1897,6 +1897,58 @@ I_ScGetCurrentGroupStateW(SC_HANDLE hSCManager,
 }
 
 
+/**
+ *  I_ScValidatePnpService
+ *
+ * Undocumented
+ *
+ * @implemented
+ */
+DWORD
+WINAPI
+I_ScValidatePnpService(
+_In_ LPCWSTR pszMachineName,
+_In_ LPCWSTR pszServiceName,
+_Out_ SERVICE_STATUS_HANDLE *phServiceStatus)
+{
+SC_RPC_HANDLE hSCManager = NULL;
+SERVICE_STATUS_HANDLE hServiceStatus = NULL;
+DWORD dwError;
+
+TRACE("I_ScValidatePnpService(%S %S %p)\n",
+ pszMachineName, pszServiceName, phServiceStatus);
+
+hSCManager = OpenSCManagerW(pszMachineName,
+SERVICES_ACTIVE_DATABASEW,
+SC_MANAGER_CONNECT);
+if (hSCManager == NULL)
+{
+dwError = GetLastError();
+goto done;
+}
+
+RpcTryExcept
+{
+dwError = RI_ScValidatePnPService(hSCManager,
+  (LPWSTR)pszServiceName,
+  (RPC_SERVICE_STATUS_HANDLE 
*));
+}
+RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+{
+dwError = ScmRpcStatusToWinError(RpcExceptionCode());
+}
+RpcEndExcept
+
+*phServiceStatus =

[ros-diffs] [reactos] 01/01: [SETUPAPI] CMP_RegisterNotification: Do not fail if we cannot retrieve a window title

2023-12-20 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9277f5352a48f247a393d02d50b1ecb713738dac

commit 9277f5352a48f247a393d02d50b1ecb713738dac
Author: Eric Kohl 
AuthorDate: Wed Dec 20 15:20:01 2023 +0100
Commit: Eric Kohl 
CommitDate: Wed Dec 20 15:20:01 2023 +0100

[SETUPAPI] CMP_RegisterNotification: Do not fail if we cannot retrieve a 
window title
---
 dll/win32/setupapi/cfgmgr.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c
index b292a3c391d..ef29d045f8c 100644
--- a/dll/win32/setupapi/cfgmgr.c
+++ b/dll/win32/setupapi/cfgmgr.c
@@ -636,6 +636,8 @@ CMP_RegisterNotification(
 pNotifyData->ulMagic = NOTIFY_MAGIC;
 pNotifyData->hNotifyHandle = NULL;
 
+ZeroMemory(szNameBuffer, sizeof(szNameBuffer));
+
 if ((ulFlags & DEVICE_NOTIFY_SERVICE_HANDLE) == 
DEVICE_NOTIFY_WINDOW_HANDLE)
 {
 FIXME("Register a window\n");
@@ -645,8 +647,12 @@ CMP_RegisterNotification(
  ARRAYSIZE(szNameBuffer));
 if (nLength == 0)
 {
-HeapFree(GetProcessHeap(), 0, pNotifyData);
-return CR_INVALID_DATA;
+
+}
+
+if (nLength == 0)
+{
+szNameBuffer[0] = UNICODE_NULL;
 }
 
 FIXME("Register window: %S\n", szNameBuffer);


[ros-diffs] [reactos] 01/01: [IDL] Revert commit c03899fc

2023-12-20 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=92942fbbd8cd9c3eba288dce83071ff840b7429f

commit 92942fbbd8cd9c3eba288dce83071ff840b7429f
Author: Eric Kohl 
AuthorDate: Wed Dec 20 15:13:40 2023 +0100
Commit: Eric Kohl 
CommitDate: Wed Dec 20 15:13:40 2023 +0100

[IDL] Revert commit c03899fc
---
 sdk/include/reactos/idl/pnp.idl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdk/include/reactos/idl/pnp.idl b/sdk/include/reactos/idl/pnp.idl
index 52c47ab2ffc..efe320e3e63 100644
--- a/sdk/include/reactos/idl/pnp.idl
+++ b/sdk/include/reactos/idl/pnp.idl
@@ -53,7 +53,7 @@ typedef enum _PNP_VETO_TYPE {
 PNP_VetoNonDisableable = 10,
 PNP_VetoLegacyDriver = 11,
 PNP_VetoInsufficientRights = 12,
-} *PPNP_VETO_TYPE;
+} PNP_VETO_TYPE, *PPNP_VETO_TYPE;
 
 cpp_quote("#endif")
 


[ros-diffs] [reactos] 01/01: [IDL] Add missing PNP_VETO_TYPE

2023-12-20 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c03899fc7f0b7d85af7ca4702d83d41bb0ac2e9c

commit c03899fc7f0b7d85af7ca4702d83d41bb0ac2e9c
Author: Eric Kohl 
AuthorDate: Wed Dec 20 15:09:03 2023 +0100
Commit: Eric Kohl 
CommitDate: Wed Dec 20 15:09:03 2023 +0100

[IDL] Add missing PNP_VETO_TYPE
---
 sdk/include/reactos/idl/pnp.idl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdk/include/reactos/idl/pnp.idl b/sdk/include/reactos/idl/pnp.idl
index efe320e3e63..52c47ab2ffc 100644
--- a/sdk/include/reactos/idl/pnp.idl
+++ b/sdk/include/reactos/idl/pnp.idl
@@ -53,7 +53,7 @@ typedef enum _PNP_VETO_TYPE {
 PNP_VetoNonDisableable = 10,
 PNP_VetoLegacyDriver = 11,
 PNP_VetoInsufficientRights = 12,
-} PNP_VETO_TYPE, *PPNP_VETO_TYPE;
+} *PPNP_VETO_TYPE;
 
 cpp_quote("#endif")
 


[ros-diffs] [reactos] 01/01: [IDL][SETUPAPI][UMPNPMGR] Improve PNP_RegisterNotification

2023-12-20 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=71df39b027f9d08276fd06f2dadfc9162abcf859

commit 71df39b027f9d08276fd06f2dadfc9162abcf859
Author: Eric Kohl 
AuthorDate: Wed Dec 20 14:49:30 2023 +0100
Commit: Eric Kohl 
CommitDate: Wed Dec 20 14:49:30 2023 +0100

[IDL][SETUPAPI][UMPNPMGR] Improve PNP_RegisterNotification

- The 2nd parameter is the handle to the recipient.
- The 8th parameter is the callers process id.
---
 base/services/umpnpmgr/rpcserver.c | 8 
 dll/win32/setupapi/cfgmgr.c| 2 +-
 sdk/include/reactos/idl/pnp.idl| 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 4e57e261e13..f493f181d5e 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -4689,13 +4689,13 @@ DWORD
 WINAPI
 PNP_RegisterNotification(
 handle_t hBinding,
-DWORD ulUnknown2,
+DWORD_PTR hRecipient,
 LPWSTR pszName,
 BYTE *pNotificationFilter,
 DWORD ulNotificationFilterSize,
 DWORD ulFlags,
 PNP_NOTIFY_HANDLE *pNotifyHandle,
-DWORD ulUnknown8,
+DWORD ulProcessId,
 DWORD *pulUnknown9)
 {
 PDEV_BROADCAST_DEVICEINTERFACE_W pBroadcastDeviceInterface;
@@ -4703,8 +4703,8 @@ PNP_RegisterNotification(
 PNOTIFY_ENTRY pNotifyData = NULL;
 
 DPRINT1("PNP_RegisterNotification(%p %lx '%S' %p %lu 0x%lx %p %lx %p)\n",
-   hBinding, ulUnknown2, pszName, pNotificationFilter,
-   ulNotificationFilterSize, ulFlags, pNotifyHandle, ulUnknown8, 
pulUnknown9);
+   hBinding, hRecipient, pszName, pNotificationFilter,
+   ulNotificationFilterSize, ulFlags, pNotifyHandle, ulProcessId, 
pulUnknown9);
 
 if (pNotifyHandle == NULL)
 return CR_INVALID_POINTER;
diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c
index 7fd00b122e8..b292a3c391d 100644
--- a/dll/win32/setupapi/cfgmgr.c
+++ b/dll/win32/setupapi/cfgmgr.c
@@ -670,7 +670,7 @@ CMP_RegisterNotification(
 RpcTryExcept
 {
 ret = PNP_RegisterNotification(BindingHandle,
-   0,/* ??? */
+   (DWORD_PTR)hRecipient,
szNameBuffer,
(BYTE*)lpvNotificationFilter,

((DEV_BROADCAST_HDR*)lpvNotificationFilter)->dbch_size,
diff --git a/sdk/include/reactos/idl/pnp.idl b/sdk/include/reactos/idl/pnp.idl
index 0a75c523f05..efe320e3e63 100644
--- a/sdk/include/reactos/idl/pnp.idl
+++ b/sdk/include/reactos/idl/pnp.idl
@@ -878,7 +878,7 @@ interface pnp
 __stdcall
 PNP_RegisterNotification(
 [in] handle_t hBinding,
-[in] DWORD ulUnknown2,
+[in] DWORD_PTR hRecipient,
 [in, string, ref] LPWSTR pszName,
 [in, size_is(ulNotificationFilterSize)] BYTE *pNotificationFilter,
 [in] DWORD ulNotificationFilterSize,


[ros-diffs] [reactos] 01/01: [UMPNPMGR] Broadcast a WM_DEVICECHANGE message after a device install was queued

2023-12-18 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ec0a300f2b71e117ecfcabce6847093bdcbaddba

commit ec0a300f2b71e117ecfcabce6847093bdcbaddba
Author: Eric Kohl 
AuthorDate: Mon Dec 18 11:16:45 2023 +0100
Commit: Eric Kohl 
CommitDate: Mon Dec 18 11:17:08 2023 +0100

[UMPNPMGR] Broadcast a WM_DEVICECHANGE message after a device install was 
queued
---
 base/services/umpnpmgr/event.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/base/services/umpnpmgr/event.c b/base/services/umpnpmgr/event.c
index 5340431c005..7f104128f7e 100644
--- a/base/services/umpnpmgr/event.c
+++ b/base/services/umpnpmgr/event.c
@@ -136,6 +136,7 @@ ProcessDeviceInstallEvent(
 DeviceInstallParams* Params;
 DWORD len;
 DWORD DeviceIdLength;
+//DWORD dwRecipient;
 
 DPRINT("ProcessDeviceInstallEvent(%p)\n", PnpEvent);
 DPRINT("Device enumerated: %S\n", PnpEvent->InstallDevice.DeviceId);
@@ -156,6 +157,14 @@ ProcessDeviceInstallEvent(
 ReleaseMutex(hDeviceInstallListMutex);
 
 SetEvent(hDeviceInstallListNotEmpty);
+
+//dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS;
+//BroadcastSystemMessageW(BSF_POSTMESSAGE,
+//,
+//WM_DEVICECHANGE,
+//DBT_DEVNODES_CHANGED,
+//0);
+SendMessageW(HWND_BROADCAST, WM_DEVICECHANGE, 
DBT_DEVNODES_CHANGED, 0);
 }
 }
 }


[ros-diffs] [reactos] 01/01: [NETCFGX] Create only one "Alternative Configuration" tab

2023-12-17 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8f349ab3c28a6e13c671b0393fee4784d1ef218e

commit 8f349ab3c28a6e13c671b0393fee4784d1ef218e
Author: Eric Kohl 
AuthorDate: Sun Dec 17 21:50:20 2023 +0100
Commit: Eric Kohl 
CommitDate: Sun Dec 17 21:50:20 2023 +0100

[NETCFGX] Create only one "Alternative Configuration" tab

- Check for the presence of the second tab.
- Remove unnecessary checks for checked radiobuttons.

CORE-19328
---
 dll/win32/netcfgx/tcpipconf_notify.c | 26 ++
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/dll/win32/netcfgx/tcpipconf_notify.c 
b/dll/win32/netcfgx/tcpipconf_notify.c
index e6db3ae9a1d..d662f7fdf33 100644
--- a/dll/win32/netcfgx/tcpipconf_notify.c
+++ b/dll/win32/netcfgx/tcpipconf_notify.c
@@ -2648,7 +2648,7 @@ TcpipBasicDlg(
 switch (LOWORD(wParam))
 {
 case IDC_USEDHCP:
-if (IsDlgButtonChecked(hwndDlg, IDC_USEDHCP) == 
BST_CHECKED)
+if (SendMessageW(GetParent(hwndDlg), PSM_INDEXTOID, 1, 
0) == 0)
 {
 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, 
IPM_CLEARADDRESS, 0, 0);
@@ -2662,7 +2662,7 @@ TcpipBasicDlg(
 }
 break;
 case IDC_NODHCP:
-if (IsDlgButtonChecked(hwndDlg, IDC_NODHCP) == 
BST_CHECKED)
+if (SendMessageW(GetParent(hwndDlg), PSM_INDEXTOID, 1, 
0) != 0)
 {
 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
 EnableWindow(GetDlgItem(hwndDlg, IDC_IPADDR), 
TRUE);
@@ -2680,22 +2680,16 @@ TcpipBasicDlg(
 }
 break;
 case IDC_AUTODNS:
-if (IsDlgButtonChecked(hwndDlg, IDC_AUTODNS) == 
BST_CHECKED)
-{
-PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
-SendDlgItemMessageW(hwndDlg, IDC_DNS1, 
IPM_CLEARADDRESS, 0, 0);
-SendDlgItemMessageW(hwndDlg, IDC_DNS2, 
IPM_CLEARADDRESS, 0, 0);
-EnableWindow(GetDlgItem(hwndDlg, IDC_DNS1), FALSE);
-EnableWindow(GetDlgItem(hwndDlg, IDC_DNS2), FALSE);
-}
+PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+SendDlgItemMessageW(hwndDlg, IDC_DNS1, 
IPM_CLEARADDRESS, 0, 0);
+SendDlgItemMessageW(hwndDlg, IDC_DNS2, 
IPM_CLEARADDRESS, 0, 0);
+EnableWindow(GetDlgItem(hwndDlg, IDC_DNS1), FALSE);
+EnableWindow(GetDlgItem(hwndDlg, IDC_DNS2), FALSE);
 break;
 case IDC_FIXEDDNS:
-if (IsDlgButtonChecked(hwndDlg, IDC_FIXEDDNS) == 
BST_CHECKED)
-{
-PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
-EnableWindow(GetDlgItem(hwndDlg, IDC_DNS1), TRUE);
-EnableWindow(GetDlgItem(hwndDlg, IDC_DNS2), TRUE);
-}
+PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+EnableWindow(GetDlgItem(hwndDlg, IDC_DNS1), TRUE);
+EnableWindow(GetDlgItem(hwndDlg, IDC_DNS2), TRUE);
 break;
 case IDC_ADVANCED:
 LaunchAdvancedTcpipSettings(hwndDlg, 
(TcpipConfNotifyImpl*)GetWindowLongPtr(hwndDlg, DWLP_USER));


[ros-diffs] [reactos] 01/01: [NTOS:PNP][UMPNPMGR] GUID_DEVICE_ENUMERATED should be a DeviceInstallEvent

2023-12-03 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d8ba5920a2914067a5bb404ef5d76ce5c3011e50

commit d8ba5920a2914067a5bb404ef5d76ce5c3011e50
Author: Eric Kohl 
AuthorDate: Sun Dec 3 14:00:34 2023 +0100
Commit: Eric Kohl 
CommitDate: Sun Dec 3 14:00:34 2023 +0100

[NTOS:PNP][UMPNPMGR] GUID_DEVICE_ENUMERATED should be a DeviceInstallEvent

- Move the GUID_DEVICE_ENUMERATED event from the TargetDeviceChangeEvent 
category to the DeviceInstallEvent category
- Create a new function that handles DeviceInstallEvent category events
---
 base/services/umpnpmgr/event.c | 72 --
 ntoskrnl/include/internal/io.h | 10 --
 ntoskrnl/io/pnpmgr/devaction.c |  8 +++--
 ntoskrnl/io/pnpmgr/plugplay.c  | 43 -
 4 files changed, 97 insertions(+), 36 deletions(-)

diff --git a/base/services/umpnpmgr/event.c b/base/services/umpnpmgr/event.c
index d9ae579cad2..5340431c005 100644
--- a/base/services/umpnpmgr/event.c
+++ b/base/services/umpnpmgr/event.c
@@ -42,34 +42,9 @@ ProcessTargetDeviceEvent(
 {
 RPC_STATUS RpcStatus;
 
-if (UuidEqual(>EventGuid, (UUID*)_DEVICE_ENUMERATED, 
))
-{
-DeviceInstallParams* Params;
-DWORD len;
-DWORD DeviceIdLength;
-
-DPRINT("Device enumerated: %S\n", PnpEvent->TargetDevice.DeviceIds);
+DPRINT("ProcessTargetDeviceEvent(%p)\n", PnpEvent);
 
-DeviceIdLength = lstrlenW(PnpEvent->TargetDevice.DeviceIds);
-if (DeviceIdLength)
-{
-/* Allocate a new device-install event */
-len = FIELD_OFFSET(DeviceInstallParams, DeviceIds) + 
(DeviceIdLength + 1) * sizeof(WCHAR);
-Params = HeapAlloc(GetProcessHeap(), 0, len);
-if (Params)
-{
-wcscpy(Params->DeviceIds, PnpEvent->TargetDevice.DeviceIds);
-
-/* Queue the event (will be dequeued by DeviceInstallThread) */
-WaitForSingleObject(hDeviceInstallListMutex, INFINITE);
-InsertTailList(, >ListEntry);
-ReleaseMutex(hDeviceInstallListMutex);
-
-SetEvent(hDeviceInstallListNotEmpty);
-}
-}
-}
-else if (UuidEqual(>EventGuid, (UUID*)_DEVICE_ARRIVAL, 
))
+if (UuidEqual(>EventGuid, (UUID*)_DEVICE_ARRIVAL, 
))
 {
 //DWORD dwRecipient;
 
@@ -143,8 +118,8 @@ VOID
 ProcessDeviceClassChangeEvent(
 _In_ PPLUGPLAY_EVENT_BLOCK PnpEvent)
 {
-DPRINT("DeviceClassChangeEvent: %S\n", 
PnpEvent->DeviceClass.SymbolicLinkName);
-
+DPRINT("ProcessDeviceClassChangeEvent(%p)\n", PnpEvent);
+DPRINT("SymbolicLink: %S\n", PnpEvent->DeviceClass.SymbolicLinkName);
 DPRINT("ClassGuid: {%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}\n",
PnpEvent->DeviceClass.ClassGuid.Data1, 
PnpEvent->DeviceClass.ClassGuid.Data2, PnpEvent->DeviceClass.ClassGuid.Data3,
PnpEvent->DeviceClass.ClassGuid.Data4[0], 
PnpEvent->DeviceClass.ClassGuid.Data4[1], 
PnpEvent->DeviceClass.ClassGuid.Data4[2],
@@ -153,6 +128,39 @@ ProcessDeviceClassChangeEvent(
 }
 
 
+static
+VOID
+ProcessDeviceInstallEvent(
+_In_ PPLUGPLAY_EVENT_BLOCK PnpEvent)
+{
+DeviceInstallParams* Params;
+DWORD len;
+DWORD DeviceIdLength;
+
+DPRINT("ProcessDeviceInstallEvent(%p)\n", PnpEvent);
+DPRINT("Device enumerated: %S\n", PnpEvent->InstallDevice.DeviceId);
+
+DeviceIdLength = lstrlenW(PnpEvent->InstallDevice.DeviceId);
+if (DeviceIdLength)
+{
+/* Allocate a new device-install event */
+len = FIELD_OFFSET(DeviceInstallParams, DeviceIds) + (DeviceIdLength + 
1) * sizeof(WCHAR);
+Params = HeapAlloc(GetProcessHeap(), 0, len);
+if (Params)
+{
+wcscpy(Params->DeviceIds, PnpEvent->InstallDevice.DeviceId);
+
+/* Queue the event (will be dequeued by DeviceInstallThread) */
+WaitForSingleObject(hDeviceInstallListMutex, INFINITE);
+InsertTailList(, >ListEntry);
+ReleaseMutex(hDeviceInstallListMutex);
+
+SetEvent(hDeviceInstallListNotEmpty);
+}
+}
+}
+
+
 DWORD
 WINAPI
 PnpEventThread(
@@ -213,7 +221,11 @@ PnpEventThread(
 break;
 
 //case CustomDeviceEvent:
-//case DeviceInstallEvent:
+
+case DeviceInstallEvent:
+ProcessDeviceInstallEvent(PnpEvent);
+break;
+
 //case DeviceArrivalEvent:
 //case PowerEvent:
 //case VetoEvent:
diff --git a/ntoskrnl/include/internal/io.h b/ntoskrnl/include/internal/io.h
index 54a21832815..a349b48582d 100644
--- a/ntoskrnl/include/internal/io.h
+++ b/ntoskrnl/include/internal/io.h
@@ -676,9 +676,13 @@ IopQueueDeviceChangeEvent(
 
 NTSTATUS
 IopQueueTargetDeviceEvent(
-const GUID *Guid,
-PUNICODE_STRING Devi

[ros-diffs] [reactos] 01/01: [UMPNPMGR] Split the notification code by event category

2023-12-03 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=30b9be047f9679b7443f678f62806cc29f36c9ca

commit 30b9be047f9679b7443f678f62806cc29f36c9ca
Author: Eric Kohl 
AuthorDate: Sun Dec 3 11:08:57 2023 +0100
Commit: Eric Kohl 
CommitDate: Sun Dec 3 11:08:57 2023 +0100

[UMPNPMGR] Split the notification code by event category

- Move the TargetDeviceChangeEvent code into a separate function.
- Add a new function for the DeviceClassChangeEvent category.
---
 base/services/umpnpmgr/event.c | 229 +
 1 file changed, 139 insertions(+), 90 deletions(-)

diff --git a/base/services/umpnpmgr/event.c b/base/services/umpnpmgr/event.c
index 678022de61b..d9ae579cad2 100644
--- a/base/services/umpnpmgr/event.c
+++ b/base/services/umpnpmgr/event.c
@@ -35,13 +35,132 @@
 
 /* FUNCTIONS */
 
-DWORD WINAPI
-PnpEventThread(LPVOID lpParameter)
+static
+VOID
+ProcessTargetDeviceEvent(
+_In_ PPLUGPLAY_EVENT_BLOCK PnpEvent)
+{
+RPC_STATUS RpcStatus;
+
+if (UuidEqual(>EventGuid, (UUID*)_DEVICE_ENUMERATED, 
))
+{
+DeviceInstallParams* Params;
+DWORD len;
+DWORD DeviceIdLength;
+
+DPRINT("Device enumerated: %S\n", PnpEvent->TargetDevice.DeviceIds);
+
+DeviceIdLength = lstrlenW(PnpEvent->TargetDevice.DeviceIds);
+if (DeviceIdLength)
+{
+/* Allocate a new device-install event */
+len = FIELD_OFFSET(DeviceInstallParams, DeviceIds) + 
(DeviceIdLength + 1) * sizeof(WCHAR);
+Params = HeapAlloc(GetProcessHeap(), 0, len);
+if (Params)
+{
+wcscpy(Params->DeviceIds, PnpEvent->TargetDevice.DeviceIds);
+
+/* Queue the event (will be dequeued by DeviceInstallThread) */
+WaitForSingleObject(hDeviceInstallListMutex, INFINITE);
+InsertTailList(, >ListEntry);
+ReleaseMutex(hDeviceInstallListMutex);
+
+SetEvent(hDeviceInstallListNotEmpty);
+}
+}
+}
+else if (UuidEqual(>EventGuid, (UUID*)_DEVICE_ARRIVAL, 
))
+{
+//DWORD dwRecipient;
+
+DPRINT("Device arrival: %S\n", PnpEvent->TargetDevice.DeviceIds);
+
+//   dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS;
+//   BroadcastSystemMessageW(BSF_POSTMESSAGE,
+//   ,
+//   WM_DEVICECHANGE,
+//   DBT_DEVNODES_CHANGED,
+//   0);
+SendMessageW(HWND_BROADCAST, WM_DEVICECHANGE, DBT_DEVNODES_CHANGED, 0);
+}
+else if (UuidEqual(>EventGuid, (UUID*)_DEVICE_EJECT_VETOED, 
))
+{
+DPRINT1("Eject vetoed: %S\n", PnpEvent->TargetDevice.DeviceIds);
+}
+else if (UuidEqual(>EventGuid, 
(UUID*)_DEVICE_KERNEL_INITIATED_EJECT, ))
+{
+DPRINT1("Kernel initiated eject: %S\n", 
PnpEvent->TargetDevice.DeviceIds);
+}
+else if (UuidEqual(>EventGuid, (UUID*)_DEVICE_SAFE_REMOVAL, 
))
+{
+//DWORD dwRecipient;
+
+DPRINT1("Safe removal: %S\n", PnpEvent->TargetDevice.DeviceIds);
+
+//dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS;
+//BroadcastSystemMessageW(BSF_POSTMESSAGE,
+//,
+//WM_DEVICECHANGE,
+//DBT_DEVNODES_CHANGED,
+//0);
+SendMessageW(HWND_BROADCAST, WM_DEVICECHANGE, DBT_DEVNODES_CHANGED, 0);
+}
+else if (UuidEqual(>EventGuid, 
(UUID*)_DEVICE_SURPRISE_REMOVAL, ))
+{
+//DWORD dwRecipient;
+
+DPRINT1("Surprise removal: %S\n", PnpEvent->TargetDevice.DeviceIds);
+
+//dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS;
+//BroadcastSystemMessageW(BSF_POSTMESSAGE,
+//,
+//WM_DEVICECHANGE,
+//DBT_DEVNODES_CHANGED,
+//0);
+SendMessageW(HWND_BROADCAST, WM_DEVICECHANGE, DBT_DEVNODES_CHANGED, 0);
+}
+else if (UuidEqual(>EventGuid, 
(UUID*)_DEVICE_REMOVAL_VETOED, ))
+{
+DPRINT1("Removal vetoed: %S\n", PnpEvent->TargetDevice.DeviceIds);
+}
+else if (UuidEqual(>EventGuid, 
(UUID*)_DEVICE_REMOVE_PENDING, ))
+{
+DPRINT1("Removal pending: %S\n", PnpEvent->TargetDevice.DeviceIds);
+}
+else
+{
+DPRINT1("Unknown event, GUID 
{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}\n",
+PnpEvent->EventGuid.Data1, PnpEvent->EventGuid.Data2, 
PnpEvent->EventGuid.Data3,
+PnpEvent->EventGuid.Data4[0], PnpEvent->EventGuid.Data4[1], 
PnpEvent->EventGuid.Data4[2],
+ 

[ros-diffs] [reactos] 01/01: [UMPNPMGR] Move the pnp event thread to a separate file

2023-11-29 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=01a8288d2819b0ed92f13d1aec7a962bcdcdc079

commit 01a8288d2819b0ed92f13d1aec7a962bcdcdc079
Author: Eric Kohl 
AuthorDate: Wed Nov 29 23:03:00 2023 +0100
Commit: Eric Kohl 
CommitDate: Wed Nov 29 23:03:00 2023 +0100

[UMPNPMGR] Move the pnp event thread to a separate file
---
 base/services/umpnpmgr/CMakeLists.txt |   1 +
 base/services/umpnpmgr/event.c| 194 ++
 base/services/umpnpmgr/precomp.h  |  10 ++
 base/services/umpnpmgr/umpnpmgr.c | 157 ---
 4 files changed, 205 insertions(+), 157 deletions(-)

diff --git a/base/services/umpnpmgr/CMakeLists.txt 
b/base/services/umpnpmgr/CMakeLists.txt
index 7c344f9914c..bf1142ca173 100644
--- a/base/services/umpnpmgr/CMakeLists.txt
+++ b/base/services/umpnpmgr/CMakeLists.txt
@@ -4,6 +4,7 @@ add_rpc_files(server 
${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/pnp.idl)
 spec2def(umpnpmgr.dll umpnpmgr.spec ADD_IMPORTLIB)
 
 add_library(umpnpmgr MODULE
+event.c
 install.c
 rpcserver.c
 umpnpmgr.c
diff --git a/base/services/umpnpmgr/event.c b/base/services/umpnpmgr/event.c
new file mode 100644
index 000..678022de61b
--- /dev/null
+++ b/base/services/umpnpmgr/event.c
@@ -0,0 +1,194 @@
+/*
+ *  ReactOS kernel
+ *  Copyright (C) 2005 ReactOS Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+/*
+ * COPYRIGHT:See COPYING in the top level directory
+ * PROJECT:  ReactOS kernel
+ * FILE: base/services/umpnpmgr/event.c
+ * PURPOSE:  PNP Event thread
+ * PROGRAMMER:   Eric Kohl (eric.k...@reactos.org)
+ *   Hervé Poussineau (hpous...@reactos.org)
+ *   Colin Finck (co...@reactos.org)
+ */
+
+/* INCLUDES */
+
+#include "precomp.h"
+
+#define NDEBUG
+#include 
+
+/* FUNCTIONS */
+
+DWORD WINAPI
+PnpEventThread(LPVOID lpParameter)
+{
+PLUGPLAY_CONTROL_USER_RESPONSE_DATA ResponseData = {0, 0, 0, 0};
+DWORD dwRet = ERROR_SUCCESS;
+NTSTATUS Status;
+RPC_STATUS RpcStatus;
+PPLUGPLAY_EVENT_BLOCK PnpEvent, NewPnpEvent;
+ULONG PnpEventSize;
+
+UNREFERENCED_PARAMETER(lpParameter);
+
+PnpEventSize = 0x1000;
+PnpEvent = HeapAlloc(GetProcessHeap(), 0, PnpEventSize);
+if (PnpEvent == NULL)
+return ERROR_OUTOFMEMORY;
+
+for (;;)
+{
+DPRINT("Calling NtGetPlugPlayEvent()\n");
+
+/* Wait for the next PnP event */
+Status = NtGetPlugPlayEvent(0, 0, PnpEvent, PnpEventSize);
+
+/* Resize the buffer for the PnP event if it's too small */
+if (Status == STATUS_BUFFER_TOO_SMALL)
+{
+PnpEventSize += 0x400;
+NewPnpEvent = HeapReAlloc(GetProcessHeap(), 0, PnpEvent, 
PnpEventSize);
+if (NewPnpEvent == NULL)
+{
+dwRet = ERROR_OUTOFMEMORY;
+break;
+}
+PnpEvent = NewPnpEvent;
+continue;
+}
+
+if (!NT_SUCCESS(Status))
+{
+DPRINT1("NtGetPlugPlayEvent() failed (Status 0x%08lx)\n", Status);
+break;
+}
+
+/* Process the PnP event */
+DPRINT("Received PnP Event\n");
+if (UuidEqual(>EventGuid, (UUID*)_DEVICE_ENUMERATED, 
))
+{
+DeviceInstallParams* Params;
+DWORD len;
+DWORD DeviceIdLength;
+
+DPRINT("Device enumerated: %S\n", 
PnpEvent->TargetDevice.DeviceIds);
+
+DeviceIdLength = lstrlenW(PnpEvent->TargetDevice.DeviceIds);
+if (DeviceIdLength)
+{
+/* Allocate a new device-install event */
+len = FIELD_OFFSET(DeviceInstallParams, DeviceIds) + 
(DeviceIdLength + 1) * sizeof(WCHAR);
+Params = HeapAlloc(GetProcessHeap(), 0, len);
+if (Params)
+{
+wcscpy(Params->DeviceIds, 
PnpEvent->TargetDevice.DeviceIds);
+
+/* Queue the event (will be dequeued by 
DeviceInstallThread) */
+

[ros-diffs] [reactos] 01/01: [NTOS:PNP] Queue a device change event on interface enable or disable

2023-11-27 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=12a5971b7a31338b5171a37a672751cf7c3fb701

commit 12a5971b7a31338b5171a37a672751cf7c3fb701
Author: Eric Kohl 
AuthorDate: Mon Nov 27 22:36:05 2023 +0100
Commit: Eric Kohl 
CommitDate: Mon Nov 27 22:36:52 2023 +0100

[NTOS:PNP] Queue a device change event on interface enable or disable
---
 ntoskrnl/include/internal/io.h |  6 ++
 ntoskrnl/io/iomgr/deviface.c   |  3 ++-
 ntoskrnl/io/pnpmgr/plugplay.c  | 45 ++
 3 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/ntoskrnl/include/internal/io.h b/ntoskrnl/include/internal/io.h
index 680e20ef4e0..54a21832815 100644
--- a/ntoskrnl/include/internal/io.h
+++ b/ntoskrnl/include/internal/io.h
@@ -668,6 +668,12 @@ CODE_SEG("INIT")
 NTSTATUS
 IopInitPlugPlayEvents(VOID);
 
+NTSTATUS
+IopQueueDeviceChangeEvent(
+_In_ const GUID *EventGuid,
+_In_ const GUID *InterfaceClassGuid,
+_In_ PUNICODE_STRING SymbolicLinkName);
+
 NTSTATUS
 IopQueueTargetDeviceEvent(
 const GUID *Guid,
diff --git a/ntoskrnl/io/iomgr/deviface.c b/ntoskrnl/io/iomgr/deviface.c
index d640f7087b9..ed81e4407c4 100644
--- a/ntoskrnl/io/iomgr/deviface.c
+++ b/ntoskrnl/io/iomgr/deviface.c
@@ -6,7 +6,7 @@
  *
  * PROGRAMMERS: Filip Navara (xnav...@volny.cz)
  *  Matthew Brace (ism...@austin.rr.com)
- *  Herv� Poussineau (hpous...@reactos.org)
+ *  Hervé Poussineau (hpous...@reactos.org)
  */
 
 /* INCLUDES **/
@@ -1465,6 +1465,7 @@ IoSetDeviceInterfaceState(IN PUNICODE_STRING 
SymbolicLinkName,
 EventGuid = Enable ? _DEVICE_INTERFACE_ARRIVAL : 
_DEVICE_INTERFACE_REMOVAL;
 
 PiNotifyDeviceInterfaceChange(EventGuid, , SymbolicLinkName);
+IopQueueDeviceChangeEvent(EventGuid, , SymbolicLinkName);
 
 ObDereferenceObject(PhysicalDeviceObject);
 DPRINT("Status %x\n", Status);
diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c
index 9220b30dc9e..3b01ed06a1c 100644
--- a/ntoskrnl/io/pnpmgr/plugplay.c
+++ b/ntoskrnl/io/pnpmgr/plugplay.c
@@ -48,6 +48,51 @@ IopInitPlugPlayEvents(VOID)
 return STATUS_SUCCESS;
 }
 
+NTSTATUS
+IopQueueDeviceChangeEvent(
+_In_ const GUID *EventGuid,
+_In_ const GUID *InterfaceClassGuid,
+_In_ PUNICODE_STRING SymbolicLinkName)
+{
+PPNP_EVENT_ENTRY EventEntry;
+UNICODE_STRING Copy;
+ULONG TotalSize;
+
+/* Allocate a big enough buffer */
+Copy.Length = 0;
+Copy.MaximumLength = SymbolicLinkName->Length + sizeof(UNICODE_NULL);
+TotalSize =
+FIELD_OFFSET(PLUGPLAY_EVENT_BLOCK, DeviceClass.SymbolicLinkName) +
+Copy.MaximumLength;
+
+EventEntry = ExAllocatePool(NonPagedPool,
+TotalSize + FIELD_OFFSET(PNP_EVENT_ENTRY, 
Event));
+if (!EventEntry)
+return STATUS_INSUFFICIENT_RESOURCES;
+RtlZeroMemory(EventEntry, TotalSize + FIELD_OFFSET(PNP_EVENT_ENTRY, 
Event));
+
+/* Fill the buffer with the event GUID */
+RtlCopyMemory(>Event.EventGuid, EventGuid, sizeof(GUID));
+EventEntry->Event.EventCategory = DeviceClassChangeEvent;
+EventEntry->Event.TotalSize = TotalSize;
+
+/* Fill the interface class GUID */
+RtlCopyMemory(>Event.DeviceClass.ClassGuid, 
InterfaceClassGuid, sizeof(GUID));
+
+/* Fill the symbolic link name */
+RtlCopyMemory(>Event.DeviceClass.SymbolicLinkName,
+  SymbolicLinkName->Buffer, SymbolicLinkName->Length);
+EventEntry->Event.DeviceClass.SymbolicLinkName[SymbolicLinkName->Length / 
sizeof(WCHAR)] = UNICODE_NULL;
+
+InsertHeadList(,
+   >ListEntry);
+KeSetEvent(,
+   0,
+   FALSE);
+
+return STATUS_SUCCESS;
+}
+
 NTSTATUS
 IopQueueTargetDeviceEvent(const GUID *Guid,
   PUNICODE_STRING DeviceIds)


[ros-diffs] [reactos] 01/01: [NETSH] Append missing newline for MSVC

2023-07-15 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=95bf5872eecd43cef85716774b79a4121d6d4069

commit 95bf5872eecd43cef85716774b79a4121d6d4069
Author: Eric Kohl 
AuthorDate: Sat Jul 15 13:18:38 2023 +0200
Commit: Eric Kohl 
CommitDate: Sat Jul 15 13:18:38 2023 +0200

[NETSH] Append missing newline for MSVC
---
 base/applications/network/netsh/resource.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/base/applications/network/netsh/resource.h 
b/base/applications/network/netsh/resource.h
index e3875fd655c..651a9cd60b4 100644
--- a/base/applications/network/netsh/resource.h
+++ b/base/applications/network/netsh/resource.h
@@ -34,4 +34,4 @@
 
 #define IDS_HLP_GROUP_ADD320
 #define IDS_HLP_GROUP_DELETE 321
-#define IDS_HLP_GROUP_SHOW   322
\ No newline at end of file
+#define IDS_HLP_GROUP_SHOW   322


[ros-diffs] [reactos] 01/01: [PSDK] Fix issues with callback function type declarations

2023-07-15 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0616df11e6a4c4fb29d0a44bc4d278608472b485

commit 0616df11e6a4c4fb29d0a44bc4d278608472b485
Author: Eric Kohl 
AuthorDate: Sat Jul 15 12:59:06 2023 +0200
Commit: Eric Kohl 
CommitDate: Sat Jul 15 12:59:06 2023 +0200

[PSDK] Fix issues with callback function type declarations
---
 sdk/include/psdk/netsh.h | 45 +
 1 file changed, 9 insertions(+), 36 deletions(-)

diff --git a/sdk/include/psdk/netsh.h b/sdk/include/psdk/netsh.h
index 39cef2f6ff3..5a42dd01c96 100644
--- a/sdk/include/psdk/netsh.h
+++ b/sdk/include/psdk/netsh.h
@@ -7,71 +7,49 @@ extern "C" {
 
 typedef
 DWORD
-WINAPI
-(GET_RESOURCE_STRING_FN)(
+(WINAPI *PGET_RESOURCE_STRING_FN)(
 _In_ DWORD dwMsgID,
 _Out_ LPWSTR lpBuffer,
 _In_ DWORD nBufferMax);
 
-typedef GET_RESOURCE_STRING_FN *PGET_RESOURCE_STRING_FN;
-
 typedef
 DWORD
-WINAPI
-(NS_DLL_INIT_FN)(
+(WINAPI *PNS_DLL_INIT_FN)(
 _In_ DWORD dwNetshVersion,
 _Out_ PVOID pReserved);
 
-typedef NS_DLL_INIT_FN *PNS_DLL_INIT_FN;
-
 typedef
 DWORD
-WINAPI
-(NS_HELPER_START_FN)(
+(WINAPI *PNS_HELPER_START_FN)(
 _In_ const GUID *pguidParent,
 _In_ DWORD dwVersion);
 
-typedef NS_HELPER_START_FN *PNS_HELPER_START_FN;
-
 typedef
 DWORD
-WINAPI
-(NS_HELPER_STOP_FN)(
+(WINAPI *PNS_HELPER_STOP_FN)(
 _In_ DWORD dwReserved);
 
-typedef NS_HELPER_STOP_FN *PNS_HELPER_STOP_FN;
-
 typedef
 DWORD
-WINAPI
-(NS_CONTEXT_COMMIT_FN)(
+(WINAPI *PNS_CONTEXT_COMMIT_FN)(
 _In_ DWORD dwAction);
 
-typedef NS_CONTEXT_COMMIT_FN *PNS_CONTEXT_COMMIT_FN;
-
 typedef
 DWORD
-WINAPI
-(NS_CONTEXT_CONNECT_FN)(
+(WINAPI *PNS_CONTEXT_CONNECT_FN)(
 _In_ LPCWSTR pwszMachine);
 
-typedef NS_CONTEXT_CONNECT_FN *PNS_CONTEXT_CONNECT_FN;
-
 typedef
 DWORD
-WINAPI
-(NS_CONTEXT_DUMP_FN)(
+(WINAPI *PNS_CONTEXT_DUMP_FN)(
 _In_ LPCWSTR pwszRouter,
 _In_ LPWSTR *ppwcArguments,
 _In_ DWORD dwArgCount,
 _In_ LPCVOID pvData);
 
-typedef NS_CONTEXT_DUMP_FN *PNS_CONTEXT_DUMP_FN;
-
 typedef
 BOOL
-WINAPI
-(NS_OSVERSIONCHECK)(
+(WINAPI *PNS_OSVERSIONCHECK)(
 _In_ UINT CIMOSType,
 _In_ UINT CIMOSProductSuite,
 _In_ LPCWSTR CIMOSVersion,
@@ -81,12 +59,9 @@ WINAPI
 _In_ UINT uiReserved,
 _In_ DWORD dwReserved);
 
-typedef NS_OSVERSIONCHECK *PNS_OSVERSIONCHECK;
-
 typedef
 DWORD
-WINAPI
-(FN_HANDLE_CMD)(
+(WINAPI *PFN_HANDLE_CMD)(
 _In_ LPCWSTR pwszMachine,
 _In_ LPWSTR *ppwcArguments,
 _In_ DWORD dwCurrentIndex,
@@ -95,8 +70,6 @@ WINAPI
 _In_ LPCVOID pvData,
 _Out_ BOOL *pbDone);
 
-typedef FN_HANDLE_CMD *PFN_HANDLE_CMD;
-
 
 typedef struct _CMD_ENTRY
 {


[ros-diffs] [reactos] 01/01: [NETSH] Replace the wine stub by a slightly more functional version

2023-07-15 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d8f9f7f2566614d8c9800edeffafc086836a3cef

commit d8f9f7f2566614d8c9800edeffafc086836a3cef
Author: Eric Kohl 
AuthorDate: Sat Jul 15 12:27:09 2023 +0200
Commit: Eric Kohl 
CommitDate: Sat Jul 15 12:27:09 2023 +0200

[NETSH] Replace the wine stub by a slightly more functional version

- Implement a basic command interpreter.
- Add basic support for helper dlls and contexts.
- Add interactive help system with context support.

Everything is still under construction and subject to change.
---
 base/applications/network/netsh/CMakeLists.txt |  27 +-
 base/applications/network/netsh/context.c  | 374 
 base/applications/network/netsh/help.c | 152 +++
 base/applications/network/netsh/helper.c   | 593 +
 base/applications/network/netsh/interpreter.c  | 238 ++
 base/applications/network/netsh/lang/en-US.rc  |  36 ++
 base/applications/network/netsh/netsh.c| 267 ++-
 base/applications/network/netsh/netsh.rc   |  15 +
 base/applications/network/netsh/netsh.spec |   7 +
 base/applications/network/netsh/precomp.h  | 205 +
 base/applications/network/netsh/resource.h |  37 ++
 11 files changed, 1923 insertions(+), 28 deletions(-)

diff --git a/base/applications/network/netsh/CMakeLists.txt 
b/base/applications/network/netsh/CMakeLists.txt
index 5e4005282da..0c838e60c7c 100644
--- a/base/applications/network/netsh/CMakeLists.txt
+++ b/base/applications/network/netsh/CMakeLists.txt
@@ -1,8 +1,25 @@
 
-add_definitions(-D__WINESRC__)
-include_directories(${REACTOS_SOURCE_DIR}/sdk/include/wine)
-add_executable(netsh netsh.c)
-target_link_libraries(netsh wine)
+include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/conutils)
+spec2def(netsh.exe netsh.spec ADD_IMPORTLIB)
+
+list(APPEND SOURCE
+context.c
+help.c
+helper.c
+interpreter.c
+netsh.c
+precomp.h)
+
+add_executable(netsh ${SOURCE} netsh.rc ${CMAKE_CURRENT_BINARY_DIR}/netsh.def)
+
+set_target_properties(netsh
+PROPERTIES
+ENABLE_EXPORTS TRUE
+DEFINE_SYMBOL "")
+
 set_module_type(netsh win32cui UNICODE)
-add_importlibs(netsh msvcrt kernel32 ntdll)
+target_link_libraries(netsh conutils ${PSEH_LIB})
+add_importlibs(netsh advapi32 msvcrt user32 kernel32 ntdll)
+
+add_pch(netsh precomp.h SOURCE)
 add_cd_file(TARGET netsh DESTINATION reactos/system32 FOR all)
diff --git a/base/applications/network/netsh/context.c 
b/base/applications/network/netsh/context.c
new file mode 100644
index 000..dded888c879
--- /dev/null
+++ b/base/applications/network/netsh/context.c
@@ -0,0 +1,374 @@
+/*
+ * PROJECT:ReactOS NetSh
+ * LICENSE:GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE:Network Shell context management functions
+ * COPYRIGHT:  Copyright 2023 Eric Kohl 
+ */
+
+/* INCLUDES 
***/
+
+#include "precomp.h"
+
+#define NDEBUG
+#include 
+
+/* GLOBALS 
/
+
+PCONTEXT_ENTRY pRootContext = NULL;
+PCONTEXT_ENTRY pCurrentContext = NULL;
+
+/* FUNCTIONS 
**/
+
+PCONTEXT_ENTRY
+AddContext(
+PCONTEXT_ENTRY pParentContext,
+PWSTR pszName,
+GUID *pGuid)
+{
+PCONTEXT_ENTRY pEntry;
+
+if (pParentContext != NULL && pszName == NULL)
+return NULL;
+
+/* Allocate the entry */
+pEntry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
sizeof(CONTEXT_ENTRY));
+if (pEntry == NULL)
+return NULL;
+
+/* Allocate the name buffer */
+if (pszName != NULL)
+{
+pEntry->pszContextName = HeapAlloc(GetProcessHeap(),
+   HEAP_ZERO_MEMORY,
+   (wcslen(pszName) + 1) * 
sizeof(WCHAR));
+if (pEntry->pszContextName == NULL)
+{
+HeapFree(GetProcessHeap(), 0, pEntry);
+return NULL;
+}
+
+/* Fill the entry */
+wcscpy(pEntry->pszContextName, pszName);
+}
+
+pEntry->pParentContext = pParentContext;
+if (pGuid != NULL)
+CopyMemory(>Guid, pGuid, sizeof(pEntry->Guid));
+
+/* Insert it */
+if (pParentContext != NULL)
+{
+if (pParentContext->pSubContextHead == NULL && 
pParentContext->pSubContextTail == NULL)
+{
+pParentContext->pSubContextHead = pEntry;
+pParentContext->pSubContextTail = pEntry;
+}
+else
+{
+pEntry->pPrev = pParentContext->pSubContextTail;
+pParentContext->pSubContextTail->pNext = pEntry;
+pParentContext->pSubContextTail = pEntry;
+}
+}
+
+return pEntry;
+}
+
+
+PCOMMAND_ENTRY
+AddContextCommand(
+PCONTEXT_ENTRY p

[ros-diffs] [reactos] 01/01: [PSDK] Add the netsh.h header file

2023-07-10 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c0e70a8e31be88de91e12662eefc4208c600b198

commit c0e70a8e31be88de91e12662eefc4208c600b198
Author: Eric Kohl 
AuthorDate: Mon Jul 10 22:30:36 2023 +0200
Commit: Eric Kohl 
CommitDate: Mon Jul 10 22:30:36 2023 +0200

[PSDK] Add the netsh.h header file
---
 sdk/include/psdk/netsh.h | 239 +++
 1 file changed, 239 insertions(+)

diff --git a/sdk/include/psdk/netsh.h b/sdk/include/psdk/netsh.h
new file mode 100644
index 000..39cef2f6ff3
--- /dev/null
+++ b/sdk/include/psdk/netsh.h
@@ -0,0 +1,239 @@
+#ifndef _NETSH_H_
+#define _NETSH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef
+DWORD
+WINAPI
+(GET_RESOURCE_STRING_FN)(
+_In_ DWORD dwMsgID,
+_Out_ LPWSTR lpBuffer,
+_In_ DWORD nBufferMax);
+
+typedef GET_RESOURCE_STRING_FN *PGET_RESOURCE_STRING_FN;
+
+typedef
+DWORD
+WINAPI
+(NS_DLL_INIT_FN)(
+_In_ DWORD dwNetshVersion,
+_Out_ PVOID pReserved);
+
+typedef NS_DLL_INIT_FN *PNS_DLL_INIT_FN;
+
+typedef
+DWORD
+WINAPI
+(NS_HELPER_START_FN)(
+_In_ const GUID *pguidParent,
+_In_ DWORD dwVersion);
+
+typedef NS_HELPER_START_FN *PNS_HELPER_START_FN;
+
+typedef
+DWORD
+WINAPI
+(NS_HELPER_STOP_FN)(
+_In_ DWORD dwReserved);
+
+typedef NS_HELPER_STOP_FN *PNS_HELPER_STOP_FN;
+
+typedef
+DWORD
+WINAPI
+(NS_CONTEXT_COMMIT_FN)(
+_In_ DWORD dwAction);
+
+typedef NS_CONTEXT_COMMIT_FN *PNS_CONTEXT_COMMIT_FN;
+
+typedef
+DWORD
+WINAPI
+(NS_CONTEXT_CONNECT_FN)(
+_In_ LPCWSTR pwszMachine);
+
+typedef NS_CONTEXT_CONNECT_FN *PNS_CONTEXT_CONNECT_FN;
+
+typedef
+DWORD
+WINAPI
+(NS_CONTEXT_DUMP_FN)(
+_In_ LPCWSTR pwszRouter,
+_In_ LPWSTR *ppwcArguments,
+_In_ DWORD dwArgCount,
+_In_ LPCVOID pvData);
+
+typedef NS_CONTEXT_DUMP_FN *PNS_CONTEXT_DUMP_FN;
+
+typedef
+BOOL
+WINAPI
+(NS_OSVERSIONCHECK)(
+_In_ UINT CIMOSType,
+_In_ UINT CIMOSProductSuite,
+_In_ LPCWSTR CIMOSVersion,
+_In_ LPCWSTR CIMOSBuildNumber,
+_In_ LPCWSTR CIMServicePackMajorVersion,
+_In_ LPCWSTR CIMServicePackMinorVersion,
+_In_ UINT uiReserved,
+_In_ DWORD dwReserved);
+
+typedef NS_OSVERSIONCHECK *PNS_OSVERSIONCHECK;
+
+typedef
+DWORD
+WINAPI
+(FN_HANDLE_CMD)(
+_In_ LPCWSTR pwszMachine,
+_In_ LPWSTR *ppwcArguments,
+_In_ DWORD dwCurrentIndex,
+_In_ DWORD dwArgCount,
+_In_ DWORD dwFlags,
+_In_ LPCVOID pvData,
+_Out_ BOOL *pbDone);
+
+typedef FN_HANDLE_CMD *PFN_HANDLE_CMD;
+
+
+typedef struct _CMD_ENTRY
+{
+LPCWSTR pwszCmdToken;
+PFN_HANDLE_CMD pfnCmdHandler;
+DWORD dwShortCmdHelpToken;
+DWORD dwCmdHlpToken;
+DWORD dwFlags;
+PNS_OSVERSIONCHECK pOsVersionCheck;
+} CMD_ENTRY, *PCMD_ENTRY;
+
+typedef struct _CMD_GROUP_ENTRY
+{
+LPCWSTR pwszCmdGroupToken;
+DWORD dwShortCmdHelpToken;
+ULONG ulCmdGroupSize;
+DWORD dwFlags;
+PCMD_ENTRY pCmdGroup;
+PNS_OSVERSIONCHECK pOsVersionCheck;
+} CMD_GROUP_ENTRY, *PCMD_GROUP_ENTRY;
+
+typedef struct _NS_HELPER_ATTRIBUTES
+{
+union
+{
+struct
+{
+DWORD dwVersion;
+DWORD dwReserved;
+};
+ULONGLONG _ullAlign;
+};
+GUID guidHelper;
+PNS_HELPER_START_FN pfnStart;
+PNS_HELPER_STOP_FN pfnStop;
+} NS_HELPER_ATTRIBUTES, *PNS_HELPER_ATTRIBUTES;
+
+typedef struct _NS_CONTEXT_ATTRIBUTES
+{
+union
+{
+struct
+{
+DWORD dwVersion;
+DWORD dwReserved;
+};
+ULONGLONG _ullAlign;
+};
+LPWSTR pwszContext;
+GUID guidHelper;
+DWORD dwFlags;
+ULONG ulPriority;
+ULONG ulNumTopCmds;
+CMD_ENTRY *pTopCmds;
+ULONG ulNumGroups;
+CMD_GROUP_ENTRY *pCmdGroups;
+PNS_CONTEXT_COMMIT_FN pfnCommitFn;
+PNS_CONTEXT_DUMP_FN pfnDumpFn;
+PNS_CONTEXT_CONNECT_FN pfnConnectFn;
+PVOID pReserved;
+PNS_OSVERSIONCHECK pfnOsVersionCheck;
+} NS_CONTEXT_ATTRIBUTES, *PNS_CONTEXT_ATTRIBUTES;
+
+typedef struct _TAG_TYPE
+{
+LPCWSTR pwszTag;
+DWORD dwRequired;
+BOOL bPresent;
+} TAG_TYPE, *PTAG_TYPE;
+
+typedef struct _TOKEN_VALUE
+{
+LPCWSTR pwszToken;
+DWORD dwValue;
+} TOKEN_VALUE, *PTOKEN_VALUE;
+
+DWORD
+WINAPI
+MatchEnumTag(
+_In_ HANDLE hModule,
+_In_ LPCWSTR pwcArg,
+_In_ DWORD dwNumArg,
+_In_ const TOKEN_VALUE *pEnumTable,
+_Out_ PDWORD pdwValue);
+
+BOOL
+WINAPI
+MatchToken(
+_In_ LPCWSTR pwszUserToken,
+_In_ LPCWSTR pwszCmdToken);
+
+DWORD
+WINAPI
+PreprocessCommand(
+_In_ HANDLE hModule,
+_Inout_ LPWSTR *ppwcArguments,
+_In_ DWORD dwCurrentIndex,
+_In_ DWORD dwArgCount,
+_Inout_ PTAG_TYPE pttTags,
+_In_ DWORD dwTagCount,
+_In_ DWORD dwMinArgs,
+_In_ DWORD dwMaxArgs,
+_Out_ DWORD *pdwTagType);
+
+DWORD
+CDECL
+PrintError(
+_In_opt_ HANDLE hModule,
+_In_ DWORD dwErrId,
+...);
+
+DWORD
+CDECL
+PrintMessageFromModule(
+_In_ HANDLE hModule,
+_In_ DWORD dwMsgId,
+...);
+
+DWORD
+CDECL
+Pr

[ros-diffs] [reactos] 01/01: [IPCONFIG] Add error messages for Release and Renew and fix magic values

2023-07-03 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=eb30050e1b506234f8e2f218d83426da63cb0fe5

commit eb30050e1b506234f8e2f218d83426da63cb0fe5
Author: Eric Kohl 
AuthorDate: Mon Jul 3 12:28:39 2023 +0200
Commit: Eric Kohl 
CommitDate: Mon Jul 3 12:28:39 2023 +0200

[IPCONFIG] Add error messages for Release and Renew and fix magic values
---
 base/applications/network/ipconfig/ipconfig.c| 12 ++--
 base/applications/network/ipconfig/lang/bg-BG.rc |  2 ++
 base/applications/network/ipconfig/lang/de-DE.rc |  2 ++
 base/applications/network/ipconfig/lang/el-GR.rc |  2 ++
 base/applications/network/ipconfig/lang/en-US.rc |  2 ++
 base/applications/network/ipconfig/lang/es-ES.rc |  2 ++
 base/applications/network/ipconfig/lang/fr-FR.rc |  2 ++
 base/applications/network/ipconfig/lang/id-ID.rc |  2 ++
 base/applications/network/ipconfig/lang/it-IT.rc |  2 ++
 base/applications/network/ipconfig/lang/no-NO.rc |  2 ++
 base/applications/network/ipconfig/lang/pl-PL.rc |  2 ++
 base/applications/network/ipconfig/lang/ro-RO.rc |  2 ++
 base/applications/network/ipconfig/lang/ru-RU.rc |  2 ++
 base/applications/network/ipconfig/lang/sk-SK.rc |  2 ++
 base/applications/network/ipconfig/lang/sq-AL.rc |  2 ++
 base/applications/network/ipconfig/lang/sv-SE.rc |  2 ++
 base/applications/network/ipconfig/lang/tr-TR.rc |  2 ++
 base/applications/network/ipconfig/lang/uk-UA.rc |  2 ++
 base/applications/network/ipconfig/lang/zh-CN.rc |  2 ++
 base/applications/network/ipconfig/lang/zh-TW.rc |  2 ++
 base/applications/network/ipconfig/resource.h|  2 ++
 21 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/base/applications/network/ipconfig/ipconfig.c 
b/base/applications/network/ipconfig/ipconfig.c
index 014a87d120c..389026974f7 100644
--- a/base/applications/network/ipconfig/ipconfig.c
+++ b/base/applications/network/ipconfig/ipconfig.c
@@ -457,19 +457,19 @@ PrintNodeType(
 {
 switch (NodeType)
 {
-case 1:
+case BROADCAST_NODETYPE:
 ConResPrintf(StdOut, IDS_NODETYPEBCAST);
 break;
 
-case 2:
+case PEER_TO_PEER_NODETYPE:
 ConResPrintf(StdOut, IDS_NODETYPEP2P);
 break;
 
-case 4:
+case MIXED_NODETYPE:
 ConResPrintf(StdOut, IDS_NODETYPEMIXED);
 break;
 
-case 8:
+case HYBRID_NODETYPE:
 ConResPrintf(StdOut, IDS_NODETYPEHYBRID);
 break;
 
@@ -890,7 +890,7 @@ Release(
 ret = IpReleaseAddress();
 if (ret != NO_ERROR)
 {
-_tprintf(_T("\nAn error occured while releasing 
interface %ls : \n"), szFriendlyName);
+ConResPrintf(StdOut, IDS_DHCPRELEASEERROR, 
szFriendlyName);
 DoFormatMessage(ret);
 }
 }
@@ -988,7 +988,7 @@ Renew(
 ret = IpRenewAddress();
 if (ret != NO_ERROR)
 {
-_tprintf(_T("\nAn error occured while renew interface 
%ls : "), szFriendlyName);
+ConResPrintf(StdOut, IDS_DHCPRENEWERROR, 
szFriendlyName);
 DoFormatMessage(ret);
 }
 }
diff --git a/base/applications/network/ipconfig/lang/bg-BG.rc 
b/base/applications/network/ipconfig/lang/bg-BG.rc
index 505d454725f..d50fc62f278 100644
--- a/base/applications/network/ipconfig/lang/bg-BG.rc
+++ b/base/applications/network/ipconfig/lang/bg-BG.rc
@@ -89,6 +89,8 @@ BEGIN
 IDS_DHCPNOTENABLED  "Adapter %ls is not enabled for DHCP.\n"
 IDS_DHCPNOADAPTER   "The operation failed as no adapter is in the 
state permissible for \nthis operation.\n"
 IDS_DHCPRELEASED"IP Address for adapter %ls has already been 
released.\n"
+IDS_DHCPRELEASEERROR"An error occurred while releasing interface %ls: "
+IDS_DHCPRENEWERROR  "An error occurred while renewing interface %ls: "
 END
 
 STRINGTABLE
diff --git a/base/applications/network/ipconfig/lang/de-DE.rc 
b/base/applications/network/ipconfig/lang/de-DE.rc
index 76313151a15..4737823e579 100644
--- a/base/applications/network/ipconfig/lang/de-DE.rc
+++ b/base/applications/network/ipconfig/lang/de-DE.rc
@@ -91,6 +91,8 @@ BEGIN
 IDS_DHCPNOTENABLED  "Der Adapter %ls ist nicht für DHCP aktiviert.\n"
 IDS_DHCPNOADAPTER   "Der Vorgang ist fehlgeschlagen, weil kein Adapter 
sich in einem für diesen\nVorgang zulässigen Zustand befindet.\n"
 IDS_DHCPRELEASED"Die IP-Adresse für den Adapter %ls wurde bereits 
freigegeben.\n"
+IDS_DHCPRELEASEERROR"Beim Freigeben der Schnittstellen %ls ist 
folgender Fehler aufgetreten: "
+IDS_DHCPRENEWERROR  "Beim Aktualisieren der Schnittstelle %ls ist 
folgen

[ros-diffs] [reactos] 01/01: [IPCONFIG] Improvements to Release and Renew functions

2023-07-02 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ed80df29e0c135e2179ccfe0e40da2731bc7b27c

commit ed80df29e0c135e2179ccfe0e40da2731bc7b27c
Author: Eric Kohl 
AuthorDate: Sun Jul 2 14:48:03 2023 +0200
Commit: Eric Kohl 
CommitDate: Sun Jul 2 14:48:03 2023 +0200

[IPCONFIG] Improvements to Release and Renew functions

- Reimplement the Release and Renew functions using GetAdaptersInfo().
- Check for enabled DHCP and connected medium
- Check for already released Lease in the Release function
- Add required messages
---
 base/applications/network/ipconfig/ipconfig.c| 195 +--
 base/applications/network/ipconfig/lang/bg-BG.rc |  22 +--
 base/applications/network/ipconfig/lang/de-DE.rc |  22 +--
 base/applications/network/ipconfig/lang/el-GR.rc |  22 +--
 base/applications/network/ipconfig/lang/en-US.rc |  22 +--
 base/applications/network/ipconfig/lang/es-ES.rc |  22 +--
 base/applications/network/ipconfig/lang/fr-FR.rc |  22 +--
 base/applications/network/ipconfig/lang/id-ID.rc |  22 +--
 base/applications/network/ipconfig/lang/it-IT.rc |  22 +--
 base/applications/network/ipconfig/lang/no-NO.rc |  22 +--
 base/applications/network/ipconfig/lang/pl-PL.rc |  22 +--
 base/applications/network/ipconfig/lang/ro-RO.rc |  22 +--
 base/applications/network/ipconfig/lang/ru-RU.rc |  22 +--
 base/applications/network/ipconfig/lang/sk-SK.rc |  22 +--
 base/applications/network/ipconfig/lang/sq-AL.rc |  22 +--
 base/applications/network/ipconfig/lang/sv-SE.rc |  22 +--
 base/applications/network/ipconfig/lang/tr-TR.rc |  22 +--
 base/applications/network/ipconfig/lang/uk-UA.rc |  22 +--
 base/applications/network/ipconfig/lang/zh-CN.rc |  22 +--
 base/applications/network/ipconfig/lang/zh-TW.rc |  22 +--
 base/applications/network/ipconfig/resource.h|   4 +
 21 files changed, 398 insertions(+), 219 deletions(-)

diff --git a/base/applications/network/ipconfig/ipconfig.c 
b/base/applications/network/ipconfig/ipconfig.c
index 43c7b89a531..014a87d120c 100644
--- a/base/applications/network/ipconfig/ipconfig.c
+++ b/base/applications/network/ipconfig/ipconfig.c
@@ -528,7 +528,10 @@ PrintAdapterTypeAndName(
 }
 }
 
-VOID ShowInfo(BOOL bAll)
+VOID
+ShowInfo(
+BOOL bShowHeader,
+BOOL bAll)
 {
 MIB_IFROW mibEntry;
 PIP_ADAPTER_INFO pAdapterInfo = NULL;
@@ -602,7 +605,8 @@ VOID ShowInfo(BOOL bAll)
 
 pAdapter = pAdapterInfo;
 
-ConResPrintf(StdOut, IDS_HEADER);
+if (bShowHeader)
+ConResPrintf(StdOut, IDS_HEADER);
 
 if (bAll)
 {
@@ -805,120 +809,215 @@ MatchWildcard(
 return TRUE;
 }
 
+static
+VOID
+BuildAdapterMap(
+PIP_ADAPTER_INDEX_MAP pAdapterMap,
+PIP_ADAPTER_INFO pAdapterInfo)
+{
+int i, l1, l2;
+
+pAdapterMap->Index = pAdapterInfo->Index;
+
+wcscpy(pAdapterMap->Name, L"\\DEVICE\\TCPIP_");
+l1 = wcslen(pAdapterMap->Name);
+l2 = strlen(pAdapterInfo->AdapterName);
+for (i = 0; i < l2; i++)
+pAdapterMap->Name[i + l1] = (WCHAR)pAdapterInfo->AdapterName[i];
+pAdapterMap->Name[i + l1] = UNICODE_NULL;
+}
+
 VOID
 Release(
 LPWSTR pszAdapterName)
 {
-IP_ADAPTER_INDEX_MAP AdapterInfo;
-DWORD i, ret;
-PIP_INTERFACE_INFO pInfo = NULL;
-ULONG ulOutBufLen = 0;
+PIP_ADAPTER_INFO pAdapterInfo = NULL;
+PIP_ADAPTER_INFO pAdapter = NULL;
+ULONG adaptOutBufLen = 0;
+ULONG ret = 0;
 WCHAR szFriendlyName[MAX_PATH];
+MIB_IFROW mibEntry;
+IP_ADAPTER_INDEX_MAP AdapterMap;
+BOOL bFoundAdapter = FALSE;
 
 ConResPrintf(StdOut, IDS_HEADER);
 
-if (GetInterfaceInfo(pInfo, ) != ERROR_INSUFFICIENT_BUFFER)
+/* call GetAdaptersInfo to obtain the adapter info */
+ret = GetAdaptersInfo(pAdapterInfo, );
+if (ret != ERROR_BUFFER_OVERFLOW)
 {
-_tprintf(_T("\nGetInterfaceInfo failed : "));
-DoFormatMessage(0);
+DoFormatMessage(ret);
 return;
 }
 
-pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen);
-if (pInfo == NULL)
+pAdapterInfo = (IP_ADAPTER_INFO *)HeapAlloc(ProcessHeap, 0, 
adaptOutBufLen);
+if (pAdapterInfo == NULL)
 {
 _tprintf(_T("memory allocation error"));
 return;
 }
 
-if (GetInterfaceInfo(pInfo, ) != NO_ERROR)
+ret = GetAdaptersInfo(pAdapterInfo, );
+if (ret != NO_ERROR)
 {
-_tprintf(_T("\nGetInterfaceInfo failed : "));
 DoFormatMessage(0);
 goto done;
 }
 
-for (i = 0; i < pInfo->NumAdapters; i++)
+pAdapter = pAdapterInfo;
+
+while (pAdapter)
 {
-GetInterfaceFriendlyName(pInfo->Adapter[i].Name, MAX_PATH, 
szFriendlyName);
+GetAdapterFriendlyName(pAdapterInfo->AdapterName, MAX_PATH, 
szFriendlyName);
 
 if ((pszAdapterName == NULL) || MatchWildcard(pszAdapterName, 
szFriendlyName))
 {
-/* TODO: Check for enabled DHCP and connected medium */
+   

[ros-diffs] [reactos] 01/01: [IPCONFIG] Replace some DNS related strings by resources

2023-07-01 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4328b858e50fc30c283a3cd80dd202fa7b794c6e

commit 4328b858e50fc30c283a3cd80dd202fa7b794c6e
Author: Eric Kohl 
AuthorDate: Sat Jul 1 15:32:47 2023 +0200
Commit: Eric Kohl 
CommitDate: Sat Jul 1 15:32:47 2023 +0200

[IPCONFIG] Replace some DNS related strings by resources
---
 base/applications/network/ipconfig/ipconfig.c| 11 ---
 base/applications/network/ipconfig/lang/bg-BG.rc |  8 
 base/applications/network/ipconfig/lang/de-DE.rc |  8 
 base/applications/network/ipconfig/lang/el-GR.rc |  8 
 base/applications/network/ipconfig/lang/en-US.rc |  8 
 base/applications/network/ipconfig/lang/es-ES.rc |  8 
 base/applications/network/ipconfig/lang/fr-FR.rc |  8 
 base/applications/network/ipconfig/lang/id-ID.rc |  8 
 base/applications/network/ipconfig/lang/it-IT.rc |  8 
 base/applications/network/ipconfig/lang/no-NO.rc |  8 
 base/applications/network/ipconfig/lang/pl-PL.rc |  8 
 base/applications/network/ipconfig/lang/ro-RO.rc |  8 
 base/applications/network/ipconfig/lang/ru-RU.rc |  8 
 base/applications/network/ipconfig/lang/sk-SK.rc |  8 
 base/applications/network/ipconfig/lang/sq-AL.rc |  8 
 base/applications/network/ipconfig/lang/sv-SE.rc |  8 
 base/applications/network/ipconfig/lang/tr-TR.rc |  8 
 base/applications/network/ipconfig/lang/uk-UA.rc |  8 
 base/applications/network/ipconfig/lang/zh-CN.rc |  8 
 base/applications/network/ipconfig/lang/zh-TW.rc |  8 
 base/applications/network/ipconfig/resource.h|  7 ++-
 21 files changed, 166 insertions(+), 4 deletions(-)

diff --git a/base/applications/network/ipconfig/ipconfig.c 
b/base/applications/network/ipconfig/ipconfig.c
index a3db75726eb..43c7b89a531 100644
--- a/base/applications/network/ipconfig/ipconfig.c
+++ b/base/applications/network/ipconfig/ipconfig.c
@@ -927,9 +927,14 @@ FlushDns(VOID)
 ConResPrintf(StdOut, IDS_HEADER);
 
 if (DnsFlushResolverCache())
-_tprintf(_T("The DNS Resolver Cache has been deleted.\n"));
+{
+ConResPrintf(StdOut, IDS_DNSFLUSHSUCCESS);
+}
 else
+{
+ConResPrintf(StdOut, IDS_DNSFLUSHERROR);
 DoFormatMessage(GetLastError());
+}
 }
 
 VOID
@@ -965,11 +970,11 @@ DisplayDnsRecord(
 {
 if (Status == DNS_ERROR_RCODE_NAME_ERROR)
 {
-_tprintf(_T("\tName does not exist\n\n"));
+ConResPrintf(StdOut, IDS_DNSNONAME);
 }
 else if (Status == DNS_INFO_NO_RECORDS)
 {
-_tprintf(_T("\tNo records of type %s\n\n"), 
GetRecordTypeName(wType));
+ConResPrintf(StdOut, IDS_DNSNORECORD, GetRecordTypeName(wType));
 }
 return;
 }
diff --git a/base/applications/network/ipconfig/lang/bg-BG.rc 
b/base/applications/network/ipconfig/lang/bg-BG.rc
index ebcbc711495..a91a4b04c10 100644
--- a/base/applications/network/ipconfig/lang/bg-BG.rc
+++ b/base/applications/network/ipconfig/lang/bg-BG.rc
@@ -79,6 +79,14 @@ BEGIN
 IDS_DNSTYPESRV   "\tSRV Record. . . . . . : %ls\n\t
%hu\n\t%hu\n\t%hu\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_DNSNORECORD "\tNo records of type %ls\n\n"
+IDS_DNSNONAME   "\tName does not exist.\n\n"
+IDS_DNSFLUSHERROR   "Could not flush the DNS Resolver Cache: "
+IDS_DNSFLUSHSUCCESS "Successfully flushed the DNS Resolver Cache.\n"
+END
+
 STRINGTABLE
 BEGIN
 /* Please keep the spacing/formatting as per En.rc when translating */
diff --git a/base/applications/network/ipconfig/lang/de-DE.rc 
b/base/applications/network/ipconfig/lang/de-DE.rc
index 398c8aa8ecd..3ac1118752e 100644
--- a/base/applications/network/ipconfig/lang/de-DE.rc
+++ b/base/applications/network/ipconfig/lang/de-DE.rc
@@ -81,6 +81,14 @@ BEGIN
 IDS_DNSTYPESRV   "\tSRV-Eintrag . . . . . : %ls\n\t
%hu\n\t%hu\n\t%hu\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_DNSNORECORD "\tKeine Einträge vom Typ %ls\n\n"
+IDS_DNSNONAME   "\tName existiert nicht.\n\n"
+IDS_DNSFLUSHERROR   "Der DNS-Auflösungscache konnte nicht geleert 
werden: "
+IDS_DNSFLUSHSUCCESS "Der DNS-Auflösungscache wurde geleert.\n"
+END
+
 STRINGTABLE
 BEGIN
 IDS_USAGE
diff --git a/base/applications/network/ipconfig/lang/el-GR.rc 
b/base/applications/network/ipconfig/lang/el-GR.rc
index 64da46ab416..2278736e48d 100644
--- a/base/applications/network/ipconfig/lang/el-GR.rc
+++ b/base/applications/network/ipconfig/lang/el-GR.rc
@@ -79,6 +79,14 @@ BEGIN
 IDS_DNSTYPESRV   "\tSRV Record. . . . . . : %ls\n\t
%hu

[ros-diffs] [reactos] 01/01: [IPCONFIG] Implement globbing for the Release and Renew options

2023-07-01 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=edd332c9525b18328427784f65eb90e607db5abf

commit edd332c9525b18328427784f65eb90e607db5abf
Author: Eric Kohl 
AuthorDate: Sat Jul 1 10:28:33 2023 +0200
Commit: Eric Kohl 
CommitDate: Sat Jul 1 10:28:33 2023 +0200

[IPCONFIG] Implement globbing for the Release and Renew options

- Add a simple Wildcard Matcher.
- Use the Wildcard Matcher in the Release and Renew functions.
---
 base/applications/network/ipconfig/ipconfig.c | 277 +-
 1 file changed, 178 insertions(+), 99 deletions(-)

diff --git a/base/applications/network/ipconfig/ipconfig.c 
b/base/applications/network/ipconfig/ipconfig.c
index d4cdeb7a84c..a3db75726eb 100644
--- a/base/applications/network/ipconfig/ipconfig.c
+++ b/base/applications/network/ipconfig/ipconfig.c
@@ -8,7 +8,6 @@
  * TODO:
  * fix renew / release
  * implement registerdns, showclassid, setclassid
- * allow globbing on adapter names
  */
 
 #define WIN32_NO_STATUS
@@ -225,7 +224,7 @@ VOID
 GetAdapterFriendlyName(
 _In_ LPSTR lpClass,
 _In_ DWORD cchFriendlyNameLength,
-_Out_ PWSTR pszFriendlyName)
+_Out_ LPWSTR pszFriendlyName)
 {
 HKEY hKey = NULL;
 CHAR Path[256];
@@ -261,6 +260,49 @@ GetAdapterFriendlyName(
 RegCloseKey(hKey);
 }
 
+VOID
+GetInterfaceFriendlyName(
+_In_ LPWSTR lpDeviceName,
+_In_ DWORD cchFriendlyNameLength,
+_Out_ LPWSTR pszFriendlyName)
+{
+HKEY hKey = NULL;
+WCHAR Path[256];
+LPWSTR PrePath  = 
L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\";
+LPWSTR PostPath = L"\\Connection";
+LPWSTR DevicePrefix = L"\\DEVICE\\TCPIP_";
+DWORD PathSize;
+DWORD dwType;
+DWORD dwDataSize;
+
+DWORD dwPrefixLength = wcslen(DevicePrefix);
+
+/* don't overflow the buffer */
+PathSize = wcslen(PrePath) + wcslen(lpDeviceName) - dwPrefixLength + 
wcslen(PostPath) + 1;
+if (PathSize >= 255)
+return;
+
+swprintf(Path, L"%s%s%s", PrePath, [dwPrefixLength], 
PostPath);
+
+if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+  Path,
+  0,
+  KEY_READ,
+  ) == ERROR_SUCCESS)
+{
+dwDataSize = cchFriendlyNameLength * sizeof(WCHAR);
+RegQueryValueExW(hKey,
+ L"Name",
+ NULL,
+ ,
+ (PBYTE)pszFriendlyName,
+ );
+}
+
+if (hKey != NULL)
+RegCloseKey(hKey);
+}
+
 static
 VOID
 PrintAdapterDescription(LPSTR lpClass)
@@ -716,129 +758,167 @@ done:
 HeapFree(ProcessHeap, 0, pAdapterInfo);
 }
 
-VOID Release(LPTSTR Index)
+static
+BOOL
+MatchWildcard(
+_In_ PWSTR pszExpression,
+_In_ PWSTR pszName)
 {
-IP_ADAPTER_INDEX_MAP AdapterInfo;
-DWORD ret;
-DWORD i;
+WCHAR *pCharE, *pCharN, charE, charN;
 
-/* if interface is not given, query GetInterfaceInfo */
-if (Index == NULL)
-{
-PIP_INTERFACE_INFO pInfo = NULL;
-ULONG ulOutBufLen = 0;
+if (pszExpression == NULL)
+return TRUE;
 
-if (GetInterfaceInfo(pInfo, ) == ERROR_INSUFFICIENT_BUFFER)
-{
-pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, 
ulOutBufLen);
-if (pInfo == NULL)
-return;
+if (pszName == NULL)
+return FALSE;
 
-if (GetInterfaceInfo(pInfo, ) == NO_ERROR )
-{
-for (i = 0; i < pInfo->NumAdapters; i++)
-{
-CopyMemory(, >Adapter[i], 
sizeof(IP_ADAPTER_INDEX_MAP));
-_tprintf(_T("name - %ls\n"), pInfo->Adapter[i].Name);
-
-/* Call IpReleaseAddress to release the IP address on the 
specified adapter. */
-if ((ret = IpReleaseAddress()) != NO_ERROR)
-{
-_tprintf(_T("\nAn error occured while releasing 
interface %ls : \n"), AdapterInfo.Name);
-DoFormatMessage(ret);
-}
-}
+pCharE = pszExpression;
+pCharN = pszName;
+while (*pCharE != UNICODE_NULL)
+{
+charE = towlower(*pCharE);
+charN = towlower(*pCharN);
 
-HeapFree(ProcessHeap, 0, pInfo);
-}
+if (charE == L'*')
+{
+if (*(pCharE + 1) != charN)
+pCharN++;
 else
-{
-DoFormatMessage(0);
-HeapFree(ProcessHeap, 0, pInfo);
-return;
-}
+pCharE++;
+}
+else if (charE == L'?')
+{
+pCharE++;
+pCharN++;
+}
+else if (charE == charN)
+{
+pCharE++;
+pCharN++;
 }
 else
 

[ros-diffs] [reactos] 01/01: [UMPNPMGR] PNP_Get(First/Next)LogConf: return proper tags for the resource list case

2023-06-29 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e1eb9e3620b03e753f7a4755cbcf4fcb786da5e2

commit e1eb9e3620b03e753f7a4755cbcf4fcb786da5e2
Author: Eric Kohl 
AuthorDate: Thu Jun 29 18:06:02 2023 +0200
Commit: Eric Kohl 
CommitDate: Thu Jun 29 18:06:02 2023 +0200

[UMPNPMGR] PNP_Get(First/Next)LogConf: return proper tags for the resource 
list case
---
 base/services/umpnpmgr/rpcserver.c | 36 ++--
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 355bd75e4e3..4e57e261e13 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -4237,7 +4237,7 @@ PNP_GetFirstLogConf(
 goto done;
 }
 
-DPRINT("Data size %lu\n", ulDataSize);
+DPRINT1("Data size %lu\n", ulDataSize);
 if (ulDataSize == 0 || lpData == NULL)
 {
 DPRINT1("No config data available!\n");
@@ -4248,21 +4248,15 @@ PNP_GetFirstLogConf(
 /* Get the first tag */
 if (RegDataType == REG_RESOURCE_LIST)
 {
-DPRINT("REG_RESOURCE_LIST\n");
+DPRINT("REG_RESOURCE_LIST->Count %lu\n", 
((PCM_RESOURCE_LIST)lpData)->Count);
 
-DPRINT("ResourceList->Count %lu\n", 
((PCM_RESOURCE_LIST)lpData)->Count);
+/* Indicate that we reached the end of the list */
 if (((PCM_RESOURCE_LIST)lpData)->Count == 0)
 {
 DPRINT1("No resource descriptors!\n");
 ret = CR_NO_MORE_LOG_CONF;
 goto done;
 }
-
-DPRINT("lpData %p\n", lpData);
-DPRINT("[0] %p\n", &(((PCM_RESOURCE_LIST)lpData)->List[0]));
-
-*pulLogConfTag = 
(DWORD)((DWORD_PTR)&(((PCM_RESOURCE_LIST)lpData)->List[0]) - (DWORD_PTR)lpData);
-DPRINT("Offset (Tag): 0x%08lx\n", *pulLogConfTag);
 }
 else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
 {
@@ -4347,13 +4341,24 @@ PNP_GetNextLogConf(
 goto done;
 }
 
-/* FIXME: Get the next tag */
+/* Check if the next entry is available */
 if (RegDataType == REG_RESOURCE_LIST)
 {
-DPRINT1("FIXME: REG_RESOURCE_LIST\n");
-/* FIXME */
-ret = CR_NO_MORE_LOG_CONF;
-goto done;
+DPRINT("REG_RESOURCE_LIST->Count %lu\n", 
((PCM_RESOURCE_LIST)lpData)->Count);
+
+/* Fail, if we are beyond the end of the list */
+if (ulCurrentTag >= ((PCM_RESOURCE_LIST)lpData)->Count)
+{
+ret = CR_INVALID_LOG_CONF;
+goto done;
+}
+
+/* Indicate that we reached the end of the list */
+if (ulCurrentTag == ((PCM_RESOURCE_LIST)lpData)->Count - 1)
+{
+ret = CR_NO_MORE_LOG_CONF;
+goto done;
+}
 }
 else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
 {
@@ -4363,6 +4368,9 @@ PNP_GetNextLogConf(
 goto done;
 }
 
+/* Return the next tag value */
+*pulNextTag = ulCurrentTag + 1;
+
 done:
 if (lpData != NULL)
 HeapFree(GetProcessHeap(), 0, lpData);


[ros-diffs] [reactos] 01/01: [UMPNPMGR] OpenConfigurationKey: Open subkeys depending on the configuration type

2023-06-28 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=44a312478d3a2296e3f949b15f7c045478b9b184

commit 44a312478d3a2296e3f949b15f7c045478b9b184
Author: Eric Kohl 
AuthorDate: Wed Jun 28 23:15:26 2023 +0200
Commit: Eric Kohl 
CommitDate: Wed Jun 28 23:15:26 2023 +0200

[UMPNPMGR] OpenConfigurationKey: Open subkeys depending on the 
configuration type

- Boot and Basic Configurations are located in the LogConf subkey.
- Alloc and filtered Configurations are located in the Control subkey.
---
 base/services/umpnpmgr/rpcserver.c | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 70acf5e12ba..355bd75e4e3 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -428,9 +428,11 @@ static
 CONFIGRET
 OpenConfigurationKey(
 _In_ LPCWSTR pszDeviceID,
+_In_ DWORD ulLogConfType,
 _Out_ PHKEY phKey)
 {
 WCHAR szKeyName[MAX_PATH];
+PCWSTR pszSubKeyName;
 HKEY hInstanceKey;
 DWORD dwError;
 
@@ -447,9 +449,26 @@ OpenConfigurationKey(
 if (dwError != ERROR_SUCCESS)
 return CR_INVALID_DEVINST;
 
+switch (ulLogConfType)
+{
+case BOOT_LOG_CONF:
+case BASIC_LOG_CONF:
+pszSubKeyName = L"LogConf";
+break;
+
+case ALLOC_LOG_CONF:
+case FILTERED_LOG_CONF:
+pszSubKeyName = L"Control";
+break;
+
+default:
+DPRINT1("Unsupported configuration type!\n");
+return CR_FAILURE;
+}
+
 /* Create or open the LogConf key */
 dwError = RegCreateKeyExW(hInstanceKey,
-  L"LogConf",
+  pszSubKeyName,
   0,
   NULL,
   REG_OPTION_NON_VOLATILE,
@@ -4197,6 +4216,7 @@ PNP_GetFirstLogConf(
 return CR_INVALID_DEVINST;
 
 ret = OpenConfigurationKey(pDeviceID,
+   ulLogConfType,
);
 if (ret != CR_SUCCESS)
 {
@@ -4297,6 +4317,7 @@ PNP_GetNextLogConf(
 return CR_INVALID_DEVINST;
 
 ret = OpenConfigurationKey(pDeviceID,
+   ulLogConfType,
);
 if (ret != CR_SUCCESS)
 {
@@ -4445,6 +4466,7 @@ PNP_GetNextResDes(
 return CR_INVALID_DEVINST;
 
 ret = OpenConfigurationKey(pDeviceID,
+   ulLogConfType,
);
 if (ret != CR_SUCCESS)
 {


[ros-diffs] [reactos] 01/01: [IPCONFIG] Show data for SOA DNS Entry

2023-06-28 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7f55dd36ea329dc19aaf51a775ac026cb4f28cf7

commit 7f55dd36ea329dc19aaf51a775ac026cb4f28cf7
Author: Eric Kohl 
AuthorDate: Wed Jun 28 22:16:25 2023 +0200
Commit: Eric Kohl 
CommitDate: Wed Jun 28 22:16:25 2023 +0200

[IPCONFIG] Show data for SOA DNS Entry
---
 base/applications/network/ipconfig/ipconfig.c| 10 +-
 base/applications/network/ipconfig/lang/bg-BG.rc |  3 ++-
 base/applications/network/ipconfig/lang/de-DE.rc |  3 ++-
 base/applications/network/ipconfig/lang/el-GR.rc |  3 ++-
 base/applications/network/ipconfig/lang/en-US.rc |  3 ++-
 base/applications/network/ipconfig/lang/es-ES.rc |  3 ++-
 base/applications/network/ipconfig/lang/fr-FR.rc |  3 ++-
 base/applications/network/ipconfig/lang/id-ID.rc |  3 ++-
 base/applications/network/ipconfig/lang/it-IT.rc |  3 ++-
 base/applications/network/ipconfig/lang/no-NO.rc |  3 ++-
 base/applications/network/ipconfig/lang/pl-PL.rc |  3 ++-
 base/applications/network/ipconfig/lang/ro-RO.rc |  3 ++-
 base/applications/network/ipconfig/lang/ru-RU.rc |  3 ++-
 base/applications/network/ipconfig/lang/sk-SK.rc |  3 ++-
 base/applications/network/ipconfig/lang/sq-AL.rc |  3 ++-
 base/applications/network/ipconfig/lang/sv-SE.rc |  3 ++-
 base/applications/network/ipconfig/lang/tr-TR.rc |  3 ++-
 base/applications/network/ipconfig/lang/uk-UA.rc |  3 ++-
 base/applications/network/ipconfig/lang/zh-CN.rc |  3 ++-
 base/applications/network/ipconfig/lang/zh-TW.rc |  3 ++-
 base/applications/network/ipconfig/resource.h| 13 +++--
 21 files changed, 54 insertions(+), 26 deletions(-)

diff --git a/base/applications/network/ipconfig/ipconfig.c 
b/base/applications/network/ipconfig/ipconfig.c
index cc9091556f5..d4cdeb7a84c 100644
--- a/base/applications/network/ipconfig/ipconfig.c
+++ b/base/applications/network/ipconfig/ipconfig.c
@@ -940,7 +940,15 @@ DisplayDnsRecord(
 break;
 
 case DNS_TYPE_SOA:
-ConResPrintf(StdOut, IDS_DNSTYPESOA);
+ConResPrintf(StdOut, IDS_DNSTYPESOA1,
+ pThisRecord->Data.SOA.pNamePrimaryServer,
+ pThisRecord->Data.SOA.pNameAdministrator,
+ pThisRecord->Data.SOA.dwSerialNo);
+ConResPrintf(StdOut, IDS_DNSTYPESOA2,
+ pThisRecord->Data.SOA.dwRefresh,
+ pThisRecord->Data.SOA.dwRetry,
+ pThisRecord->Data.SOA.dwExpire,
+ pThisRecord->Data.SOA.dwDefaultTtl);
 break;
 
 case DNS_TYPE_PTR:
diff --git a/base/applications/network/ipconfig/lang/bg-BG.rc 
b/base/applications/network/ipconfig/lang/bg-BG.rc
index 656fbe85e42..ebcbc711495 100644
--- a/base/applications/network/ipconfig/lang/bg-BG.rc
+++ b/base/applications/network/ipconfig/lang/bg-BG.rc
@@ -70,7 +70,8 @@ BEGIN
 IDS_DNSTYPEA "\tA (Host) Record . . . : %ls\n"
 IDS_DNSTYPENS"\tNS Record . . . . . . : %ls\n"
 IDS_DNSTYPECNAME "\tCNAME Record. . . . . : %ls\n"
-IDS_DNSTYPESOA   "\tSOA Record. . . . . . : \n"
+IDS_DNSTYPESOA1  "\tSOA Record. . . . . . : %ls\n\t
%ls\n\t%lu\n"
+IDS_DNSTYPESOA2  "\t%lu\n\t
%lu\n\t%lu\n\t%lu\n"
 IDS_DNSTYPEPTR   "\tPTR Record. . . . . . : %ls\n"
 IDS_DNSTYPEMX"\tMX Record . . . . . . : %ls\n\t
%hu\n\t%hu\n"
 IDS_DNSTYPE  "\t Record . . . . . : %ls\n"
diff --git a/base/applications/network/ipconfig/lang/de-DE.rc 
b/base/applications/network/ipconfig/lang/de-DE.rc
index b63223bea39..398c8aa8ecd 100644
--- a/base/applications/network/ipconfig/lang/de-DE.rc
+++ b/base/applications/network/ipconfig/lang/de-DE.rc
@@ -72,7 +72,8 @@ BEGIN
 IDS_DNSTYPEA "\t(Host-)A-Eintrag. . . : %ls\n"
 IDS_DNSTYPENS"\tNS-Eintrag. . . . . . : %ls\n"
 IDS_DNSTYPECNAME "\tCNAME-Eintrag . . . . : %ls\n"
-IDS_DNSTYPESOA   "\tSOA-Eintrag . . . . . : \n"
+IDS_DNSTYPESOA1  "\tSOA-Eintrag . . . . . : %ls\n\t
%ls\n\t%lu\n"
+IDS_DNSTYPESOA2  "\t%lu\n\t
%lu\n\t%lu\n\t%lu\n"
 IDS_DNSTYPEPTR   "\tPTR-Eintrag . . . . . : %ls\n"
 IDS_DNSTYPEMX"\tMX-Eintrag. . . . . . : %ls\n\t
%hu\n\t%hu\n"
 IDS_DNSTYPE  "

[ros-diffs] [reactos] 01/01: [IPCONFIG] Show data for MX and SRV DNS Entries

2023-06-27 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1abfdde2d4c96c91fe5c6fc9b9ed9f7c880d9c54

commit 1abfdde2d4c96c91fe5c6fc9b9ed9f7c880d9c54
Author: Eric Kohl 
AuthorDate: Tue Jun 27 09:27:30 2023 +0200
Commit: Eric Kohl 
CommitDate: Tue Jun 27 09:27:30 2023 +0200

[IPCONFIG] Show data for MX and SRV DNS Entries
---
 base/applications/network/ipconfig/ipconfig.c| 17 -
 base/applications/network/ipconfig/lang/bg-BG.rc |  4 ++--
 base/applications/network/ipconfig/lang/de-DE.rc |  4 ++--
 base/applications/network/ipconfig/lang/el-GR.rc |  4 ++--
 base/applications/network/ipconfig/lang/en-US.rc |  4 ++--
 base/applications/network/ipconfig/lang/es-ES.rc |  4 ++--
 base/applications/network/ipconfig/lang/fr-FR.rc |  4 ++--
 base/applications/network/ipconfig/lang/id-ID.rc |  4 ++--
 base/applications/network/ipconfig/lang/it-IT.rc |  4 ++--
 base/applications/network/ipconfig/lang/no-NO.rc |  4 ++--
 base/applications/network/ipconfig/lang/pl-PL.rc |  4 ++--
 base/applications/network/ipconfig/lang/ro-RO.rc |  4 ++--
 base/applications/network/ipconfig/lang/ru-RU.rc |  4 ++--
 base/applications/network/ipconfig/lang/sk-SK.rc |  4 ++--
 base/applications/network/ipconfig/lang/sq-AL.rc |  4 ++--
 base/applications/network/ipconfig/lang/sv-SE.rc |  4 ++--
 base/applications/network/ipconfig/lang/tr-TR.rc |  4 ++--
 base/applications/network/ipconfig/lang/uk-UA.rc |  4 ++--
 base/applications/network/ipconfig/lang/zh-CN.rc |  4 ++--
 base/applications/network/ipconfig/lang/zh-TW.rc |  4 ++--
 20 files changed, 50 insertions(+), 43 deletions(-)

diff --git a/base/applications/network/ipconfig/ipconfig.c 
b/base/applications/network/ipconfig/ipconfig.c
index fdbdda545e1..cc9091556f5 100644
--- a/base/applications/network/ipconfig/ipconfig.c
+++ b/base/applications/network/ipconfig/ipconfig.c
@@ -948,7 +948,10 @@ DisplayDnsRecord(
 break;
 
 case DNS_TYPE_MX:
-ConResPrintf(StdOut, IDS_DNSTYPEMX);
+ConResPrintf(StdOut, IDS_DNSTYPEMX,
+ pThisRecord->Data.MX.pNameExchange,
+ pThisRecord->Data.MX.wPreference,
+ pThisRecord->Data.MX.Pad);
 break;
 
 case DNS_TYPE_:
@@ -962,10 +965,14 @@ DisplayDnsRecord(
 break;
 
 case DNS_TYPE_SRV:
-ConResPrintf(StdOut, IDS_DNSTYPESRV);
+ConResPrintf(StdOut, IDS_DNSTYPESRV,
+ pThisRecord->Data.SRV.pNameTarget,
+ pThisRecord->Data.SRV.wPriority,
+ pThisRecord->Data.SRV.wWeight,
+ pThisRecord->Data.SRV.wPort);
 break;
 }
-_tprintf(_T("\n\n"));
+ConPuts(StdOut, L"\n\n");
 
 pThisRecord = pNextRecord;
 }
@@ -994,10 +1001,10 @@ DisplayDns(VOID)
 {
 pNextEntry = pThisEntry->pNext;
 
-if (pThisEntry->wType1 != 0)
+if (pThisEntry->wType1 != DNS_TYPE_ZERO)
 DisplayDnsRecord(pThisEntry->pszName, pThisEntry->wType1);
 
-if (pThisEntry->wType2 != 0)
+if (pThisEntry->wType2 != DNS_TYPE_ZERO)
 DisplayDnsRecord(pThisEntry->pszName, pThisEntry->wType2);
 
 if (pThisEntry->pszName)
diff --git a/base/applications/network/ipconfig/lang/bg-BG.rc 
b/base/applications/network/ipconfig/lang/bg-BG.rc
index 01235582af1..656fbe85e42 100644
--- a/base/applications/network/ipconfig/lang/bg-BG.rc
+++ b/base/applications/network/ipconfig/lang/bg-BG.rc
@@ -72,10 +72,10 @@ BEGIN
 IDS_DNSTYPECNAME "\tCNAME Record. . . . . : %ls\n"
 IDS_DNSTYPESOA   "\tSOA Record. . . . . . : \n"
 IDS_DNSTYPEPTR   "\tPTR Record. . . . . . : %ls\n"
-IDS_DNSTYPEMX"\tMX Record . . . . . . : \n"
+IDS_DNSTYPEMX"\tMX Record . . . . . . : %ls\n\t
%hu\n\t%hu\n"
 IDS_DNSTYPE  "\t Record . . . . . : %ls\n"
 IDS_DNSTYPEATMA  "\tATMA Record . . . . . : \n"
-IDS_DNSTYPESRV   "\tSRV Record. . . . . . : \n"
+IDS_DNSTYPESRV   "\tSRV Record. . . . . . : %ls\n\t
%hu\n\t%hu\n\t%hu\n"
 END
 
 STRINGTABLE
diff --git a/base/applications/network/ipconfig/lang/de-DE.rc 
b/base/applications/network/ipconfig/lang/de-DE.rc
index 38bf2a5306e..b63223bea39 100644
--- a/base/applications/network/ipconfig/lang/de-DE.rc
+++ b/base/applications/network/ipconfig/lang/de-DE.rc
@@ -74,10 +74,10 @@ BEGIN
 IDS_DNSTYPECNAME "\tCNAME-Eintrag . . . . : %ls\n"
 IDS_DNSTYPESOA   "\tSOA-Eintrag . . . . . : \n"
 IDS

[ros-diffs] [reactos] 01/01: [IPCONFIG] Simplify the not type output

2023-06-26 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0d0bd954a864414266586650a57bed83555ecfa0

commit 0d0bd954a864414266586650a57bed83555ecfa0
Author: Eric Kohl 
AuthorDate: Mon Jun 26 12:26:04 2023 +0200
Commit: Eric Kohl 
CommitDate: Mon Jun 26 12:26:04 2023 +0200

[IPCONFIG] Simplify the not type output
---
 base/applications/network/ipconfig/ipconfig.c| 16 +++
 base/applications/network/ipconfig/lang/bg-BG.rc | 15 ++
 base/applications/network/ipconfig/lang/de-DE.rc | 15 ++
 base/applications/network/ipconfig/lang/el-GR.rc | 15 ++
 base/applications/network/ipconfig/lang/en-US.rc | 15 ++
 base/applications/network/ipconfig/lang/es-ES.rc | 15 ++
 base/applications/network/ipconfig/lang/fr-FR.rc | 15 ++
 base/applications/network/ipconfig/lang/id-ID.rc | 15 ++
 base/applications/network/ipconfig/lang/it-IT.rc | 15 ++
 base/applications/network/ipconfig/lang/no-NO.rc | 15 ++
 base/applications/network/ipconfig/lang/pl-PL.rc | 15 ++
 base/applications/network/ipconfig/lang/ro-RO.rc | 15 ++
 base/applications/network/ipconfig/lang/ru-RU.rc | 15 ++
 base/applications/network/ipconfig/lang/sk-SK.rc | 15 ++
 base/applications/network/ipconfig/lang/sq-AL.rc | 15 ++
 base/applications/network/ipconfig/lang/sv-SE.rc | 15 ++
 base/applications/network/ipconfig/lang/tr-TR.rc | 15 ++
 base/applications/network/ipconfig/lang/uk-UA.rc | 15 ++
 base/applications/network/ipconfig/lang/zh-CN.rc | 15 ++
 base/applications/network/ipconfig/lang/zh-TW.rc | 15 ++
 base/applications/network/ipconfig/resource.h| 59 
 21 files changed, 131 insertions(+), 229 deletions(-)

diff --git a/base/applications/network/ipconfig/ipconfig.c 
b/base/applications/network/ipconfig/ipconfig.c
index 5ce159fd7b6..fdbdda545e1 100644
--- a/base/applications/network/ipconfig/ipconfig.c
+++ b/base/applications/network/ipconfig/ipconfig.c
@@ -410,33 +410,31 @@ CLEANUP:
 
 static
 VOID
-PrintNodeType(UINT NodeType)
+PrintNodeType(
+_In_ UINT NodeType)
 {
-ConResPrintf(StdOut, IDS_NODETYPE);
-
 switch (NodeType)
 {
 case 1:
-ConResPrintf(StdOut, IDS_BCAST);
+ConResPrintf(StdOut, IDS_NODETYPEBCAST);
 break;
 
 case 2:
-ConResPrintf(StdOut, IDS_P2P);
+ConResPrintf(StdOut, IDS_NODETYPEP2P);
 break;
 
 case 4:
-ConResPrintf(StdOut, IDS_MIXED);
+ConResPrintf(StdOut, IDS_NODETYPEMIXED);
 break;
 
 case 8:
-ConResPrintf(StdOut, IDS_HYBRID);
+ConResPrintf(StdOut, IDS_NODETYPEHYBRID);
 break;
 
 default :
-ConResPrintf(StdOut, IDS_UNKNOWN);
+ConResPrintf(StdOut, IDS_NODETYPEUNKNOWN);
 break;
 }
-printf("\n");
 }
 
 static
diff --git a/base/applications/network/ipconfig/lang/bg-BG.rc 
b/base/applications/network/ipconfig/lang/bg-BG.rc
index 836b3c35033..01235582af1 100644
--- a/base/applications/network/ipconfig/lang/bg-BG.rc
+++ b/base/applications/network/ipconfig/lang/bg-BG.rc
@@ -12,7 +12,11 @@ BEGIN
 IDS_HEADER "\nReactOS IP Configuration\n\n"
 IDS_HOSTNAME"\tHost Name . . . . . . . . . . . . : %hs\n"
 IDS_PRIMARYDNSSUFFIX"\tPrimary DNS Suffix. . . . . . . . : %hs\n"
-IDS_NODETYPE"\tNode Type . . . . . . . . . . . . : "
+IDS_NODETYPEBCAST   "\tNode Type . . . . . . . . . . . . : 
Разпръскване\n"
+IDS_NODETYPEP2P "\tNode Type . . . . . . . . . . . . : Равен с 
равен (P2P)\n"
+IDS_NODETYPEMIXED   "\tNode Type . . . . . . . . . . . . : Смесен\n"
+IDS_NODETYPEHYBRID  "\tNode Type . . . . . . . . . . . . : Хибриден\n"
+IDS_NODETYPEUNKNOWN "\tNode Type . . . . . . . . . . . . : 
неизвестен\n"
 IDS_IPROUTINGNO "\tIP Routing Enabled. . . . . . . . : No\n"
 IDS_IPROUTINGYES"\tIP Routing Enabled. . . . . . . . : Yes\n"
 IDS_WINSPROXYNO "\tWINS Proxy enabled. . . . . . . . : No\n"
@@ -38,15 +42,6 @@ BEGIN
 IDS_LEASEEXPIRES"\tLease Expires . . . . . . . . . . : %s\n"
 END
 
-STRINGTABLE
-BEGIN
-IDS_BCAST "Разпръскване"
-IDS_P2P "Равен с равен (P2P)"
-IDS_MIXED "Смесен"
-IDS_HYBRID "Хибриден"
-IDS_UNKNOWN "неизвестен"
-END
-
 STRINGTABLE
 BEGIN
 IDS_UNKNOWNADAPTER "\nUnknown Adapter: %ls\n"
diff --git a/base/applications/network/ipconfig/lang/de-DE.rc 
b/base/applications/network/ipconfig/lang/de-DE.rc
index 9159ffbe2f6..38bf2a5306e 100644
--- a/base/applications/network/ipconfig/lang/de-DE.rc
+++ b/base/applications/network/ipconfig/lang/de-DE.rc
@@ -14,7 +14,11 @@ BEGIN
 IDS_HEADER "\nReactOS-IP-Konfi

[ros-diffs] [reactos] 01/01: [IPCONFIG] Remove unused resources

2023-06-26 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d737153ac958fc470e1f6e6994c44420684f2eab

commit d737153ac958fc470e1f6e6994c44420684f2eab
Author: Eric Kohl 
AuthorDate: Mon Jun 26 08:12:07 2023 +0200
Commit: Eric Kohl 
CommitDate: Mon Jun 26 08:12:07 2023 +0200

[IPCONFIG] Remove unused resources
---
 base/applications/network/ipconfig/lang/bg-BG.rc | 6 --
 base/applications/network/ipconfig/lang/de-DE.rc | 6 --
 base/applications/network/ipconfig/lang/el-GR.rc | 6 --
 base/applications/network/ipconfig/lang/en-US.rc | 6 --
 base/applications/network/ipconfig/lang/es-ES.rc | 6 --
 base/applications/network/ipconfig/lang/fr-FR.rc | 6 --
 base/applications/network/ipconfig/lang/id-ID.rc | 6 --
 base/applications/network/ipconfig/lang/it-IT.rc | 6 --
 base/applications/network/ipconfig/lang/no-NO.rc | 6 --
 base/applications/network/ipconfig/lang/pl-PL.rc | 6 --
 base/applications/network/ipconfig/lang/ro-RO.rc | 6 --
 base/applications/network/ipconfig/lang/ru-RU.rc | 6 --
 base/applications/network/ipconfig/lang/sk-SK.rc | 6 --
 base/applications/network/ipconfig/lang/sq-AL.rc | 6 --
 base/applications/network/ipconfig/lang/sv-SE.rc | 6 --
 base/applications/network/ipconfig/lang/tr-TR.rc | 6 --
 base/applications/network/ipconfig/lang/uk-UA.rc | 6 --
 base/applications/network/ipconfig/lang/zh-CN.rc | 6 --
 base/applications/network/ipconfig/lang/zh-TW.rc | 6 --
 base/applications/network/ipconfig/resource.h| 3 ---
 20 files changed, 117 deletions(-)

diff --git a/base/applications/network/ipconfig/lang/bg-BG.rc 
b/base/applications/network/ipconfig/lang/bg-BG.rc
index f93d0366ded..836b3c35033 100644
--- a/base/applications/network/ipconfig/lang/bg-BG.rc
+++ b/base/applications/network/ipconfig/lang/bg-BG.rc
@@ -38,12 +38,6 @@ BEGIN
 IDS_LEASEEXPIRES"\tLease Expires . . . . . . . . . . : %s\n"
 END
 
-STRINGTABLE
-BEGIN
-IDS_YES "Yes"
-IDS_NO  "No"
-END
-
 STRINGTABLE
 BEGIN
 IDS_BCAST "Разпръскване"
diff --git a/base/applications/network/ipconfig/lang/de-DE.rc 
b/base/applications/network/ipconfig/lang/de-DE.rc
index bf670fe123b..9159ffbe2f6 100644
--- a/base/applications/network/ipconfig/lang/de-DE.rc
+++ b/base/applications/network/ipconfig/lang/de-DE.rc
@@ -40,12 +40,6 @@ BEGIN
 IDS_LEASEEXPIRES"\tLease läuft ab. . . . . . . . . . : %s\n"
 END
 
-STRINGTABLE
-BEGIN
-IDS_YES "Yes"
-IDS_NO  "No"
-END
-
 STRINGTABLE
 BEGIN
 IDS_BCAST "Broadcast"
diff --git a/base/applications/network/ipconfig/lang/el-GR.rc 
b/base/applications/network/ipconfig/lang/el-GR.rc
index 502546eff51..4be19f6bb0f 100644
--- a/base/applications/network/ipconfig/lang/el-GR.rc
+++ b/base/applications/network/ipconfig/lang/el-GR.rc
@@ -38,12 +38,6 @@ BEGIN
 IDS_LEASEEXPIRES"\tLease Expires . . . . . . . . . . : %s\n"
 END
 
-STRINGTABLE
-BEGIN
-IDS_YES "Yes"
-IDS_NO  "No"
-END
-
 STRINGTABLE
 BEGIN
 IDS_BCAST "Broadcast"
diff --git a/base/applications/network/ipconfig/lang/en-US.rc 
b/base/applications/network/ipconfig/lang/en-US.rc
index 5d96ace1341..6b76877c170 100644
--- a/base/applications/network/ipconfig/lang/en-US.rc
+++ b/base/applications/network/ipconfig/lang/en-US.rc
@@ -38,12 +38,6 @@ BEGIN
 IDS_LEASEEXPIRES"\tLease Expires . . . . . . . . . . : %s\n"
 END
 
-STRINGTABLE
-BEGIN
-IDS_YES "Yes"
-IDS_NO  "No"
-END
-
 STRINGTABLE
 BEGIN
 IDS_BCAST "Broadcast"
diff --git a/base/applications/network/ipconfig/lang/es-ES.rc 
b/base/applications/network/ipconfig/lang/es-ES.rc
index 3ba7dc579c6..649b8fc4c03 100644
--- a/base/applications/network/ipconfig/lang/es-ES.rc
+++ b/base/applications/network/ipconfig/lang/es-ES.rc
@@ -39,12 +39,6 @@ BEGIN
 IDS_LEASEEXPIRES"\tLease Expires . . . . . . . . . . : %s\n"
 END
 
-STRINGTABLE
-BEGIN
-IDS_YES "Yes"
-IDS_NO  "No"
-END
-
 STRINGTABLE
 BEGIN
 IDS_BCAST   "Difusión"
diff --git a/base/applications/network/ipconfig/lang/fr-FR.rc 
b/base/applications/network/ipconfig/lang/fr-FR.rc
index d38aed55d4d..a4191e7d3ce 100644
--- a/base/applications/network/ipconfig/lang/fr-FR.rc
+++ b/base/applications/network/ipconfig/lang/fr-FR.rc
@@ -40,12 +40,6 @@ BEGIN
 IDS_LEASEEXPIRES"\tLease Expires . . . . . . . . . . : %s\n"
 END
 
-STRINGTABLE
-BEGIN
-IDS_YES "Yes"
-IDS_NO  "No"
-END
-
 STRINGTABLE
 BEGIN
 IDS_BCAST "Broadcast"
diff --git a/base/applications/network/ipconfig/lang/id-ID.rc 
b/base/applications/network/ipconfig/lang/id-ID.rc
index f38a3c016c6..0cb757fceee 100644
--- a/base/applications/network/ipconfig/lang/id-ID.rc
+++ b/base/applications/network/ipconfig/lang/id-ID.rc
@@ -38,12 +38,6 @@ BEGIN
 IDS_LEASEEXPIR

[ros-diffs] [reactos] 01/01: [IPCONFIG] Improve adapter type and name output

2023-06-25 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=50d78f04e348c9a9702f9f35ca8b28990a982be0

commit 50d78f04e348c9a9702f9f35ca8b28990a982be0
Author: Eric Kohl 
AuthorDate: Sun Jun 25 14:00:47 2023 +0200
Commit: Eric Kohl 
CommitDate: Sun Jun 25 14:00:47 2023 +0200

[IPCONFIG] Improve adapter type and name output
---
 base/applications/network/ipconfig/ipconfig.c| 81 +++-
 base/applications/network/ipconfig/lang/bg-BG.rc | 18 +++---
 base/applications/network/ipconfig/lang/de-DE.rc | 18 +++---
 base/applications/network/ipconfig/lang/el-GR.rc | 18 +++---
 base/applications/network/ipconfig/lang/en-US.rc | 18 +++---
 base/applications/network/ipconfig/lang/es-ES.rc | 18 +++---
 base/applications/network/ipconfig/lang/fr-FR.rc | 18 +++---
 base/applications/network/ipconfig/lang/id-ID.rc | 18 +++---
 base/applications/network/ipconfig/lang/it-IT.rc | 18 +++---
 base/applications/network/ipconfig/lang/no-NO.rc | 18 +++---
 base/applications/network/ipconfig/lang/pl-PL.rc | 18 +++---
 base/applications/network/ipconfig/lang/ro-RO.rc | 18 +++---
 base/applications/network/ipconfig/lang/ru-RU.rc | 18 +++---
 base/applications/network/ipconfig/lang/sk-SK.rc | 18 +++---
 base/applications/network/ipconfig/lang/sq-AL.rc | 18 +++---
 base/applications/network/ipconfig/lang/sv-SE.rc | 18 +++---
 base/applications/network/ipconfig/lang/tr-TR.rc | 18 +++---
 base/applications/network/ipconfig/lang/uk-UA.rc | 18 +++---
 base/applications/network/ipconfig/lang/zh-CN.rc | 18 +++---
 base/applications/network/ipconfig/lang/zh-TW.rc | 18 +++---
 20 files changed, 194 insertions(+), 229 deletions(-)

diff --git a/base/applications/network/ipconfig/ipconfig.c 
b/base/applications/network/ipconfig/ipconfig.c
index 584ca887e94..5ce159fd7b6 100644
--- a/base/applications/network/ipconfig/ipconfig.c
+++ b/base/applications/network/ipconfig/ipconfig.c
@@ -222,11 +222,12 @@ VOID DoFormatMessage(LONG ErrorCode)
 }
 
 VOID
-PrintAdapterFriendlyName(LPSTR lpClass)
+GetAdapterFriendlyName(
+_In_ LPSTR lpClass,
+_In_ DWORD cchFriendlyNameLength,
+_Out_ PWSTR pszFriendlyName)
 {
 HKEY hKey = NULL;
-LPSTR ConType = NULL;
-LPSTR ConTypeTmp = NULL;
 CHAR Path[256];
 LPSTR PrePath  = 
"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\";
 LPSTR PostPath = "\\Connection";
@@ -247,47 +248,13 @@ PrintAdapterFriendlyName(LPSTR lpClass)
   KEY_READ,
   ) == ERROR_SUCCESS)
 {
-if (RegQueryValueExA(hKey,
- "Name",
- NULL,
- ,
- NULL,
- ) == ERROR_SUCCESS)
-{
-ConTypeTmp = (LPSTR)HeapAlloc(ProcessHeap,
-  0,
-  dwDataSize);
-if (ConTypeTmp == NULL)
-return;
-
-ConType = (LPSTR)HeapAlloc(ProcessHeap,
-   0,
-   dwDataSize);
-if (ConType == NULL)
-{
-HeapFree(ProcessHeap, 0, ConTypeTmp);
-return;
-}
-
-if (RegQueryValueExA(hKey,
- "Name",
- NULL,
- ,
- (PBYTE)ConTypeTmp,
- ) != ERROR_SUCCESS)
-{
-HeapFree(ProcessHeap, 0, ConType);
-ConType = NULL;
-}
-
-if (ConType)
-CharToOemA(ConTypeTmp, ConType);
-
-printf("%s\n", ConType);
-
-HeapFree(ProcessHeap, 0, ConTypeTmp);
-HeapFree(ProcessHeap, 0, ConType);
-}
+dwDataSize = cchFriendlyNameLength * sizeof(WCHAR);
+RegQueryValueExW(hKey,
+ L"Name",
+ NULL,
+ ,
+ (PBYTE)pszFriendlyName,
+ );
 }
 
 if (hKey != NULL)
@@ -477,50 +444,48 @@ VOID
 PrintAdapterTypeAndName(
 PIP_ADAPTER_INFO pAdapterInfo)
 {
-printf("\n");
+WCHAR szFriendlyName[MAX_PATH];
+
+GetAdapterFriendlyName(pAdapterInfo->AdapterName, MAX_PATH, 
szFriendlyName);
 
 switch (pAdapterInfo->Type)
 {
 case MIB_IF_TYPE_OTHER:
-ConResPrintf(StdOut, IDS_OTHER);
+ConResPrintf(StdOut, IDS_OTHER, szFriendlyName);
 break;
 
 case MIB_IF_TYPE_ETHERNET:
-ConResPrintf(StdOut, IDS_ETH);
+ConResPrintf(StdOut, IDS_ETH, szFriendlyName);
 break;
 
 case MIB_IF_TYPE_TOKENRING:
-ConResPrintf(StdOut, IDS_TOKEN);
+ConResPrintf(StdOut, IDS_

[ros-diffs] [reactos] 01/01: [IPCONFIG] Improve the German translation

2023-06-23 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c63489f1e893cd05055f75bce251237170b26862

commit c63489f1e893cd05055f75bce251237170b26862
Author: Eric Kohl 
AuthorDate: Fri Jun 23 12:24:26 2023 +0200
Commit: Eric Kohl 
CommitDate: Fri Jun 23 12:24:26 2023 +0200

[IPCONFIG] Improve the German translation
---
 base/applications/network/ipconfig/lang/de-DE.rc | 38 
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/base/applications/network/ipconfig/lang/de-DE.rc 
b/base/applications/network/ipconfig/lang/de-DE.rc
index 2788460232f..1ea6e8f0e96 100644
--- a/base/applications/network/ipconfig/lang/de-DE.rc
+++ b/base/applications/network/ipconfig/lang/de-DE.rc
@@ -57,7 +57,7 @@ END
 
 STRINGTABLE
 BEGIN
-IDS_UNKNOWNADAPTER "Unknown Adapter"
+IDS_UNKNOWNADAPTER "Unbekannter Adapter"
 IDS_OTHER "Anderer Adapter"
 IDS_ETH "Ethernet-Adapter"
 IDS_TOKEN "Token-Ring-Adapter"
@@ -65,30 +65,30 @@ BEGIN
 IDS_PPP "PPP-Adapter"
 IDS_LOOP "Loopback-Adapter"
 IDS_SLIP "SLIP-Adapter"
-IDS_WIFI "Wireless Network Adapter"
+IDS_WIFI "Drahtlos-LAN-Adapter"
 END
 
 STRINGTABLE
 BEGIN
 IDS_DNSNAME  "\t%ls\n"
 IDS_DNSLINE  "\t\n"
-IDS_DNSRECORDNAME"\tRecord Name . . . . . : %ls\n"
-IDS_DNSRECORDTYPE"\tRecord Type . . . . . : %hu\n"
-IDS_DNSRECORDTTL "\tTime To Live. . . . . : %lu\n"
-IDS_DNSRECORDLENGTH  "\tData Length . . . . . : %hu\n"
-IDS_DNSSECTIONQUESTION   "\tSection . . . . . . . : Question\n"
-IDS_DNSSECTIONANSWER "\tSection . . . . . . . : Answer\n"
-IDS_DNSSECTIONAUTHORITY  "\tSection . . . . . . . : Authority\n"
-IDS_DNSSECTIONADDITIONAL "\tSection . . . . . . . : Additional\n"
-IDS_DNSTYPEA "\tA (Host) Record . . . : %ls\n"
-IDS_DNSTYPENS"\tNS Record . . . . . . : %ls\n"
-IDS_DNSTYPECNAME "\tCNAME Record. . . . . : %ls\n"
-IDS_DNSTYPESOA   "\tSOA Record. . . . . . : \n"
-IDS_DNSTYPEPTR   "\tPTR Record. . . . . . : %ls\n"
-IDS_DNSTYPEMX"\tMX Record . . . . . . : \n"
-IDS_DNSTYPE  "\t Record . . . . . : %ls\n"
-IDS_DNSTYPEATMA  "\tATMA Record . . . . . : \n"
-IDS_DNSTYPESRV   "\tSRV Record. . . . . . : \n"
+IDS_DNSRECORDNAME"\tEintragsname. . . . . : %ls\n"
+IDS_DNSRECORDTYPE"\tEintragstyp . . . . . : %hu\n"
+IDS_DNSRECORDTTL "\tGültigkeitsdauer. . . : %lu\n"
+IDS_DNSRECORDLENGTH  "\tDatenlänge. . . . . . : %hu\n"
+IDS_DNSSECTIONQUESTION   "\tAbschnitt . . . . . . : Frage\n"
+IDS_DNSSECTIONANSWER "\tAbschnitt . . . . . . : Antwort\n"
+IDS_DNSSECTIONAUTHORITY  "\tAbschnitt . . . . . . : Autorität\n"
+IDS_DNSSECTIONADDITIONAL "\tAbschnitt . . . . . . : Weiteres\n"
+IDS_DNSTYPEA "\t(Host-)A-Eintrag. . . : %ls\n"
+IDS_DNSTYPENS"\tNS-Eintrag. . . . . . : %ls\n"
+IDS_DNSTYPECNAME "\tCNAME-Eintrag . . . . : %ls\n"
+IDS_DNSTYPESOA   "\tSOA-Eintrag . . . . . : \n"
+IDS_DNSTYPEPTR   "\tPTR-Eintrag . . . . . : %ls\n"
+IDS_DNSTYPEMX"\tMX-Eintrag. . . . . . : \n"
+IDS_DNSTYPE  "\t-Eintrag. . . . . : %ls\n"
+IDS_DNSTYPEATMA  "\tATMA-Eintrag. . . . . : \n"
+IDS_DNSTYPESRV   "\tSRV-Eintrag . . . . . : \n"
 END
 
 STRINGTABLE


[ros-diffs] [reactos] 01/01: [NET] Add the net session command

2023-06-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a38b133dd1379417889ad165650748e01add7dd1

commit a38b133dd1379417889ad165650748e01add7dd1
Author: Eric Kohl 
AuthorDate: Thu Jun 22 12:40:46 2023 +0200
Commit: Eric Kohl 
CommitDate: Thu Jun 22 12:40:46 2023 +0200

[NET] Add the net session command
---
 base/applications/network/net/CMakeLists.txt |   1 +
 base/applications/network/net/cmdSession.c   | 154 +++
 base/applications/network/net/main.c |   2 +-
 base/applications/network/net/net.h  |   3 +
 4 files changed, 159 insertions(+), 1 deletion(-)

diff --git a/base/applications/network/net/CMakeLists.txt 
b/base/applications/network/net/CMakeLists.txt
index bac107000f2..a990a9c2f6f 100644
--- a/base/applications/network/net/CMakeLists.txt
+++ b/base/applications/network/net/CMakeLists.txt
@@ -14,6 +14,7 @@ list(APPEND SOURCE
 cmdHelpMsg.c
 cmdLocalGroup.c
 cmdPause.c
+cmdSession.c
 cmdShare.c
 cmdStart.c
 cmdStatistics.c
diff --git a/base/applications/network/net/cmdSession.c 
b/base/applications/network/net/cmdSession.c
new file mode 100644
index 000..90763b31ac6
--- /dev/null
+++ b/base/applications/network/net/cmdSession.c
@@ -0,0 +1,154 @@
+/*
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT: ReactOS net command
+ * FILE:base/applications/network/net/cmdSession.c
+ * PROGRAMMERS: Eric Kohl 
+ */
+
+#include "net.h"
+
+static
+VOID
+SecondsToDurationString(
+_Out_ PWSTR DurationString,
+_In_ size_t DurationStringSize,
+_In_ DWORD dwDuration)
+{
+DWORD dwHours, dwRemainingSeconds, dwMinutes, dwSeconds;
+
+dwHours = dwDuration / 3600;
+dwRemainingSeconds = dwDuration % 3600;
+dwMinutes = dwRemainingSeconds / 60;
+dwSeconds = dwRemainingSeconds % 60;
+
+StringCchPrintfW(DurationString, DurationStringSize, L"%02lu:%02lu:%02lu", 
dwHours, dwMinutes, dwSeconds);
+}
+
+
+NET_API_STATUS
+EnumSessions(
+_In_ PWSTR pszComputerName,
+_In_ BOOL bList)
+{
+PSESSION_INFO_2 pBuffer = NULL;
+WCHAR DurationBuffer[10];
+DWORD dwRead = 0, dwTotal = 0, i;
+DWORD ResumeHandle = 0;
+NET_API_STATUS Status;
+
+Status = NetSessionEnum(pszComputerName,
+NULL,
+NULL,
+2,
+(LPBYTE*),
+MAX_PREFERRED_LENGTH,
+,
+,
+);
+if ((Status != NERR_Success) && (Status != ERROR_MORE_DATA))
+{
+//PrintMessageStringV(3502, Status);
+ConPrintf(StdOut, L"System error %lu has occurred.\n\n", Status);
+return Status;
+}
+
+if (dwTotal == 0)
+{
+PrintMessageString(3683);
+}
+else
+{
+ConPuts(StdOut, L"\n");
+PrintMessageString(4750);
+PrintPadding(L'-', 79);
+ConPuts(StdOut, L"\n");
+
+for (i = 0; i < dwRead; i++)
+{
+if (pBuffer[i].sesi2_cname)
+{
+SecondsToDurationString(DurationBuffer,
+ARRAYSIZE(DurationBuffer),
+pBuffer[i].sesi2_idle_time);
+
+ConPrintf(StdOut, L"%-22.22s %-20.20s %-17.17s %-5lu %-8.8s\n",
+  pBuffer[i].sesi2_cname,
+  pBuffer[i].sesi2_username,
+  pBuffer[i].sesi2_cltype_name,
+  pBuffer[i].sesi2_num_opens,
+  DurationBuffer);
+}
+}
+}
+
+NetApiBufferFree(pBuffer);
+
+return NERR_Success;
+}
+
+
+INT
+cmdSession(
+_In_ INT argc,
+_In_ WCHAR **argv)
+{
+PWSTR pszComputerName = NULL;
+BOOL bList = FALSE;
+BOOL bDelete = FALSE;
+INT i = 0;
+NET_API_STATUS Status;
+INT result = 0;
+
+for (i = 2; i < argc; i++)
+{
+if (argv[i][0] == L'\\' && argv[i][1] == L'\\' && pszComputerName == 
NULL)
+{
+pszComputerName = argv[i];
+i++;
+}
+else if (_wcsicmp(argv[i], L"/list") == 0)
+{
+bList = TRUE;
+continue;
+}
+else if (_wcsicmp(argv[i], L"/delete") == 0)
+{
+bDelete = TRUE;
+continue;
+}
+else if (_wcsicmp(argv[i], L"/help") == 0)
+{
+PrintMessageString(4381);
+ConPuts(StdOut, L"\n");
+PrintNetMessage(MSG_SESSION_SYNTAX);
+PrintNetMessage(MSG_SESSION_HELP);
+return 0;
+}
+else
+{
+PrintMessageString(4381);
+ConPuts(StdOut, L"\n");
+PrintNetMessage(MSG_SESSION_S

[ros-diffs] [reactos] 01/01: [IPCONFIG] Convert more strings to resources

2023-06-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b0b40ce52074cb2e03ac0028d9cbfd9731442a0e

commit b0b40ce52074cb2e03ac0028d9cbfd9731442a0e
Author: Eric Kohl 
AuthorDate: Thu Jun 22 10:19:01 2023 +0200
Commit: Eric Kohl 
CommitDate: Thu Jun 22 10:19:01 2023 +0200

[IPCONFIG] Convert more strings to resources
---
 base/applications/network/ipconfig/ipconfig.c| 44 +++-
 base/applications/network/ipconfig/lang/bg-BG.rc | 23 +
 base/applications/network/ipconfig/lang/de-DE.rc | 23 +
 base/applications/network/ipconfig/lang/el-GR.rc | 23 +
 base/applications/network/ipconfig/lang/en-US.rc | 23 +
 base/applications/network/ipconfig/lang/es-ES.rc | 23 +
 base/applications/network/ipconfig/lang/fr-FR.rc | 23 +
 base/applications/network/ipconfig/lang/id-ID.rc | 23 +
 base/applications/network/ipconfig/lang/it-IT.rc | 23 +
 base/applications/network/ipconfig/lang/no-NO.rc | 23 +
 base/applications/network/ipconfig/lang/pl-PL.rc | 23 +
 base/applications/network/ipconfig/lang/ro-RO.rc | 23 +
 base/applications/network/ipconfig/lang/ru-RU.rc | 23 +
 base/applications/network/ipconfig/lang/sk-SK.rc | 23 +
 base/applications/network/ipconfig/lang/sq-AL.rc | 23 +
 base/applications/network/ipconfig/lang/sv-SE.rc | 23 +
 base/applications/network/ipconfig/lang/tr-TR.rc | 23 +
 base/applications/network/ipconfig/lang/uk-UA.rc | 23 +
 base/applications/network/ipconfig/lang/zh-CN.rc | 23 +
 base/applications/network/ipconfig/lang/zh-TW.rc | 23 +
 base/applications/network/ipconfig/resource.h| 22 +++-
 21 files changed, 478 insertions(+), 25 deletions(-)

diff --git a/base/applications/network/ipconfig/ipconfig.c 
b/base/applications/network/ipconfig/ipconfig.c
index 7a151f2559f..584ca887e94 100644
--- a/base/applications/network/ipconfig/ipconfig.c
+++ b/base/applications/network/ipconfig/ipconfig.c
@@ -908,6 +908,9 @@ DisplayDnsRecord(
 IN6_ADDR Addr6;
 DNS_STATUS Status;
 
+ConResPrintf(StdOut, IDS_DNSNAME, pszName);
+ConResPrintf(StdOut, IDS_DNSLINE);
+
 pQueryResults = NULL;
 Status = DnsQuery_W(pszName,
 wType,
@@ -919,48 +922,41 @@ DisplayDnsRecord(
 {
 if (Status == DNS_ERROR_RCODE_NAME_ERROR)
 {
-_tprintf(_T("\t%ls\n"), pszName);
-_tprintf(_T("\t\n"));
 _tprintf(_T("\tName does not exist\n\n"));
 }
 else if (Status == DNS_INFO_NO_RECORDS)
 {
-_tprintf(_T("\t%ls\n"), pszName);
-_tprintf(_T("\t\n"));
 _tprintf(_T("\tNo records of type %s\n\n"), 
GetRecordTypeName(wType));
 }
 return;
 }
 
-_tprintf(_T("\t%ls\n"), pszName);
-_tprintf(_T("\t\n"));
-
 pThisRecord = pQueryResults;
 while (pThisRecord != NULL)
 {
 pNextRecord = pThisRecord->pNext;
 
-_tprintf(_T("\tRecord Name . . . . . : %ls\n"), pThisRecord->pName);
-_tprintf(_T("\tRecord Type . . . . . : %hu\n"), pThisRecord->wType);
-_tprintf(_T("\tTime To Live. . . . . : %lu\n"), pThisRecord->dwTtl);
-_tprintf(_T("\tData Length . . . . . : %hu\n"), 
pThisRecord->wDataLength);
+ConResPrintf(StdOut, IDS_DNSRECORDNAME, pThisRecord->pName);
+ConResPrintf(StdOut, IDS_DNSRECORDTYPE, pThisRecord->wType);
+ConResPrintf(StdOut, IDS_DNSRECORDTTL, pThisRecord->dwTtl);
+ConResPrintf(StdOut, IDS_DNSRECORDLENGTH, pThisRecord->wDataLength);
 
 switch (pThisRecord->Flags.S.Section)
 {
 case DnsSectionQuestion:
-_tprintf(_T("\tSection . . . . . . . : Question\n"));
+ConResPrintf(StdOut, IDS_DNSSECTIONQUESTION);
 break;
 
 case DnsSectionAnswer:
-_tprintf(_T("\tSection . . . . . . . : Answer\n"));
+ConResPrintf(StdOut, IDS_DNSSECTIONANSWER);
 break;
 
 case DnsSectionAuthority:
-_tprintf(_T("\tSection . . . . . . . : Authority\n"));
+ConResPrintf(StdOut, IDS_DNSSECTIONAUTHORITY);
 break;
 
 case DnsSectionAdditional:
-_tprintf(_T("\tSection . . . . . . . : Additional\n"));
+ConResPrintf(StdOut, IDS_DNSSECTIONADDITIONAL);
 break;
 }
 
@@ -969,41 +965,41 @@ DisplayDnsRecord(
 case DNS_TYPE_A:
 Addr4.S_un.S_addr = pThisRecord->Data.A.IpAddres

[ros-diffs] [reactos] 01/01: [IPCONFIG] Use conutils and replace hardcoded strings

2023-06-18 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aaa0cb67240655feca095293adc121ee114f6f76

commit aaa0cb67240655feca095293adc121ee114f6f76
Author: Eric Kohl 
AuthorDate: Sat Jun 17 15:23:18 2023 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 17 15:23:18 2023 +0200

[IPCONFIG] Use conutils and replace hardcoded strings
---
 base/applications/network/ipconfig/CMakeLists.txt |   4 +-
 base/applications/network/ipconfig/ipconfig.c | 518 ++
 base/applications/network/ipconfig/lang/bg-BG.rc  |  39 ++
 base/applications/network/ipconfig/lang/de-DE.rc  |  39 ++
 base/applications/network/ipconfig/lang/el-GR.rc  |  39 ++
 base/applications/network/ipconfig/lang/en-US.rc  |  41 +-
 base/applications/network/ipconfig/lang/es-ES.rc  |  38 ++
 base/applications/network/ipconfig/lang/fr-FR.rc  |  39 ++
 base/applications/network/ipconfig/lang/id-ID.rc  |  39 ++
 base/applications/network/ipconfig/lang/it-IT.rc  |  39 ++
 base/applications/network/ipconfig/lang/no-NO.rc  |  39 ++
 base/applications/network/ipconfig/lang/pl-PL.rc  |  39 ++
 base/applications/network/ipconfig/lang/ro-RO.rc  |  39 ++
 base/applications/network/ipconfig/lang/ru-RU.rc  |  39 ++
 base/applications/network/ipconfig/lang/sk-SK.rc  |  39 ++
 base/applications/network/ipconfig/lang/sq-AL.rc  |  39 ++
 base/applications/network/ipconfig/lang/sv-SE.rc  |  39 ++
 base/applications/network/ipconfig/lang/tr-TR.rc  |  39 ++
 base/applications/network/ipconfig/lang/uk-UA.rc  |  39 ++
 base/applications/network/ipconfig/lang/zh-CN.rc  |  39 ++
 base/applications/network/ipconfig/lang/zh-TW.rc  |  39 ++
 base/applications/network/ipconfig/resource.h |  58 ++-
 22 files changed, 1018 insertions(+), 304 deletions(-)

diff --git a/base/applications/network/ipconfig/CMakeLists.txt 
b/base/applications/network/ipconfig/CMakeLists.txt
index f91e1969a28..cd0a65d0c8e 100644
--- a/base/applications/network/ipconfig/CMakeLists.txt
+++ b/base/applications/network/ipconfig/CMakeLists.txt
@@ -1,5 +1,7 @@
+include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/conutils)
 
 add_executable(ipconfig ipconfig.c ipconfig.rc)
-set_module_type(ipconfig win32cui)
+set_module_type(ipconfig win32cui UNICODE)
+target_link_libraries(ipconfig conutils ${PSEH_LIB})
 add_importlibs(ipconfig user32 iphlpapi dnsapi advapi32 msvcrt kernel32 ntdll)
 add_cd_file(TARGET ipconfig DESTINATION reactos/system32 FOR all)
diff --git a/base/applications/network/ipconfig/ipconfig.c 
b/base/applications/network/ipconfig/ipconfig.c
index 8124d8c85d2..3a5702d065d 100644
--- a/base/applications/network/ipconfig/ipconfig.c
+++ b/base/applications/network/ipconfig/ipconfig.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -27,6 +28,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "resource.h"
 
@@ -120,119 +123,12 @@ GetRecordTypeName(WORD wType)
 return szType;
 }
 
-int LoadStringAndOem(HINSTANCE hInst,
- UINT uID,
- LPTSTR szNode,
- int byteSize)
-{
-TCHAR *szTmp;
-int res;
-
-szTmp = (LPTSTR)HeapAlloc(ProcessHeap, 0, byteSize);
-if (szTmp == NULL)
-{
-return 0;
-}
-
-res = LoadString(hInst, uID, szTmp, byteSize);
-CharToOem(szTmp, szNode);
-HeapFree(ProcessHeap, 0, szTmp);
-return res;
-}
-
-LPTSTR GetNodeTypeName(UINT NodeType)
-{
-static TCHAR szNode[14];
-
-switch (NodeType)
-{
-case 1:
-if (!LoadStringAndOem(hInstance, IDS_BCAST, szNode,  
sizeof(szNode)))
-return NULL;
-break;
-
-case 2:
-if (!LoadStringAndOem(hInstance, IDS_P2P, szNode,  sizeof(szNode)))
-return NULL;
-break;
-
-case 4:
-if (!LoadStringAndOem(hInstance, IDS_MIXED, szNode,  
sizeof(szNode)))
-return NULL;
-break;
-
-case 8:
-if (!LoadStringAndOem(hInstance, IDS_HYBRID, szNode,  
sizeof(szNode)))
-return NULL;
-break;
-
-default :
-if (!LoadStringAndOem(hInstance, IDS_UNKNOWN, szNode,  
sizeof(szNode)))
-return NULL;
-break;
-}
-
-return szNode;
-}
-
-
-LPTSTR GetInterfaceTypeName(UINT InterfaceType)
-{
-static TCHAR szIntType[25];
-
-switch (InterfaceType)
-{
-case MIB_IF_TYPE_OTHER:
-if (!LoadStringAndOem(hInstance, IDS_OTHER, szIntType, 
sizeof(szIntType)))
-return NULL;
-break;
-
-case MIB_IF_TYPE_ETHERNET:
-if (!LoadStringAndOem(hInstance, IDS_ETH, szIntType, 
sizeof(szIntType)))
-return NULL;
-break;
-
-case MIB_IF_TYPE_TOKENRING:
-if (!LoadStringAndOem(hInstance, IDS_TOKEN, szIntType, 
sizeof(szIntType)))
-return NULL;
-break;
-
-case MIB_IF_TYPE_FDDI:
-if (!LoadSt

[ros-diffs] [reactos] 01/01: [ADVAPI32][SECLOGON] CreateProcessWithLogonW: Pass the environment to the callee

2023-06-10 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c3db5e9c8e1847562d94eb5bf8adaaac736597ee

commit c3db5e9c8e1847562d94eb5bf8adaaac736597ee
Author: Eric Kohl 
AuthorDate: Sat Jun 10 14:10:14 2023 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 10 14:10:14 2023 +0200

[ADVAPI32][SECLOGON] CreateProcessWithLogonW: Pass the environment to the 
callee
---
 base/services/seclogon/rpcserver.c   |  4 ++-
 dll/win32/advapi32/wine/security.c   | 56 
 sdk/include/reactos/idl/seclogon.idl |  2 ++
 3 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/base/services/seclogon/rpcserver.c 
b/base/services/seclogon/rpcserver.c
index 17671e08801..e728f0a9a00 100644
--- a/base/services/seclogon/rpcserver.c
+++ b/base/services/seclogon/rpcserver.c
@@ -126,11 +126,13 @@ SeclCreateProcessWithLogonW(
 }
 }
 
+/* Initialize the startup information */
 ZeroMemory(, sizeof(StartupInfo));
 StartupInfo.cb = sizeof(StartupInfo);
 
 /* FIXME: Get startup info from the caller */
 
+/* Initialize the process information */
 ZeroMemory(, sizeof(ProcessInfo));
 
 /* Create Process */
@@ -141,7 +143,7 @@ SeclCreateProcessWithLogonW(
   NULL,  // lpThreadAttributes,
   FALSE, // bInheritHandles,
   pRequest->dwCreationFlags,
-  NULL,  // lpEnvironment,
+  pRequest->Environment,  // lpEnvironment,
   pRequest->CurrentDirectory,
   ,
   );
diff --git a/dll/win32/advapi32/wine/security.c 
b/dll/win32/advapi32/wine/security.c
index ce31d7fb474..88f122d6d97 100644
--- a/dll/win32/advapi32/wine/security.c
+++ b/dll/win32/advapi32/wine/security.c
@@ -3472,6 +3472,53 @@ ConvertSidToStringSidA(PSID Sid,
 return TRUE;
 }
 
+
+static
+DWORD
+GetUnicodeEnvironmentSize(
+PVOID pEnvironment)
+{
+INT Length, TotalLength = 0;
+PWCHAR Ptr;
+
+if (pEnvironment == NULL)
+return 0;
+
+Ptr = (PWCHAR)pEnvironment;
+while (*Ptr != UNICODE_NULL)
+{
+Length = wcslen(Ptr) + 1;
+TotalLength += Length;
+Ptr = Ptr + Length;
+}
+
+return (TotalLength + 1) * sizeof(WCHAR);
+}
+
+
+static
+DWORD
+GetAnsiEnvironmentSize(
+PVOID pEnvironment)
+{
+INT Length, TotalLength = 0;
+PCHAR Ptr;
+
+if (pEnvironment == NULL)
+return 0;
+
+Ptr = (PCHAR)pEnvironment;
+while (*Ptr != ANSI_NULL)
+{
+Length = strlen(Ptr) + 1;
+TotalLength += Length;
+Ptr = Ptr + Length;
+}
+
+return TotalLength + 1;
+}
+
+
 /*
  * @unimplemented
  */
@@ -3535,6 +3582,15 @@ CreateProcessWithLogonW(
 Request.CommandLine = (LPWSTR)lpCommandLine;
 Request.CurrentDirectory = (LPWSTR)lpCurrentDirectory;
 
+if (dwCreationFlags & CREATE_UNICODE_ENVIRONMENT)
+Request.dwEnvironmentSize = GetUnicodeEnvironmentSize(lpEnvironment);
+else
+Request.dwEnvironmentSize = GetAnsiEnvironmentSize(lpEnvironment);
+Request.Environment = lpEnvironment;
+
+TRACE("Request.dwEnvironmentSize %lu\n", Request.dwEnvironmentSize);
+TRACE("Request.Environment %p\n", Request.Environment);
+
 Request.dwLogonFlags = dwLogonFlags;
 Request.dwCreationFlags = dwCreationFlags;
 
diff --git a/sdk/include/reactos/idl/seclogon.idl 
b/sdk/include/reactos/idl/seclogon.idl
index d76689463a7..8386f62db9f 100644
--- a/sdk/include/reactos/idl/seclogon.idl
+++ b/sdk/include/reactos/idl/seclogon.idl
@@ -12,6 +12,8 @@ typedef struct _SECL_REQUEST
 [string] WCHAR *ApplicationName;
 [string] WCHAR *CommandLine;
 [string] WCHAR *CurrentDirectory;
+[size_is(dwEnvironmentSize)] BYTE *Environment;
+DWORD dwEnvironmentSize;
 DWORD dwLogonFlags;
 DWORD dwCreationFlags;
 DWORD dwProcessId;


[ros-diffs] [reactos] 01/01: [UMPNPMGR] Replace some magic values

2023-05-29 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2626c724e93ec33f5aa71f2d01d3dc2391d13740

commit 2626c724e93ec33f5aa71f2d01d3dc2391d13740
Author: Eric Kohl 
AuthorDate: Mon May 29 11:58:09 2023 +0200
Commit: Eric Kohl 
CommitDate: Mon May 29 11:58:09 2023 +0200

[UMPNPMGR] Replace some magic values
---
 base/services/umpnpmgr/rpcserver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 5625b4c3262..4ec7c55ff45 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -644,7 +644,7 @@ PNP_GetVersion(
 DPRINT("PNP_GetVersion(%p %p)\n",
hBinding, pVersion);
 
-*pVersion = 0x0400;
+*pVersion = CONFIGMG_VERSION;
 
 return CR_SUCCESS;
 }
@@ -4879,7 +4879,7 @@ PNP_GetVersionInternal(
 {
 UNREFERENCED_PARAMETER(hBinding);
 
-*pwVersion = 0x501;
+*pwVersion = WINVER;
 return CR_SUCCESS;
 }
 


[ros-diffs] [reactos] 01/01: [UMPNPMGR] Check ulFlags in PNP_GetGlobalState

2023-05-29 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=024daea0af58e61138b60e4b73ba004a3ae58378

commit 024daea0af58e61138b60e4b73ba004a3ae58378
Author: Eric Kohl 
AuthorDate: Mon May 29 09:54:31 2023 +0200
Commit: Eric Kohl 
CommitDate: Mon May 29 09:54:31 2023 +0200

[UMPNPMGR] Check ulFlags in PNP_GetGlobalState

Return CR_INVALID_FLAG if ulFlags is not zero.
---
 base/services/umpnpmgr/rpcserver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 304b291dc5e..5625b4c3262 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -659,11 +659,13 @@ PNP_GetGlobalState(
 DWORD ulFlags)
 {
 UNREFERENCED_PARAMETER(hBinding);
-UNREFERENCED_PARAMETER(ulFlags);
 
 DPRINT("PNP_GetGlobalState(%p %p 0x%08lx)\n",
hBinding, pulState, ulFlags);
 
+if (ulFlags != 0)
+return CR_INVALID_FLAG;
+
 *pulState = CM_GLOBAL_STATE_CAN_DO_UI | CM_GLOBAL_STATE_SERVICES_AVAILABLE;
 
 return CR_SUCCESS;


[ros-diffs] [reactos] 01/01: [UMPNPMGR] Check for interactive caller in PNP_ReportLogOn

2023-05-29 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=13e6cbcafa09a4eb42cf8bc52e13b6b343833b0f

commit 13e6cbcafa09a4eb42cf8bc52e13b6b343833b0f
Author: Eric Kohl 
AuthorDate: Mon May 29 09:38:31 2023 +0200
Commit: Eric Kohl 
CommitDate: Mon May 29 09:38:31 2023 +0200

[UMPNPMGR] Check for interactive caller in PNP_ReportLogOn

Do not run device install when a non-interactive user logs on.
---
 base/services/umpnpmgr/rpcserver.c | 55 +-
 1 file changed, 54 insertions(+), 1 deletion(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index f3dcd0817cc..304b291dc5e 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -549,6 +549,56 @@ GetConfigurationData(
 }
 
 
+static
+BOOL
+IsCallerInteractive(
+_In_ handle_t hBinding)
+{
+SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
+HANDLE hToken;
+PSID pInteractiveSid = NULL;
+BOOL bInteractive = FALSE;
+RPC_STATUS RpcStatus;
+
+DPRINT("IsCallerInteractive(%p)\n", hBinding);
+
+/* Allocate an interactive user sid */
+if (!AllocateAndInitializeSid(,
+  1,
+  SECURITY_INTERACTIVE_RID,
+  0, 0, 0, 0, 0, 0, 0,
+  ))
+{
+DPRINT1("AllocateAndInitializeSid failed\n");
+return FALSE;
+}
+
+/* Impersonate the client */
+RpcStatus = RpcImpersonateClient(hBinding);
+if (RpcStatus != RPC_S_OK)
+{
+DPRINT1("RpcImpersonateClient failed (Status 0x%08lx)\n", RpcStatus);
+goto done;
+}
+
+/* Open the thread token and check for interactive user membership */
+if (OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, ))
+{
+CheckTokenMembership(hToken, pInteractiveSid, );
+CloseHandle(hToken);
+}
+
+/* Revert the impersonation */
+RpcRevertToSelf();
+
+done:
+if (pInteractiveSid)
+FreeSid(pInteractiveSid);
+
+return bInteractive;
+}
+
+
 VOID
 __RPC_USER
 PNP_NOTIFY_HANDLE_rundown(
@@ -646,12 +696,15 @@ PNP_ReportLogOn(
 DWORD ReturnValue = CR_FAILURE;
 HANDLE hProcess;
 
-UNREFERENCED_PARAMETER(hBinding);
 UNREFERENCED_PARAMETER(Admin);
 
 DPRINT("PNP_ReportLogOn(%p %u, %u)\n",
hBinding, Admin, ProcessId);
 
+/* Fail, if the caller is not an interactive user */
+if (!IsCallerInteractive(hBinding))
+goto cleanup;
+
 /* Get the users token */
 hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, ProcessId);
 


[ros-diffs] [reactos] 01/01: [RPCRT4] Set binding handle for server functions

2023-05-28 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e54b32b434ca7704c63709e8c45128e0fc170fcb

commit e54b32b434ca7704c63709e8c45128e0fc170fcb
Author: Eric Kohl 
AuthorDate: Sun May 28 21:04:01 2023 +0200
Commit: Eric Kohl 
CommitDate: Sun May 28 21:04:01 2023 +0200

[RPCRT4] Set binding handle for server functions

This enables us to impersonate server functions using RpcImpersonateClient.
---
 dll/win32/rpcrt4/ndr_stubless.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/dll/win32/rpcrt4/ndr_stubless.c b/dll/win32/rpcrt4/ndr_stubless.c
index 47d03b13564..c84d8977c10 100644
--- a/dll/win32/rpcrt4/ndr_stubless.c
+++ b/dll/win32/rpcrt4/ndr_stubless.c
@@ -1330,6 +1330,7 @@ LONG WINAPI NdrStubCall2(
 LONG_PTR *retval_ptr = NULL;
 /* correlation cache */
 ULONG_PTR NdrCorrCache[256];
+unsigned short BindingHandleOffset = (USHORT)-1;
 
 TRACE("pThis %p, pChannel %p, pRpcMsg %p, pdwStubPhase %p\n", pThis, 
pChannel, pRpcMsg, pdwStubPhase);
 
@@ -1367,12 +1368,15 @@ LONG WINAPI NdrStubCall2(
 switch (*pFormat) /* handle_type */
 {
 case FC_BIND_PRIMITIVE: /* explicit primitive */
+BindingHandleOffset = ((NDR_EHD_PRIMITIVE*)pFormat)->offset;
 pFormat += sizeof(NDR_EHD_PRIMITIVE);
 break;
 case FC_BIND_GENERIC: /* explicit generic */
+BindingHandleOffset = ((NDR_EHD_GENERIC*)pFormat)->offset;
 pFormat += sizeof(NDR_EHD_GENERIC);
 break;
 case FC_BIND_CONTEXT: /* explicit context */
+BindingHandleOffset = ((NDR_EHD_CONTEXT*)pFormat)->offset;
 pFormat += sizeof(NDR_EHD_CONTEXT);
 break;
 default:
@@ -1421,6 +1425,10 @@ LONG WINAPI NdrStubCall2(
 if (pThis)
 *(void **)args = ((CStdStubBuffer *)pThis)->pvServerObject;
 
+/* add the binding handle to the stack if we are using explicit binding 
handles */
+if (BindingHandleOffset != (USHORT)-1)
+*(RPC_BINDING_HANDLE*)&(args[BindingHandleOffset]) = pRpcMsg->Handle;
+
 if (is_oicf_stubdesc(pStubDesc))
 {
 const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader = (const 
NDR_PROC_PARTIAL_OIF_HEADER *)pFormat;


[ros-diffs] [reactos] 01/01: [RPCRT4_WINETEST] Remove obsolete todo_wine

2022-12-19 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=28088ab25da735ce57dd9feeb5eab56ab5e8a01b

commit 28088ab25da735ce57dd9feeb5eab56ab5e8a01b
Author: Eric Kohl 
AuthorDate: Mon Dec 19 17:58:02 2022 +0100
Commit: Eric Kohl 
CommitDate: Mon Dec 19 17:58:02 2022 +0100

[RPCRT4_WINETEST] Remove obsolete todo_wine

Addendum to 00ccbd2f
---
 modules/rostests/winetests/rpcrt4/rpc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/modules/rostests/winetests/rpcrt4/rpc.c 
b/modules/rostests/winetests/rpcrt4/rpc.c
index dcf7a2d9608..32cd77bdafc 100644
--- a/modules/rostests/winetests/rpcrt4/rpc.c
+++ b/modules/rostests/winetests/rpcrt4/rpc.c
@@ -634,14 +634,11 @@ static void test_RpcStringBindingParseA(void)
 
 /* test with invalid binding */
 status = RpcStringBindingParseA(invalid_binding, , , 
_addr, , );
-todo_wine
 ok(status == RPC_S_INVALID_STRING_BINDING, "RpcStringBindingParseA should 
have returned RPC_S_INVALID_STRING_BINDING instead of %d\n", status);
-todo_wine
 ok(uuid == NULL, "uuid was %p instead of NULL\n", uuid);
 if (uuid)
 RpcStringFreeA();
 ok(protseq == NULL, "protseq was %p instead of NULL\n", protseq);
-todo_wine
 ok(network_addr == NULL, "network_addr was %p instead of NULL\n", 
network_addr);
 if (network_addr)
 RpcStringFreeA(_addr);


[ros-diffs] [reactos] 01/01: [RPCRT4] RpcStringBindingParseA/W must fail, if a colon is missing in the string binding

2022-12-19 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=00ccbd2f39f93a88d5a8a9e02a757be29b8d3fb3

commit 00ccbd2f39f93a88d5a8a9e02a757be29b8d3fb3
Author: Eric Kohl 
AuthorDate: Mon Dec 19 16:13:58 2022 +0100
Commit: Eric Kohl 
CommitDate: Mon Dec 19 16:13:58 2022 +0100

[RPCRT4] RpcStringBindingParseA/W must fail, if a colon is missing in the 
string binding

This fixes a bug in the rpc winetest.
This patch will be sent upstream.
---
 dll/win32/rpcrt4/rpc_binding.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/dll/win32/rpcrt4/rpc_binding.c b/dll/win32/rpcrt4/rpc_binding.c
index 640e17673c6..80278b98570 100644
--- a/dll/win32/rpcrt4/rpc_binding.c
+++ b/dll/win32/rpcrt4/rpc_binding.c
@@ -601,6 +601,8 @@ RPC_STATUS WINAPI RpcStringBindingParseA( RPC_CSTR 
StringBinding, RPC_CSTR *ObjU
   if (next) {
 if (Protseq) *Protseq = unescape_string_binding_component(data, next - 
data);
 data = next+1;
+  } else {
+goto fail;
   }
 
   next = string_binding_find_delimiter(data, '[');
@@ -711,6 +713,8 @@ RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR 
StringBinding, RPC_WSTR *ObjU
   if (next) {
 if (Protseq) *Protseq = unescape_string_binding_componentW(data, next - 
data);
 data = next+1;
+  } else {
+goto fail;
   }
 
   next = string_binding_find_delimiterW(data, '[');


[ros-diffs] [reactos] 01/01: [RPCRT4] Call WSAStartup in rpcrt4_ip_tcp_get_top_of_tower

2022-12-19 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d01de6dc8b892027f3d284973af8c8eca41c65f9

commit d01de6dc8b892027f3d284973af8c8eca41c65f9
Author: Eric Kohl 
AuthorDate: Mon Dec 19 13:39:52 2022 +0100
Commit: Eric Kohl 
CommitDate: Mon Dec 19 13:39:52 2022 +0100

[RPCRT4] Call WSAStartup in rpcrt4_ip_tcp_get_top_of_tower

This fixes the crash in the rpc winetest.
---
 dll/win32/rpcrt4/rpc_transport.c | 12 
 dll/win32/rpcrt4/rpcrt4_ros.diff | 19 +++
 2 files changed, 31 insertions(+)

diff --git a/dll/win32/rpcrt4/rpc_transport.c b/dll/win32/rpcrt4/rpc_transport.c
index be0d052bef3..9edc2ee718d 100644
--- a/dll/win32/rpcrt4/rpc_transport.c
+++ b/dll/win32/rpcrt4/rpc_transport.c
@@ -1257,6 +1257,18 @@ static size_t rpcrt4_ip_tcp_get_top_of_tower(unsigned 
char *tower_data,
 hints.ai_canonname  = NULL;
 hints.ai_next   = NULL;
 
+#ifdef __REACTOS__
+static BOOL wsa_inited;
+if (!wsa_inited)
+{
+WSADATA wsadata;
+WSAStartup(MAKEWORD(2, 2), );
+/* Note: WSAStartup can be called more than once so we don't bother 
with
+ * making accesses to wsa_inited thread-safe */
+wsa_inited = TRUE;
+}
+#endif
+
 ret = getaddrinfo(networkaddr, endpoint, , );
 if (ret)
 {
diff --git a/dll/win32/rpcrt4/rpcrt4_ros.diff b/dll/win32/rpcrt4/rpcrt4_ros.diff
index 83aaa1ec610..ff46dad36aa 100644
--- a/dll/win32/rpcrt4/rpcrt4_ros.diff
+++ b/dll/win32/rpcrt4/rpcrt4_ros.diff
@@ -257,3 +257,22 @@ diff -pudN e:\wine\dlls\rpcrt4/rpc_transport.c 
e:\reactos\dll\win32\rpcrt4/rpc_t
  break;
  }
  }
+@@ -1257,6 +1257,18 @@ static size_t rpcrt4_ip_tcp_get_top_of_tower(unsigned 
char *tower_data,
+ hints.ai_canonname  = NULL;
+ hints.ai_next   = NULL;
+ 
++#ifdef __REACTOS__
++static BOOL wsa_inited;
++if (!wsa_inited)
++{
++WSADATA wsadata;
++WSAStartup(MAKEWORD(2, 2), );
++/* Note: WSAStartup can be called more than once so we don't bother 
with
++ * making accesses to wsa_inited thread-safe */
++wsa_inited = TRUE;
++}
++#endif
++
+ ret = getaddrinfo(networkaddr, endpoint, , );
+ if (ret)
+ {


[ros-diffs] [reactos] 01/01: [RPCRT4] RpcStringFreeA/W must set the pointer to NULL

2022-12-19 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2a783979ff660f5267c3c2020b8ff06bf9ab0341

commit 2a783979ff660f5267c3c2020b8ff06bf9ab0341
Author: Eric Kohl 
AuthorDate: Mon Dec 19 09:18:22 2022 +0100
Commit: Eric Kohl 
CommitDate: Mon Dec 19 09:18:48 2022 +0100

[RPCRT4] RpcStringFreeA/W must set the pointer to NULL

Add a matching wine test.

This change will be sent upstream.
---
 dll/win32/rpcrt4/rpcrt4_main.c  |  2 ++
 modules/rostests/winetests/rpcrt4/rpc.c | 17 +
 2 files changed, 19 insertions(+)

diff --git a/dll/win32/rpcrt4/rpcrt4_main.c b/dll/win32/rpcrt4/rpcrt4_main.c
index 67a3dbe595f..7cc8d0b06b2 100644
--- a/dll/win32/rpcrt4/rpcrt4_main.c
+++ b/dll/win32/rpcrt4/rpcrt4_main.c
@@ -158,6 +158,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, 
LPVOID lpvReserved)
 RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR* String)
 {
   HeapFree( GetProcessHeap(), 0, *String);
+  if (String) *String = NULL;
 
   return RPC_S_OK;
 }
@@ -174,6 +175,7 @@ RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR* String)
 RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR* String)
 {
   HeapFree( GetProcessHeap(), 0, *String);
+  if (String) *String = NULL;
 
   return RPC_S_OK;
 }
diff --git a/modules/rostests/winetests/rpcrt4/rpc.c 
b/modules/rostests/winetests/rpcrt4/rpc.c
index d3a3aee6c8c..dcf7a2d9608 100644
--- a/modules/rostests/winetests/rpcrt4/rpc.c
+++ b/modules/rostests/winetests/rpcrt4/rpc.c
@@ -854,6 +854,22 @@ static void test_RpcBindingFree(void)
status);
 }
 
+static void test_RpcStringFree(void)
+{
+RPC_WSTR string = NULL;
+
+string = HeapAlloc(GetProcessHeap(), 0, 10*sizeof(WCHAR));
+if (string == NULL)
+{
+skip("Failed to allocate a string!\n");
+return;
+}
+
+RpcStringFreeW();
+
+ok(string == NULL, "String is %p expected NULL!\n", string);
+}
+
 static void test_RpcServerInqDefaultPrincName(void)
 {
 RPC_STATUS ret;
@@ -1204,6 +1220,7 @@ START_TEST( rpc )
 test_UuidCreate();
 test_UuidCreateSequential();
 test_RpcBindingFree();
+test_RpcStringFree();
 test_RpcServerInqDefaultPrincName();
 test_RpcServerRegisterAuthInfo();
 


[ros-diffs] [reactos] 01/01: [NTOS:IO] Replace an outdated E-Mail Address

2022-12-16 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5ff50741dd19bef13d9af63eec8d005ec835ca32

commit 5ff50741dd19bef13d9af63eec8d005ec835ca32
Author: Eric Kohl 
AuthorDate: Fri Dec 16 10:34:51 2022 +0100
Commit: Eric Kohl 
CommitDate: Fri Dec 16 10:34:51 2022 +0100

[NTOS:IO] Replace an outdated E-Mail Address

The old Address will be gone soon.
---
 ntoskrnl/io/pnpmgr/plugplay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c
index c35aa58fd5f..192612c66a2 100644
--- a/ntoskrnl/io/pnpmgr/plugplay.c
+++ b/ntoskrnl/io/pnpmgr/plugplay.c
@@ -3,7 +3,7 @@
  * COPYRIGHT:   GPL - See COPYING in the top level directory
  * FILE:ntoskrnl/io/pnpmgr/plugplay.c
  * PURPOSE: Plug-and-play interface routines
- * PROGRAMMERS: Eric Kohl 
+ * PROGRAMMERS: Eric Kohl 
  */
 
 /* INCLUDES */


[ros-diffs] [reactos] 01/01: [SECLOGON][ADVAPI] CreateProcessWithLogonW: Return process information to the caller

2022-07-23 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=23ecbb3ed5f1b2881e28e54cccec16586e8241fb

commit 23ecbb3ed5f1b2881e28e54cccec16586e8241fb
Author: Eric Kohl 
AuthorDate: Sun Jul 24 01:08:13 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jul 24 01:08:13 2022 +0200

[SECLOGON][ADVAPI] CreateProcessWithLogonW: Return process information to 
the caller
---
 base/services/seclogon/rpcserver.c   | 40 ++--
 dll/win32/advapi32/wine/security.c   | 21 ++-
 sdk/include/reactos/idl/seclogon.idl |  7 ++-
 3 files changed, 60 insertions(+), 8 deletions(-)

diff --git a/base/services/seclogon/rpcserver.c 
b/base/services/seclogon/rpcserver.c
index 9c8f85e7c97..17671e08801 100644
--- a/base/services/seclogon/rpcserver.c
+++ b/base/services/seclogon/rpcserver.c
@@ -64,6 +64,7 @@ SeclCreateProcessWithLogonW(
 
 PROFILEINFOW ProfileInfo;
 HANDLE hToken = NULL;
+HANDLE hTargetProcessHandle = NULL;
 
 ULONG dwError = ERROR_SUCCESS;
 BOOL rc;
@@ -80,6 +81,17 @@ SeclCreateProcessWithLogonW(
 TRACE("CurrentDirectory: '%S'\n", pRequest->CurrentDirectory);
 TRACE("LogonFlags: 0x%lx\n", pRequest->dwLogonFlags);
 TRACE("CreationFlags: 0x%lx\n", pRequest->dwCreationFlags);
+TRACE("ProcessId: %lu\n", pRequest->dwProcessId);
+}
+
+hTargetProcessHandle = OpenProcess(PROCESS_DUP_HANDLE,
+   FALSE,
+   pRequest->dwProcessId);
+if (hTargetProcessHandle == NULL)
+{
+dwError = GetLastError();
+WARN("OpenProcess() failed with Error %lu\n", dwError);
+goto done;
 }
 
 ZeroMemory(, sizeof(ProfileInfo));
@@ -140,9 +152,33 @@ SeclCreateProcessWithLogonW(
 goto done;
 }
 
-/* FIXME: Pass process info to the caller */
+/* Return process info to the caller */
+if (pResponse != NULL)
+{
+DuplicateHandle(GetCurrentProcess(),
+ProcessInfo.hProcess,
+hTargetProcessHandle,
+(PHANDLE)>hProcess,
+0,
+FALSE,
+DUPLICATE_SAME_ACCESS);
+
+DuplicateHandle(GetCurrentProcess(),
+ProcessInfo.hThread,
+hTargetProcessHandle,
+(PHANDLE)>hThread,
+0,
+FALSE,
+DUPLICATE_SAME_ACCESS);
+
+pResponse->dwProcessId = ProcessInfo.dwProcessId;
+pResponse->dwThreadId = ProcessInfo.dwThreadId;
+}
 
 done:
+if (hTargetProcessHandle)
+CloseHandle(hTargetProcessHandle);
+
 if (ProcessInfo.hThread)
 CloseHandle(ProcessInfo.hThread);
 
@@ -156,5 +192,5 @@ done:
 CloseHandle(hToken);
 
 if (pResponse != NULL)
-pResponse->ulError = dwError;
+pResponse->dwError = dwError;
 }
diff --git a/dll/win32/advapi32/wine/security.c 
b/dll/win32/advapi32/wine/security.c
index 4b20be2b14c..ce31d7fb474 100644
--- a/dll/win32/advapi32/wine/security.c
+++ b/dll/win32/advapi32/wine/security.c
@@ -3538,7 +3538,14 @@ CreateProcessWithLogonW(
 Request.dwLogonFlags = dwLogonFlags;
 Request.dwCreationFlags = dwCreationFlags;
 
-Response.ulError = ERROR_SUCCESS;
+Request.dwProcessId = GetCurrentProcessId();
+TRACE("Request.dwProcessId %lu\n", Request.dwProcessId);
+
+Response.hProcess = 0;
+Response.hThread = 0;
+Response.dwProcessId = 0;
+Response.dwThreadId = 0;
+Response.dwError = ERROR_SUCCESS;
 
 RpcTryExcept
 {
@@ -3561,13 +3568,17 @@ CreateProcessWithLogonW(
 hBinding = NULL;
 }
 
-TRACE("Response.ulError %lu\n", Response.ulError);
-if (Response.ulError != ERROR_SUCCESS)
-SetLastError(Response.ulError);
+TRACE("Response.hProcess %p\n", Response.hProcess);
+TRACE("Response.hThread %p\n", Response.hThread);
+TRACE("Response.dwProcessId %lu\n", Response.dwProcessId);
+TRACE("Response.dwThreadId %lu\n", Response.dwThreadId);
+TRACE("Response.dwError %lu\n", Response.dwError);
+if (Response.dwError != ERROR_SUCCESS)
+SetLastError(Response.dwError);
 
 TRACE("CreateProcessWithLogonW() done\n");
 
-return (Response.ulError == ERROR_SUCCESS);
+return (Response.dwError == ERROR_SUCCESS);
 }
 
 BOOL WINAPI CreateProcessWithTokenW(HANDLE token, DWORD logon_flags, LPCWSTR 
application_name, LPWSTR command_line,
diff --git a/sdk/include/reactos/idl/seclogon.idl 
b/sdk/include/reactos/idl/seclogon.idl
index c605176e16f..d76689463a7 100644
--- a/sdk/include/reactos/idl/seclogon.idl
+++ b/sdk/include/reactos/idl/seclogon.idl
@@ -14,11 +14,16 @@ typedef struct _SECL_REQUEST
 [string] WCHAR *CurrentDire

[ros-diffs] [reactos] 01/01: [DISKPART] Fix magic values in CreateLogicalPartition() and CreatePrimaryPartition()

2022-07-03 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=57c84dd658c4d5a91e8b3081c8ababf5ac7f3ead

commit 57c84dd658c4d5a91e8b3081c8ababf5ac7f3ead
Author: Eric Kohl 
AuthorDate: Sun Jul 3 14:09:35 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jul 3 14:10:02 2022 +0200

[DISKPART] Fix magic values in CreateLogicalPartition() and 
CreatePrimaryPartition()
---
 base/system/diskpart/create.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/base/system/diskpart/create.c b/base/system/diskpart/create.c
index 52526573d85..6526f19d9f3 100644
--- a/base/system/diskpart/create.c
+++ b/base/system/diskpart/create.c
@@ -204,7 +204,7 @@ CreateLogicalPartition(
 ULONGLONG ullOffset = 0ULL;
 BOOL bNoErr = FALSE;
 #endif
-UCHAR PartitionType = 6;
+UCHAR PartitionType = PARTITION_HUGE;
 INT i, length;
 PWSTR pszSuffix = NULL;
 NTSTATUS Status;
@@ -404,7 +404,7 @@ CreatePrimaryPartition(
 ULONGLONG ullOffset = 0ULL;
 BOOL bNoErr = FALSE;
 #endif
-UCHAR PartitionType = 6;
+UCHAR PartitionType = PARTITION_HUGE;
 INT i, length;
 PWSTR pszSuffix = NULL;
 NTSTATUS Status;



[ros-diffs] [reactos] 01/01: [DISKPART] Support quoted command options in script files

2022-06-25 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d4a398fb13ccca1d1a3db735b7e0bf466f991788

commit d4a398fb13ccca1d1a3db735b7e0bf466f991788
Author: Eric Kohl 
AuthorDate: Sat Jun 25 15:20:40 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 25 15:20:40 2022 +0200

[DISKPART] Support quoted command options in script files
---
 base/system/diskpart/interpreter.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/base/system/diskpart/interpreter.c 
b/base/system/diskpart/interpreter.c
index 7ba17480605..bc18f9f2402 100644
--- a/base/system/diskpart/interpreter.c
+++ b/base/system/diskpart/interpreter.c
@@ -185,21 +185,26 @@ InterpretScript(LPWSTR input_line)
 LPWSTR args_vector[MAX_ARGS_COUNT];
 INT args_count = 0;
 BOOL bWhiteSpace = TRUE;
+BOOL bQuote = FALSE;
 LPWSTR ptr;
 
 memset(args_vector, 0, sizeof(args_vector));
 
+bQuote = FALSE;
 ptr = input_line;
 while (*ptr != 0)
 {
-if (iswspace(*ptr) || *ptr == L'\n')
+if (*ptr == L'"')
+bQuote = !bQuote;
+
+if ((iswspace(*ptr) && (bQuote == FALSE))|| *ptr == L'\n')
 {
 *ptr = 0;
 bWhiteSpace = TRUE;
 }
 else
 {
-if ((bWhiteSpace != FALSE) && (args_count < MAX_ARGS_COUNT))
+if ((bWhiteSpace != FALSE) && (bQuote == FALSE) && (args_count < 
MAX_ARGS_COUNT))
 {
 args_vector[args_count] = ptr;
 args_count++;



[ros-diffs] [reactos] 01/01: [DISKPART] Print proper file system information for the FILESYSTEMS command

2022-06-19 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f79ec61bdc43d8017ba408aa817543bc65328c6c

commit f79ec61bdc43d8017ba408aa817543bc65328c6c
Author: Eric Kohl 
AuthorDate: Sun Jun 19 15:40:08 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jun 19 16:12:10 2022 +0200

[DISKPART] Print proper file system information for the FILESYSTEMS command
---
 base/system/diskpart/diskpart.h|   1 +
 base/system/diskpart/filesystems.c | 113 +++--
 base/system/diskpart/lang/de-DE.rc |   3 +-
 base/system/diskpart/lang/en-US.rc |   3 +-
 base/system/diskpart/lang/pl-PL.rc |   3 +-
 base/system/diskpart/lang/pt-PT.rc |   3 +-
 base/system/diskpart/lang/ro-RO.rc |   3 +-
 base/system/diskpart/lang/ru-RU.rc |   3 +-
 base/system/diskpart/lang/sq-AL.rc |   3 +-
 base/system/diskpart/lang/tr-TR.rc |   3 +-
 base/system/diskpart/lang/zh-CN.rc |   3 +-
 base/system/diskpart/lang/zh-TW.rc |   3 +-
 base/system/diskpart/partlist.c|   9 ++-
 base/system/diskpart/resource.h|   1 +
 14 files changed, 133 insertions(+), 21 deletions(-)

diff --git a/base/system/diskpart/diskpart.h b/base/system/diskpart/diskpart.h
index aa0e557e4e3..fbfb978f537 100644
--- a/base/system/diskpart/diskpart.h
+++ b/base/system/diskpart/diskpart.h
@@ -190,6 +190,7 @@ typedef struct _VOLENTRY
 
 ULONG VolumeNumber;
 WCHAR VolumeName[MAX_PATH];
+WCHAR DeviceName[MAX_PATH];
 
 WCHAR DriveLetter;
 
diff --git a/base/system/diskpart/filesystems.c 
b/base/system/diskpart/filesystems.c
index 9257068746a..2a416693b4b 100644
--- a/base/system/diskpart/filesystems.c
+++ b/base/system/diskpart/filesystems.c
@@ -11,6 +11,104 @@
 #define NDEBUG
 #include 
 
+static
+BOOL
+GetFileSystemInfo(
+PVOLENTRY VolumeEntry)
+{
+WCHAR VolumeNameBuffer[MAX_PATH];
+UNICODE_STRING VolumeName;
+HANDLE VolumeHandle;
+OBJECT_ATTRIBUTES ObjectAttributes;
+IO_STATUS_BLOCK IoStatusBlock;
+ULONG ulSize, ulClusterSize = 0;
+FILE_FS_FULL_SIZE_INFORMATION SizeInfo;
+FILE_FS_FULL_SIZE_INFORMATION FullSizeInfo;
+PFILE_FS_ATTRIBUTE_INFORMATION pAttributeInfo = NULL;
+NTSTATUS Status;
+
+wcscpy(VolumeNameBuffer, VolumeEntry->DeviceName);
+wcscat(VolumeNameBuffer, L"\\");
+
+RtlInitUnicodeString(, VolumeNameBuffer);
+
+InitializeObjectAttributes(,
+   ,
+   0,
+   NULL,
+   NULL);
+
+Status = NtOpenFile(,
+SYNCHRONIZE,
+,
+,
+0,
+FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | 
FILE_OPEN_FOR_BACKUP_INTENT);
+if (!NT_SUCCESS(Status))
+{
+if (Status == STATUS_NO_MEDIA_IN_DEVICE)
+{
+ConResPuts(StdOut, IDS_ERROR_NO_MEDIUM);
+return FALSE;
+}
+else if (Status == STATUS_UNRECOGNIZED_VOLUME)
+{
+ConResPuts(StdOut, IDS_FILESYSTEMS_CURRENT);
+ConPuts(StdOut, L"\n");
+ConResPrintf(StdOut, IDS_FILESYSTEMS_TYPE, L"RAW");
+ConResPrintf(StdOut, IDS_FILESYSTEMS_CLUSTERSIZE, 512);
+}
+
+return TRUE;
+}
+
+ulSize = sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 255 * sizeof(WCHAR);
+pAttributeInfo = RtlAllocateHeap(RtlGetProcessHeap(),
+ HEAP_ZERO_MEMORY,
+ ulSize);
+
+Status = NtQueryVolumeInformationFile(VolumeHandle,
+  ,
+  pAttributeInfo,
+  ulSize,
+  FileFsAttributeInformation);
+
+Status = NtQueryVolumeInformationFile(VolumeHandle,
+  ,
+  ,
+  
sizeof(FILE_FS_FULL_SIZE_INFORMATION),
+  FileFsFullSizeInformation);
+if (NT_SUCCESS(Status))
+{
+ulClusterSize  = FullSizeInfo.BytesPerSector * 
FullSizeInfo.SectorsPerAllocationUnit;
+}
+else
+{
+Status = NtQueryVolumeInformationFile(VolumeHandle,
+  ,
+  ,
+  sizeof(FILE_FS_SIZE_INFORMATION),
+  FileFsSizeInformation);
+if (NT_SUCCESS(Status))
+{
+ulClusterSize  = SizeInfo.BytesPerSector * 
SizeInfo.SectorsPerAllocationUnit;
+}
+}
+
+
+ConResPuts(StdOut, IDS_FILESYSTEMS_CURRENT);
+ConPuts(StdOut, L"\n");
+
+ConResPrintf(StdOut, IDS_FILESYSTEMS_TYPE, pAttributeInfo->FileSystemName);
+ConResPrintf(StdOut, IDS_FILESYSTEMS_CLUSTERSIZE, ulClusterSize);
+

[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the FORMAT command

2022-06-19 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4a66cbb224804317cb4bea32c10838f43a820a70

commit 4a66cbb224804317cb4bea32c10838f43a820a70
Author: Eric Kohl 
AuthorDate: Sun Jun 19 08:28:53 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jun 19 08:28:53 2022 +0200

[DISKPART] Add help text for the FORMAT command
---
 base/system/diskpart/diskpart_msg.mc | 667 ++-
 1 file changed, 648 insertions(+), 19 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 07c71702791..45282e2de7d 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -3723,34 +3723,663 @@ SymbolicName=MSG_COMMAND_FORMAT
 Severity=Informational
 Facility=System
 Language=English
-
+Formats the specified volume for use with ReactOS.
+
+Syntax:  FORMAT [[FS=] [REVISION=] | RECOMMENDED] [LABEL=<"label">]
+[UNIT=] [QUICK] [COMPRESS] [OVERRIDE] [DUPLICATE] [NOWAIT]
+[NOERR]
+
+FS= Specifies the type of file system. If no file system is given,
+the default file system displayed by the FILESYSTEMS command is
+used.
+
+REVISION=
+
+Specifies the file system revision (if applicable).
+
+RECOMMENDED If specified, use the recommended file system and revision
+instead of the default if a recommendation exists. The
+recommended file system (if one exists) is displayed by the
+FILESYSTEMS command.
+
+LABEL=<"label">
+
+Specifies the volume label.
+
+UNIT=Overrides the default allocation unit size. Default settings
+are strongly recommended for general use. The default
+allocation unit size for a particular file system is displayed
+by the FILESYSTEMS command.
+
+NTFS compression is not supported for allocation unit sizes
+above 4096.
+
+QUICK   Performs a quick format.
+
+COMPRESSNTFS only: Files created on the new volume will be compressed
+by default.
+
+OVERRIDEForces the file system to dismount first if necessary. All
+opened handles to the volume would no longer be valid.
+
+DUPLICATE   UDF Only: This flag applies to UDF format, version 2.5 or
+higher.
+This flag instructs the format operation to duplicate the file
+system meta-data to a second set of sectors on the disk. The
+duplicate meta-data is used by applications, for example repair
+or recovery applications. If the primary meta-data sectors are
+found to be corrupted, the file system meta-data will be read
+from the duplicate sectors.
+
+NOWAIT  Forces the command to return immediately while the format
+process is still in progress. If NOWAIT is not specified,
+DiskPart will display format progress in percentage.
+
+NOERR   For scripting only. When an error is encountered, DiskPart
+continues to process commands as if the error did not occur.
+Without the NOERR parameter, an error causes DiskPart to exit
+with an error code.
+
+A volume must be selected for this operation to succeed.
+
+Examples:
+
+FORMAT FS=NTFS LABEL="New Volume" QUICK COMPRESS
+FORMAT RECOMMENDED OVERRIDE
 .
 Language=German
-
+Formatiert das angegebene Volume für die Verwendung mit ReactOS.
+
+Syntax:  FORMAT [[FS=] [REVISION=] | RECOMMENDED] [LABEL=<"label">]
+[UNIT=] [QUICK] [COMPRESS] [OVERRIDE] [DUPLICATE] [NOWAIT]
+[NOERR]
+
+FS= Gibt den Typ des Dateisystems an. Falls kein Dateisystem
+angegeben wurde, wird das durch den Befehl
+"FILESYSTEMS" angezeigte Standarddateisystem
+verwendet.
+
+REVISION=
+
+Gibt die Dateisystemversion an (sofern zutreffend).
+
+RECOMMENDED Sofern angegeben, werden anstelle der Standardein-
+stellung das empfohlene Dateisystem und die Version verwendet,
+falls eine Empfehlung vorhanden ist. Das empfohlene Dateisystem
+(sofern vorhanden) wird durch den Befehl "FILESYSTEMS"
+angezeigt.
+
+LABEL=<"label">
+Gibt die Volumebezeichnung an.
+
+UNIT=Überschreibt die standardmäßige Größe der
+Zuteilungseinheit. Für die allgemeine Verwendung
+werden dringend die Standardeinstellungen
+empfohlen.
+Die standardmäßige Größe der Zuteilungseinheit
+für ein bestimmtes Dateisystem wird durch den
+Befehl "FILESYSTEMS" angezeigt.

[ros-diffs] [reactos] 01/01: [DISKPART] Support quoted options in commands

2022-06-18 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3ca37d6eafc76ad1b675ffb99b7b7f2efe4e2569

commit 3ca37d6eafc76ad1b675ffb99b7b7f2efe4e2569
Author: Eric Kohl 
AuthorDate: Sat Jun 18 13:27:56 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 18 13:27:56 2022 +0200

[DISKPART] Support quoted options in commands
---
 base/system/diskpart/diskpart.h|  8 +
 base/system/diskpart/interpreter.c |  9 +++--
 base/system/diskpart/misc.c| 68 ++
 3 files changed, 83 insertions(+), 2 deletions(-)

diff --git a/base/system/diskpart/diskpart.h b/base/system/diskpart/diskpart.h
index 99f468f9916..aa0e557e4e3 100644
--- a/base/system/diskpart/diskpart.h
+++ b/base/system/diskpart/diskpart.h
@@ -394,6 +394,14 @@ RoundingDivide(
 _In_ ULONGLONG Dividend,
 _In_ ULONGLONG Divisor);
 
+PWSTR
+DuplicateQuotedString(
+_In_ PWSTR pszInString);
+
+PWSTR
+DuplicateString(
+_In_ PWSTR pszInString);
+
 /* offline.c */
 BOOL offline_main(INT argc, LPWSTR *argv);
 
diff --git a/base/system/diskpart/interpreter.c 
b/base/system/diskpart/interpreter.c
index 34fdd034d68..7ba17480605 100644
--- a/base/system/diskpart/interpreter.c
+++ b/base/system/diskpart/interpreter.c
@@ -229,6 +229,7 @@ InterpretMain(VOID)
 LPWSTR args_vector[MAX_ARGS_COUNT];
 INT args_count = 0;
 BOOL bWhiteSpace = TRUE;
+BOOL bQuote = FALSE;
 BOOL bRun = TRUE;
 LPWSTR ptr;
 
@@ -243,17 +244,21 @@ InterpretMain(VOID)
 /* Get input from the user. */
 fgetws(input_line, MAX_STRING_SIZE, stdin);
 
+bQuote = FALSE;
 ptr = input_line;
 while (*ptr != 0)
 {
-if (iswspace(*ptr) || *ptr == L'\n')
+if (*ptr == L'"')
+bQuote = !bQuote;
+
+if ((iswspace(*ptr) && (bQuote == FALSE))|| *ptr == L'\n')
 {
 *ptr = 0;
 bWhiteSpace = TRUE;
 }
 else
 {
-if ((bWhiteSpace != FALSE) && (args_count < MAX_ARGS_COUNT))
+if ((bWhiteSpace != FALSE) && (bQuote == FALSE) && (args_count 
< MAX_ARGS_COUNT))
 {
 args_vector[args_count] = ptr;
 args_count++;
diff --git a/base/system/diskpart/misc.c b/base/system/diskpart/misc.c
index b46651b670b..a4819d4751b 100644
--- a/base/system/diskpart/misc.c
+++ b/base/system/diskpart/misc.c
@@ -78,3 +78,71 @@ RoundingDivide(
 {
 return (Dividend + Divisor / 2) / Divisor;
 }
+
+
+PWSTR
+DuplicateQuotedString(
+_In_ PWSTR pszInString)
+{
+PWSTR pszOutString = NULL;
+PWSTR pStart, pEnd;
+INT nLength;
+
+if ((pszInString == NULL) || (pszInString[0] == UNICODE_NULL))
+return NULL;
+
+if (pszInString[0] == L'"')
+{
+if (pszInString[1] == UNICODE_NULL)
+return NULL;
+
+pStart = [1];
+pEnd = wcschr(pStart, '"');
+if (pEnd == NULL)
+{
+nLength = wcslen(pStart);
+}
+else
+{
+nLength = (pEnd - pStart);
+}
+}
+else
+{
+pStart = pszInString;
+nLength = wcslen(pStart);
+}
+
+pszOutString = RtlAllocateHeap(RtlGetProcessHeap(),
+   HEAP_ZERO_MEMORY,
+   (nLength + 1) * sizeof(WCHAR));
+if (pszOutString == NULL)
+return NULL;
+
+wcsncpy(pszOutString, pStart, nLength);
+
+return pszOutString;
+}
+
+
+PWSTR
+DuplicateString(
+_In_ PWSTR pszInString)
+{
+PWSTR pszOutString = NULL;
+INT nLength;
+
+if ((pszInString == NULL) || (pszInString[0] == UNICODE_NULL))
+return NULL;
+
+nLength = wcslen(pszInString);
+pszOutString = RtlAllocateHeap(RtlGetProcessHeap(),
+   HEAP_ZERO_MEMORY,
+   (nLength + 1) * sizeof(WCHAR));
+if (pszOutString == NULL)
+return NULL;
+
+wcscpy(pszOutString, pszInString);
+
+return pszOutString;
+}



[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the CREATE PARTITION EXTENDED command

2022-06-18 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4a305266e629bf4b536d7e2fa2293f9fa092d899

commit 4a305266e629bf4b536d7e2fa2293f9fa092d899
Author: Eric Kohl 
AuthorDate: Sat Jun 18 10:15:04 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 18 10:15:04 2022 +0200

[DISKPART] Add help text for the CREATE PARTITION EXTENDED command
---
 base/system/diskpart/diskpart_msg.mc | 367 ++-
 1 file changed, 357 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 90ae664d91e..07c71702791 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -818,34 +818,381 @@ SymbolicName=MSG_COMMAND_CREATE_PARTITION_EXTENDED
 Severity=Informational
 Facility=System
 Language=English
-
+Creates an extended partition on the disk with focus.
+Applies to master boot record (MBR) disks only.
+
+Syntax:  CREATE PARTITION EXTENDED [SIZE=] [OFFSET=] [ALIGN=] [NOERR]
+
+SIZE=The size of the partition in megabytes (MB). If no size is
+given, the partition continues until there is no more free
+space in the extended partition.
+
+OFFSET=  The offset, in kilobytes (KB), at which the partition is
+created. If no offset is given, the partition will start
+at the beginning of the first free space on the disk that
+is large enough to hold the new partition.
+
+ALIGN=   Typically used with hardware RAID Logical Unit Number (LUN)
+arrays to improve performance. The partition offset will be
+a multiple of . If the OFFSET parameter is specified, it
+will be rounded to the closest multiple of .
+
+NOERR   For scripting only. When an error is encountered, DiskPart
+continues to process commands as if the error did not occur.
+Without the NOERR parameter, an error causes DiskPart to exit
+with an error code.
+
+After the partition has been created, the focus automatically shifts to the
+new partition. Only one extended partition can be created per disk. This
+command fails if you attempt to create an extended partition within another
+extended partition. You must create an extended partition before you can
+create logical partitions.
+
+A basic MBR disk must be selected for this operation to succeed.
+
+Example:
+
+CREATE PARTITION EXTENDED SIZE=1000
 .
 Language=German
-
+Erstellt eine erweiterte Partition auf dem Datenträger, der den Fokus
+besitzt.
+Gilt nur für MBR-Datenträger (Master Boot Record).
+
+Syntax:  CREATE PARTITION EXTENDED [SIZE=] [OFFSET=] [ALIGN=] [NOERR]
+
+SIZE=Die Größe der Partition in MB. Falls keine Größe angegeben
+ist, wird die Partition erweitert, bis auf der erweiterten
+Partition kein freier Speicherplatz mehr vorhanden ist.
+
+OFFSET=  Das Offset, in Kilobyte (KB), in dem die Partition
+erstellt wird. Wird kein Offset angegeben, beginnt die
+Partition am Anfang des ersten freien Speicherplatz auf dem
+Datenträger, der eine ausreichende Größe für die neue Partition
+besitzt.
+
+ALIGN=   Wird normalerweise bei Hardware-RAID-Arrays mit logischen
+Gerätenummern (LUN) zur Verbesserung der Leistung verwendet. 
Das
+Offset der Partition ist ein Vielfaches von . Bei Angabe des
+Parameters OFFSET wird dieser auf das nächste Vielfache von 
+gerundet.
+
+NOERR   Nur für Skripting. Bei einem Fehler setzt DiskPart die
+Verarbeitung von Befehlen fort, als sei der Fehler nicht
+aufgetreten.
+Ohne den Parameter NOERR wird DiskPart bei einem Fehler mit
+dem entsprechenden Fehlercode beendet.
+
+Nachdem die Partition erstellt wurde, wird der Fokus automatisch auf die
+neue Partition gesetzt. Auf jedem Datenträger kann jeweils nur eine
+erw. Partition erstellt werden. Dieser Befehl kann nicht ausgeführt
+werden, wenn versucht wird, eine erweiterte Partition innerhalb einer
+anderen erweiterten Partition zu erstellen. Sie müssen zuerst eine
+erweiterte Partition erstellen, bevor logische Partitionen erstellt werden
+können.
+
+Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss ein
+MBR-Basisdatenträger ausgewählt werden.
+
+Beispiel:
+
+CREATE PARTITION EXTENDED SIZE=1000
 .
 Language=Polish
-
+Creates an extended partition on the disk with focus.
+Applies to master boot record (MBR) disks only.
+
+Syntax:  CREATE PARTITION EXTENDED [SIZE=] [OFFSET=] [ALIGN=] [NOERR]
+
+SIZE=The size of the partition in megabytes (MB). If no size is
+given, the partition continues until there is no more free

[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the CREATE PARTITION LOGICAL command

2022-06-17 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cba4ffbb5dd2b2840a2dc36dfdc5e6e9cecdda56

commit cba4ffbb5dd2b2840a2dc36dfdc5e6e9cecdda56
Author: Eric Kohl 
AuthorDate: Sat Jun 18 01:05:27 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 18 01:05:27 2022 +0200

[DISKPART] Add help text for the CREATE PARTITION LOGICAL command
---
 base/system/diskpart/diskpart_msg.mc | 354 ++-
 1 file changed, 344 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 1eef367c970..90ae664d91e 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -854,34 +854,368 @@ SymbolicName=MSG_COMMAND_CREATE_PARTITION_LOGICAL
 Severity=Informational
 Facility=System
 Language=English
-
+Creates a logical partition in an extended partition.
+Applies to master boot record (MBR) disks only.
+
+Syntax:  CREATE PARTITION LOGICAL [SIZE=] [OFFSET=] [ALIGN=] [NOERR]
+
+SIZE=The size of the partition in megabytes (MB). The partition is
+at least as big in bytes as the number specified by N. If you
+specify a size for the logical partition, it must be smaller
+than the extended partition. If no size is given, the partition
+continues until there is no more free space in the extended
+partition.
+
+OFFSET=  The offset, in kilobytes (KB), at which the partition is 
created.
+If no offset is given, the partition is placed in the first 
disk
+extent that is large enough to hold it.
+
+ALIGN=   Typically used with hardware RAID Logical Unit Number (LUN)
+arrays to improve performance. The partition offset will be
+a multiple of . If the OFFSET parameter is specified, it
+will be rounded to the closest multiple of .
+
+NOERR   For scripting only. When an error is encountered, DiskPart
+continues to process commands as if the error did not occur.
+Without the NOERR parameter, an error causes DiskPart to exit
+with an error code.
+
+After the partition has been created, the focus automatically shifts to the
+new logical partition.
+
+A basic MBR disk must be selected for this operation to succeed.
+
+Example:
+
+CREATE PARTITION LOGICAL SIZE=1000
 .
 Language=German
-
+Erstellt eine logische Partition in einer erweiterten Partition.
+Gilt nur für MBR-Datenträger (Master Boot Record).
+
+Syntax:  CREATE PARTITION LOGICAL [SIZE=] [OFFSET=] [ALIGN=] [NOERR]
+
+SIZE=Die Größe der Partition in MB. Die Länge der Partition in MB.
+Die Länge der Partition in Byte entspricht mindestens dem durch
+N angegebenen Wert. Wenn Sie eine Größe für die logische
+Partition angeben, muss diese kleiner sein als die erweiterte
+Partition. Falls keine Größe angegeben ist, wird die Partition
+erweitert, bis sie den gesamten freien Speicherplatz im
+Bereich umfasst.
+
+OFFSET=  Das Offset, in Kilobyte (KB), an dem die Partition erstellt
+wird. Falls kein Offset angegeben ist, wird die Partition im
+ersten Datenträgerbereich erstellt, der eine ausreichende Größe
+für die Partition hat.
+
+ALIGN=   Wird normalerweise bei Hardware-RAID-Arrays mit logischen
+Gerätenummern (LUN) zur Verbesserung der Leistung verwendet. 
Das
+Offset der Partition ist ein Vielfaches von . Bei Angabe des
+Parameters OFFSET wird dieser auf das nächste Vielfache von 
+gerundet.
+
+NOERR   Nur für Skripting. Bei einem Fehler setzt DiskPart die
+Verarbeitung von Befehlen fort, als sei der Fehler nicht
+aufgetreten. Ohne den Parameter NOERR wird DiskPart bei einem
+Fehler mit dem entsprechenden Fehlercode beendet.
+
+Nachdem die Partition erstellt wurde, wird der Fokus automatisch auf die
+neue logische Partition gesetzt.
+
+Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss ein
+MBR-Basisdatenträger ausgewählt sein.
+
+Beispiel:
+
+CREATE PARTITION LOGICAL SIZE=1000
 .
 Language=Polish
-
+Creates a logical partition in an extended partition.
+Applies to master boot record (MBR) disks only.
+
+Syntax:  CREATE PARTITION LOGICAL [SIZE=] [OFFSET=] [ALIGN=] [NOERR]
+
+SIZE=The size of the partition in megabytes (MB). The partition is
+at least as big in bytes as the number specified by N. If you
+specify a size for the logical partition, it must be smaller
+than the extended partition. If no size is given, the partition
+continues until there is no more free space in the extended

[ros-diffs] [reactos] 01/01: [DISKPART] Implement the clean command

2022-06-16 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2be7af18fe4a5517da843c3e9da52296d7e44f1d

commit 2be7af18fe4a5517da843c3e9da52296d7e44f1d
Author: Eric Kohl 
AuthorDate: Fri Jun 17 01:37:26 2022 +0200
Commit: Eric Kohl 
CommitDate: Fri Jun 17 01:37:26 2022 +0200

[DISKPART] Implement the clean command
---
 base/system/diskpart/clean.c   | 236 -
 base/system/diskpart/diskpart.h|  12 +-
 base/system/diskpart/lang/de-DE.rc |   7 ++
 base/system/diskpart/lang/en-US.rc |   7 ++
 base/system/diskpart/lang/pl-PL.rc |   7 ++
 base/system/diskpart/lang/pt-PT.rc |   7 ++
 base/system/diskpart/lang/ro-RO.rc |   7 ++
 base/system/diskpart/lang/ru-RU.rc |   7 ++
 base/system/diskpart/lang/sq-AL.rc |   7 ++
 base/system/diskpart/lang/tr-TR.rc |   7 ++
 base/system/diskpart/lang/zh-CN.rc |   7 ++
 base/system/diskpart/lang/zh-TW.rc |   7 ++
 base/system/diskpart/partlist.c|  78 ++--
 base/system/diskpart/resource.h|   4 +
 14 files changed, 390 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/clean.c b/base/system/diskpart/clean.c
index 145e7131b90..cd8014a5d91 100644
--- a/base/system/diskpart/clean.c
+++ b/base/system/diskpart/clean.c
@@ -8,7 +8,241 @@
 
 #include "diskpart.h"
 
-BOOL clean_main(INT argc, LPWSTR *argv)
+#define NDEBUG
+#include 
+
+
+BOOL
+clean_main(
+_In_ INT argc,
+_In_ PWSTR *argv)
 {
+PLIST_ENTRY Entry;
+PPARTENTRY PartEntry;
+PVOLENTRY VolumeEntry;
+BOOL bAll = FALSE;
+PUCHAR SectorsBuffer = NULL;
+ULONG LayoutBufferSize, Size;
+INT i;
+WCHAR Buffer[MAX_PATH];
+UNICODE_STRING Name;
+OBJECT_ATTRIBUTES ObjectAttributes;
+IO_STATUS_BLOCK IoStatusBlock;
+HANDLE FileHandle = NULL;
+LARGE_INTEGER Offset, Count, MaxCount;
+NTSTATUS Status;
+
+DPRINT("Clean()\n");
+
+if (CurrentDisk == NULL)
+{
+ConResPuts(StdOut, IDS_SELECT_NO_DISK);
+return TRUE;
+}
+
+/* Do not allow to clean the boot disk */
+if ((CurrentDisk->BiosFound == TRUE) &&
+(CurrentDisk->BiosDiskNumber == 0))
+{
+ConResPuts(StdOut, IDS_CLEAN_SYSTEM);
+return TRUE;
+}
+
+for (i = 1; i < argc; i++)
+{
+if (_wcsicmp(argv[1], L"all") == 0)
+{
+bAll = TRUE;
+}
+}
+
+/* Dismount and remove all logical partitions */
+while (!IsListEmpty(>LogicalPartListHead))
+{
+Entry = RemoveHeadList(>LogicalPartListHead);
+PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
+
+/* Dismount the logical partition */
+if (PartEntry->PartitionType != 0)
+{
+DismountVolume(PartEntry);
+VolumeEntry = GetVolumeFromPartition(PartEntry);
+if (VolumeEntry)
+RemoveVolume(VolumeEntry);
+}
+
+/* Delete it */
+RtlFreeHeap(RtlGetProcessHeap(), 0, PartEntry);
+}
+
+/* Dismount and remove all primary partitions */
+while (!IsListEmpty(>PrimaryPartListHead))
+{
+Entry = RemoveHeadList(>PrimaryPartListHead);
+PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
+
+/* Dismount the primary partition */
+if ((PartEntry->PartitionType != 0) &&
+(IsContainerPartition(PartEntry->PartitionType) == FALSE))
+{
+DismountVolume(PartEntry);
+VolumeEntry = GetVolumeFromPartition(PartEntry);
+if (VolumeEntry)
+RemoveVolume(VolumeEntry);
+}
+
+/* Delete it */
+RtlFreeHeap(RtlGetProcessHeap(), 0, PartEntry);
+}
+
+/* Initialize the disk entry */
+CurrentDisk->ExtendedPartition = NULL;
+CurrentDisk->Dirty = FALSE;
+CurrentDisk->NewDisk = TRUE;
+CurrentDisk->NoMbr = TRUE;
+
+/* Wipe the layout buffer */
+RtlFreeHeap(RtlGetProcessHeap(), 0, CurrentDisk->LayoutBuffer);
+
+LayoutBufferSize = sizeof(DRIVE_LAYOUT_INFORMATION) +
+   ((4 - ANYSIZE_ARRAY) * sizeof(PARTITION_INFORMATION));
+CurrentDisk->LayoutBuffer = RtlAllocateHeap(RtlGetProcessHeap(),
+HEAP_ZERO_MEMORY,
+LayoutBufferSize);
+if (CurrentDisk->LayoutBuffer == NULL)
+{
+DPRINT1("Failed to allocate the disk layout buffer!\n");
+return TRUE;
+}
+
+/* Allocate a 1MB sectors buffer */
+SectorsBuffer = RtlAllocateHeap(RtlGetProcessHeap(),
+HEAP_ZERO_MEMORY,
+1024 * 1024);
+if (SectorsBuffer == NULL)
+{
+DPRINT1("Failed to allocate the sectors buffer!\n");
+goto done;
+}
+
+/* Open the disk for writing */
+StringCchPrintfW(Buffer, ARRAYSIZE(Buffer),
+ L&qu

[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the CREATE PARTITION PRIMARY command

2022-06-16 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=74870c1ae10fb51a0202b4c38e0e61f959d50354

commit 74870c1ae10fb51a0202b4c38e0e61f959d50354
Author: Eric Kohl 
AuthorDate: Thu Jun 16 15:20:46 2022 +0200
Commit: Eric Kohl 
CommitDate: Thu Jun 16 15:20:46 2022 +0200

[DISKPART] Add help text for the CREATE PARTITION PRIMARY command
---
 base/system/diskpart/diskpart_msg.mc | 1061 +-
 1 file changed, 1050 insertions(+), 11 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 89a56eb1978..1eef367c970 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -926,34 +926,1073 @@ SymbolicName=MSG_COMMAND_CREATE_PARTITION_PRIMARY
 Severity=Informational
 Facility=System
 Language=English
-
+Creates a primary partition on the basic disk with focus.
+
+Syntax:  CREATE PARTITION PRIMARY [SIZE=] [OFFSET=] [ID={ | 
}]
+[ALIGN=] [NOERR]
+
+SIZE=The size of the partition in megabytes (MB). If no size is
+given, the partition continues until there is no more
+unallocated space in the current region.
+
+OFFSET=  The offset, in kilobytes (KB), at which the partition is 
created.
+If no offset is given, the partition is placed in the first 
disk
+extent that is large enough to hold it.
+
+ID={ | }
+
+Specifies the partition type.
+
+Intended for Original Equipment Manufacturer (OEM) use only.
+
+For master boot record (MBR) disks, you can specify a partition
+type byte, in hexadecimal form, for the partition. If this
+parameter is not specified for an MBR disk, the command creates
+a partition of type 0x06 (specifies no file system is 
installed).
+
+LDM data partition:
+0x42
+
+Recovery partition:
+0x27
+
+Recognized OEM Ids:
+0x12
+0x84
+0xDE
+0xFE
+0xA0
+
+For GUID partition table (GPT) disks you can specify a
+partition type GUID for the partition you want to create.
+Recognized GUIDs include:
+
+EFI System partition:
+c12a7328-f81f-11d2-ba4b-00a0c93ec93b
+
+Microsoft Reserved partition:
+e3c9e316-0b5c-4db8-817d-f92df00215ae
+
+Basic data partition:
+ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
+
+LDM Metadata partition on a dynamic disk:
+5808c8aa-7e8f-42e0-85d2-e1e90434cfb3
+
+LDM Data partition on a dynamic disk:
+af9b60a0-1431-4f62-bc68-3311714a69ad
+
+Recovery partition:
+de94bba4-06d1-4d40-a16a-bfd50179d6ac
+
+If this parameter is not specified for a GPT disk, the command
+creates a basic data partition.
+
+Any partition type byte or GUID can be specified with this
+parameter. DiskPart does not check the partition type for
+validity except to ensure that it is a byte in hexadecimal form
+or a GUID.
+
+Caution:
+
+Creating partitions with this parameter might cause your
+computer to fail or be unable to start up. Unless you are
+an OEM or an IT professional experienced with GPT disks, do
+not create partitions on GPT disks using this parameter.
+Instead, always use the CREATE PARTITION EFI command to
+create EFI System partitions, the CREATE PARTITION MSR
+command to create Microsoft Reserved partitions, and the
+CREATE PARTITION PRIMARY command without this parameter to
+create primary partitions on GPT disks.
+
+ALIGN=   Typically used with hardware RAID Logical Unit Number (LUN)
+arrays to improve performance. The partition offset will be
+a multiple of . If the OFFSET parameter is specified, it
+will be rounded to the closest multiple of .
+
+NOERR   For scripting only. When an error is encountered, DiskPart
+continues to process commands as if the error did not occur.
+Without the NOERR parameter, an error causes DiskPart to exit
+with an error code.
+
+After you create the partition, the focus automatically shifts to the new
+partition. The partition does not receive a drive letter. You must use the
+assign command to assign a drive letter

[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the REM command

2022-06-16 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=966d674de139f97aab74ec005494fe5826ee6a1a

commit 966d674de139f97aab74ec005494fe5826ee6a1a
Author: Eric Kohl 
AuthorDate: Thu Jun 16 11:55:39 2022 +0200
Commit: Eric Kohl 
CommitDate: Thu Jun 16 11:55:39 2022 +0200

[DISKPART] Add help text for the REM command
---
 base/system/diskpart/diskpart_msg.mc | 180 +--
 1 file changed, 170 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 1b36c14ac7d..89a56eb1978 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -3210,34 +3210,194 @@ SymbolicName=MSG_COMMAND_REM
 Severity=Informational
 Facility=System
 Language=English
-
+Provides a way to add comments to a script.
+
+Syntax:  REM
+
+Example:
+
+In this example script, REM is used to provide a comment about what the
+script does.
+
+REM These commands set up 3 drives.
+CREATE PARTITION PRIMARY SIZE=2048
+ASSIGN d:
+CREATE PARTITION EXTEND
+CREATE PARTITION LOGICAL SIZE=2048
+ASSIGN e:
+CREATE PARTITION LOGICAL
+ASSIGN f:
 .
 Language=German
-
+Bietet eine M\xF6glichkeit, einem Skript Kommentare hinzuzufügen.
+
+Syntax:  REM
+
+Beispiel:
+
+In diesem Beispielskript wird mit REM ein Kommentar eingeleitet, mit
+dem die Funktion des Skripts erläutert wird.
+
+REM Mit diesen Befehlen werden drei Laufwerke eingerichtet.
+CREATE PARITION PRIMARY SIZE=2048
+ASSIGN d:
+CREATE PARTITION EXTEND
+CREATE PARTITION LOGICAL SIZE=2048
+ASSIGN e:
+CREATE PARTITION LOGICAL
+ASSIGN f:
 .
 Language=Polish
-
+Provides a way to add comments to a script.
+
+Syntax:  REM
+
+Example:
+
+In this example script, REM is used to provide a comment about what the
+script does.
+
+REM These commands set up 3 drives.
+CREATE PARTITION PRIMARY SIZE=2048
+ASSIGN d:
+CREATE PARTITION EXTEND
+CREATE PARTITION LOGICAL SIZE=2048
+ASSIGN e:
+CREATE PARTITION LOGICAL
+ASSIGN f:
 .
 Language=Portugese
-
+Provides a way to add comments to a script.
+
+Syntax:  REM
+
+Example:
+
+In this example script, REM is used to provide a comment about what the
+script does.
+
+REM These commands set up 3 drives.
+CREATE PARTITION PRIMARY SIZE=2048
+ASSIGN d:
+CREATE PARTITION EXTEND
+CREATE PARTITION LOGICAL SIZE=2048
+ASSIGN e:
+CREATE PARTITION LOGICAL
+ASSIGN f:
 .
 Language=Romanian
-
+Provides a way to add comments to a script.
+
+Syntax:  REM
+
+Example:
+
+In this example script, REM is used to provide a comment about what the
+script does.
+
+REM These commands set up 3 drives.
+CREATE PARTITION PRIMARY SIZE=2048
+ASSIGN d:
+CREATE PARTITION EXTEND
+CREATE PARTITION LOGICAL SIZE=2048
+ASSIGN e:
+CREATE PARTITION LOGICAL
+ASSIGN f:
 .
 Language=Russian
-
+Provides a way to add comments to a script.
+
+Syntax:  REM
+
+Example:
+
+In this example script, REM is used to provide a comment about what the
+script does.
+
+REM These commands set up 3 drives.
+CREATE PARTITION PRIMARY SIZE=2048
+ASSIGN d:
+CREATE PARTITION EXTEND
+CREATE PARTITION LOGICAL SIZE=2048
+ASSIGN e:
+CREATE PARTITION LOGICAL
+ASSIGN f:
 .
 Language=Albanian
-
+Provides a way to add comments to a script.
+
+Syntax:  REM
+
+Example:
+
+In this example script, REM is used to provide a comment about what the
+script does.
+
+REM These commands set up 3 drives.
+CREATE PARTITION PRIMARY SIZE=2048
+ASSIGN d:
+CREATE PARTITION EXTEND
+CREATE PARTITION LOGICAL SIZE=2048
+ASSIGN e:
+CREATE PARTITION LOGICAL
+ASSIGN f:
 .
 Language=Turkish
-
+Provides a way to add comments to a script.
+
+Syntax:  REM
+
+Example:
+
+In this example script, REM is used to provide a comment about what the
+script does.
+
+REM These commands set up 3 drives.
+CREATE PARTITION PRIMARY SIZE=2048
+ASSIGN d:
+CREATE PARTITION EXTEND
+CREATE PARTITION LOGICAL SIZE=2048
+ASSIGN e:
+CREATE PARTITION LOGICAL
+ASSIGN f:
 .
 Language=Chinese
-
+Provides a way to add comments to a script.
+
+Syntax:  REM
+
+Example:
+
+In this example script, REM is used to provide a comment about what the
+script does.
+
+REM These commands set up 3 drives.
+CREATE PARTITION PRIMARY SIZE=2048
+ASSIGN d:
+CREATE PARTITION EXTEND
+CREATE PARTITION LOGICAL SIZE=2048
+ASSIGN e:
+CREATE PARTITION LOGICAL
+ASSIGN f:
 .
 Language=Taiwanese
-
+Provides a way to add comments to a script.
+
+Syntax:  REM
+
+Example:
+
+In this example script, REM is used to provide a comment about what the
+script does.
+
+REM These commands set up 3 drives.
+CREATE PARTITION PRIMARY SIZE=2048
+ASSIGN d:
+CREATE PARTITION EXTEND

[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the DETAIL VOLUME command

2022-06-16 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=82a2c5903e4f60e018fd0612bfcbc8b03e2d9f53

commit 82a2c5903e4f60e018fd0612bfcbc8b03e2d9f53
Author: Eric Kohl 
AuthorDate: Thu Jun 16 10:50:40 2022 +0200
Commit: Eric Kohl 
CommitDate: Thu Jun 16 10:50:40 2022 +0200

[DISKPART] Add help text for the DETAIL VOLUME command
---
 base/system/diskpart/diskpart_msg.mc | 111 +++
 1 file changed, 101 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 99c7baef616..1b36c14ac7d 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -1544,34 +1544,125 @@ SymbolicName=MSG_COMMAND_DETAIL_VOLUME
 Severity=Informational
 Facility=System
 Language=English
-
+Displays the properties for the selected volume and the list of disks on
+which the volume resides.
+
+Syntax:  DETAIL VOLUME
+
+A volume must be selected for this operation to succeed.
+
+Example:
+
+DETAIL VOLUME
 .
 Language=German
-
+Zeigt die Eigenschaften für das ausgewählte Volume und die Liste der
+Datenträger, die sich auf dem Volume befinden, an.
+
+Syntax:  DETAIL VOLUME
+
+Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss ein Volume
+ausgewählt sein.
+
+Beispiel:
+
+DETAIL VOLUME
 .
 Language=Polish
-
+Displays the properties for the selected volume and the list of disks on
+which the volume resides.
+
+Syntax:  DETAIL VOLUME
+
+A volume must be selected for this operation to succeed.
+
+Example:
+
+DETAIL VOLUME
 .
 Language=Portugese
-
+Displays the properties for the selected volume and the list of disks on
+which the volume resides.
+
+Syntax:  DETAIL VOLUME
+
+A volume must be selected for this operation to succeed.
+
+Example:
+
+DETAIL VOLUME
 .
 Language=Romanian
-
+Displays the properties for the selected volume and the list of disks on
+which the volume resides.
+
+Syntax:  DETAIL VOLUME
+
+A volume must be selected for this operation to succeed.
+
+Example:
+
+DETAIL VOLUME
 .
 Language=Russian
-
+Displays the properties for the selected volume and the list of disks on
+which the volume resides.
+
+Syntax:  DETAIL VOLUME
+
+A volume must be selected for this operation to succeed.
+
+Example:
+
+DETAIL VOLUME
 .
 Language=Albanian
-
+Displays the properties for the selected volume and the list of disks on
+which the volume resides.
+
+Syntax:  DETAIL VOLUME
+
+A volume must be selected for this operation to succeed.
+
+Example:
+
+DETAIL VOLUME
 .
 Language=Turkish
-
+Displays the properties for the selected volume and the list of disks on
+which the volume resides.
+
+Syntax:  DETAIL VOLUME
+
+A volume must be selected for this operation to succeed.
+
+Example:
+
+DETAIL VOLUME
 .
 Language=Chinese
-
+Displays the properties for the selected volume and the list of disks on
+which the volume resides.
+
+Syntax:  DETAIL VOLUME
+
+A volume must be selected for this operation to succeed.
+
+Example:
+
+DETAIL VOLUME
 .
 Language=Taiwanese
-
+Displays the properties for the selected volume and the list of disks on
+which the volume resides.
+
+Syntax:  DETAIL VOLUME
+
+A volume must be selected for this operation to succeed.
+
+Example:
+
+DETAIL VOLUME
 .
 
 



[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the DETAIL PARTITION command

2022-06-15 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9b10dcba15067cd3292d414ac3c0a7423211e533

commit 9b10dcba15067cd3292d414ac3c0a7423211e533
Author: Eric Kohl 
AuthorDate: Thu Jun 16 00:33:10 2022 +0200
Commit: Eric Kohl 
CommitDate: Thu Jun 16 00:33:10 2022 +0200

[DISKPART] Add help text for the DETAIL PARTITION command
---
 base/system/diskpart/diskpart_msg.mc | 101 +++
 1 file changed, 91 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 095d6e71231..99c7baef616 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -1428,34 +1428,115 @@ SymbolicName=MSG_COMMAND_DETAIL_PARTITION
 Severity=Informational
 Facility=System
 Language=English
-
+Displays the properties for the selected partition.
+
+Syntax:  DETAIL PARTITION
+
+A partition must be selected for this operation to succeed.
+
+Example:
+
+DETAIL PARTITION
 .
 Language=German
-
+Zeigt die Eigenschaften für die ausgewählte Partition an.
+
+Syntax:  DETAIL PARTITION
+
+Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss eine
+Partition ausgewählt sein.
+
+Beispiel:
+
+DETAIL PARTITION
 .
 Language=Polish
-
+Displays the properties for the selected partition.
+
+Syntax:  DETAIL PARTITION
+
+A partition must be selected for this operation to succeed.
+
+Example:
+
+DETAIL PARTITION
 .
 Language=Portugese
-
+Displays the properties for the selected partition.
+
+Syntax:  DETAIL PARTITION
+
+A partition must be selected for this operation to succeed.
+
+Example:
+
+DETAIL PARTITION
 .
 Language=Romanian
-
+Displays the properties for the selected partition.
+
+Syntax:  DETAIL PARTITION
+
+A partition must be selected for this operation to succeed.
+
+Example:
+
+DETAIL PARTITION
 .
 Language=Russian
-
+Displays the properties for the selected partition.
+
+Syntax:  DETAIL PARTITION
+
+A partition must be selected for this operation to succeed.
+
+Example:
+
+DETAIL PARTITION
 .
 Language=Albanian
-
+Displays the properties for the selected partition.
+
+Syntax:  DETAIL PARTITION
+
+A partition must be selected for this operation to succeed.
+
+Example:
+
+DETAIL PARTITION
 .
 Language=Turkish
-
+Displays the properties for the selected partition.
+
+Syntax:  DETAIL PARTITION
+
+A partition must be selected for this operation to succeed.
+
+Example:
+
+DETAIL PARTITION
 .
 Language=Chinese
-
+Displays the properties for the selected partition.
+
+Syntax:  DETAIL PARTITION
+
+A partition must be selected for this operation to succeed.
+
+Example:
+
+DETAIL PARTITION
 .
 Language=Taiwanese
-
+Displays the properties for the selected partition.
+
+Syntax:  DETAIL PARTITION
+
+A partition must be selected for this operation to succeed.
+
+Example:
+
+DETAIL PARTITION
 .
 
 MessageId=10021



[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the HELP command

2022-06-14 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=66f6c1ab880a449d87dca0272d65c994949014bd

commit 66f6c1ab880a449d87dca0272d65c994949014bd
Author: Eric Kohl 
AuthorDate: Tue Jun 14 19:43:38 2022 +0200
Commit: Eric Kohl 
CommitDate: Tue Jun 14 19:43:38 2022 +0200

[DISKPART] Add help text for the HELP command
---
 base/system/diskpart/diskpart_msg.mc | 142 ---
 1 file changed, 132 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 1727205d9e9..095d6e71231 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -1903,34 +1903,156 @@ SymbolicName=MSG_COMMAND_HELP
 Severity=Informational
 Facility=System
 Language=English
-
+Displays a list of the available commands or detailed help information for 
a
+specified command.
+
+Syntax:  HELP []
+
+   The command for which to display detail help.
+
+If no command is specified, HELP will display all possible commands.
+
+Example:
+
+HELP
+HELP CREATE PARTITION PRIMARY
 .
 Language=German
-
+Zeigt eine Liste der verfügbaren Befehle oder detaillierte
+Hilfeinformationen zu einem bestimmten Befehl an.
+
+Syntax:  HELP []
+
+   Der Befehl, zu dem eine detaillierte Hilfe angezeigt
+   werden soll.
+
+Wenn kein Befehl angegeben ist, werden mit HELP alle verfügbaren Befehle
+angezeigt.
+
+Beispiel:
+
+HELP
+HELP CREATE PARTITION PRIMARY
 .
 Language=Polish
-
+Displays a list of the available commands or detailed help information for 
a
+specified command.
+
+Syntax:  HELP []
+
+   The command for which to display detail help.
+
+If no command is specified, HELP will display all possible commands.
+
+Example:
+
+HELP
+HELP CREATE PARTITION PRIMARY
 .
 Language=Portugese
-
+Displays a list of the available commands or detailed help information for 
a
+specified command.
+
+Syntax:  HELP []
+
+   The command for which to display detail help.
+
+If no command is specified, HELP will display all possible commands.
+
+Example:
+
+HELP
+HELP CREATE PARTITION PRIMARY
 .
 Language=Romanian
-
+Displays a list of the available commands or detailed help information for 
a
+specified command.
+
+Syntax:  HELP []
+
+   The command for which to display detail help.
+
+If no command is specified, HELP will display all possible commands.
+
+Example:
+
+HELP
+HELP CREATE PARTITION PRIMARY
 .
 Language=Russian
-
+Displays a list of the available commands or detailed help information for 
a
+specified command.
+
+Syntax:  HELP []
+
+   The command for which to display detail help.
+
+If no command is specified, HELP will display all possible commands.
+
+Example:
+
+HELP
+HELP CREATE PARTITION PRIMARY
 .
 Language=Albanian
-
+Displays a list of the available commands or detailed help information for 
a
+specified command.
+
+Syntax:  HELP []
+
+   The command for which to display detail help.
+
+If no command is specified, HELP will display all possible commands.
+
+Example:
+
+HELP
+HELP CREATE PARTITION PRIMARY
 .
 Language=Turkish
-
+Displays a list of the available commands or detailed help information for 
a
+specified command.
+
+Syntax:  HELP []
+
+   The command for which to display detail help.
+
+If no command is specified, HELP will display all possible commands.
+
+Example:
+
+HELP
+HELP CREATE PARTITION PRIMARY
 .
 Language=Chinese
-
+Displays a list of the available commands or detailed help information for 
a
+specified command.
+
+Syntax:  HELP []
+
+   The command for which to display detail help.
+
+If no command is specified, HELP will display all possible commands.
+
+Example:
+
+HELP
+HELP CREATE PARTITION PRIMARY
 .
 Language=Taiwanese
-
+Displays a list of the available commands or detailed help information for 
a
+specified command.
+
+Syntax:  HELP []
+
+   The command for which to display detail help.
+
+If no command is specified, HELP will display all possible commands.
+
+Example:
+
+HELP
+HELP CREATE PARTITION PRIMARY
 .
 
 



[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the LIST VOLUME command

2022-06-13 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6f1c7edaa5ed7316f549b13141b4dced9c9eb2e9

commit 6f1c7edaa5ed7316f549b13141b4dced9c9eb2e9
Author: Eric Kohl 
AuthorDate: Mon Jun 13 21:18:35 2022 +0200
Commit: Eric Kohl 
CommitDate: Mon Jun 13 21:18:35 2022 +0200

[DISKPART] Add help text for the LIST VOLUME command
---
 base/system/diskpart/diskpart_msg.mc | 90 
 1 file changed, 80 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 99942f66998..1727205d9e9 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -2630,34 +2630,104 @@ SymbolicName=MSG_COMMAND_LIST_VOLUME
 Severity=Informational
 Facility=System
 Language=English
-
+Displays a list of basic and dynamic volumes which are installed on the 
local
+machine.
+
+Syntax:  LIST VOLUME
+
+Example:
+
+LIST VOLUME
 .
 Language=German
-
+Zeigt eine Liste der Basisvolumes und dynamischen Volumes an, die auf dem
+lokalen Computer installiert sind.
+
+Syntax:  LIST VOLUME
+
+Beispiel:
+
+LIST VOLUME
 .
 Language=Polish
-
+Displays a list of basic and dynamic volumes which are installed on the 
local
+machine.
+
+Syntax:  LIST VOLUME
+
+Example:
+
+LIST VOLUME
 .
 Language=Portugese
-
+Displays a list of basic and dynamic volumes which are installed on the 
local
+machine.
+
+Syntax:  LIST VOLUME
+
+Example:
+
+LIST VOLUME
 .
 Language=Romanian
-
+Displays a list of basic and dynamic volumes which are installed on the 
local
+machine.
+
+Syntax:  LIST VOLUME
+
+Example:
+
+LIST VOLUME
 .
 Language=Russian
-
+Displays a list of basic and dynamic volumes which are installed on the 
local
+machine.
+
+Syntax:  LIST VOLUME
+
+Example:
+
+LIST VOLUME
 .
 Language=Albanian
-
+Displays a list of basic and dynamic volumes which are installed on the 
local
+machine.
+
+Syntax:  LIST VOLUME
+
+Example:
+
+LIST VOLUME
 .
 Language=Turkish
-
+Displays a list of basic and dynamic volumes which are installed on the 
local
+machine.
+
+Syntax:  LIST VOLUME
+
+Example:
+
+LIST VOLUME
 .
 Language=Chinese
-
+Displays a list of basic and dynamic volumes which are installed on the 
local
+machine.
+
+Syntax:  LIST VOLUME
+
+Example:
+
+LIST VOLUME
 .
 Language=Taiwanese
-
+Displays a list of basic and dynamic volumes which are installed on the 
local
+machine.
+
+Syntax:  LIST VOLUME
+
+Example:
+
+LIST VOLUME
 .
 
 



[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the LIST PARTITION command

2022-06-12 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=124fe7504e98e5c285b0a1d4412ca91260bc3d18

commit 124fe7504e98e5c285b0a1d4412ca91260bc3d18
Author: Eric Kohl 
AuthorDate: Sun Jun 12 23:26:53 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jun 12 23:26:53 2022 +0200

[DISKPART] Add help text for the LIST PARTITION command
---
 base/system/diskpart/diskpart_msg.mc | 142 ---
 1 file changed, 132 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 2daa41eaab4..99942f66998 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -2472,34 +2472,156 @@ SymbolicName=MSG_COMMAND_LIST_PARTITION
 Severity=Informational
 Facility=System
 Language=English
-
+Displays a list of partitions in the partition table for the selected disk.
+
+Syntax:  LIST PARTITION
+
+On dynamic disks, the partitions do not neccessarily correspond to the
+dynamic volumes on the disk. Partitions may not be created or deleted
+on dynamic disks.
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+LIST PARTITION
 .
 Language=German
-
+Zeigt eine Liste der Partitionen in der Partitionstabelle für den
+ausgewählten Datenträger an.
+
+Syntax:  LIST PARTITION
+
+Auf dynamischen Datenträgern entsprechen die Partitionen nicht unbedingt
+den dynamischen Volumes auf dem Datenträger. Partitionen werden auf
+dynamischen Datenträgern möglicherweise nicht erstellt oder gelöscht.
+
+Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss ein
+Datenträger ausgewählt werden.
+
+Beispiel:
+
+LIST PARTITION
 .
 Language=Polish
-
+Displays a list of partitions in the partition table for the selected disk.
+
+Syntax:  LIST PARTITION
+
+On dynamic disks, the partitions do not neccessarily correspond to the
+dynamic volumes on the disk. Partitions may not be created or deleted
+on dynamic disks.
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+LIST PARTITION
 .
 Language=Portugese
-
+Displays a list of partitions in the partition table for the selected disk.
+
+Syntax:  LIST PARTITION
+
+On dynamic disks, the partitions do not neccessarily correspond to the
+dynamic volumes on the disk. Partitions may not be created or deleted
+on dynamic disks.
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+LIST PARTITION
 .
 Language=Romanian
-
+Displays a list of partitions in the partition table for the selected disk.
+
+Syntax:  LIST PARTITION
+
+On dynamic disks, the partitions do not neccessarily correspond to the
+dynamic volumes on the disk. Partitions may not be created or deleted
+on dynamic disks.
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+LIST PARTITION
 .
 Language=Russian
-
+Displays a list of partitions in the partition table for the selected disk.
+
+Syntax:  LIST PARTITION
+
+On dynamic disks, the partitions do not neccessarily correspond to the
+dynamic volumes on the disk. Partitions may not be created or deleted
+on dynamic disks.
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+LIST PARTITION
 .
 Language=Albanian
-
+Displays a list of partitions in the partition table for the selected disk.
+
+Syntax:  LIST PARTITION
+
+On dynamic disks, the partitions do not neccessarily correspond to the
+dynamic volumes on the disk. Partitions may not be created or deleted
+on dynamic disks.
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+LIST PARTITION
 .
 Language=Turkish
-
+Displays a list of partitions in the partition table for the selected disk.
+
+Syntax:  LIST PARTITION
+
+On dynamic disks, the partitions do not neccessarily correspond to the
+dynamic volumes on the disk. Partitions may not be created or deleted
+on dynamic disks.
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+LIST PARTITION
 .
 Language=Chinese
-
+Displays a list of partitions in the partition table for the selected disk.
+
+Syntax:  LIST PARTITION
+
+On dynamic disks, the partitions do not neccessarily correspond to the
+dynamic volumes on the disk. Partitions may not be created or deleted
+on dynamic disks.
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+LIST PARTITION
 .
 Language=Taiwanese
-
+Displays a list of partitions in the partition table for the selected disk.
+
+Syntax:  LIST PARTITION
+
+On dynamic disks, the partitions do not neccessarily correspond to the
+dynamic volumes on the disk. Partitions may not be created or deleted
+on dynamic disks.
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+LIST PARTITION
 .
 
 



[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the LIST DISK command

2022-06-12 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7c90ea83eff1bb65f50d36b74c54c38dd4e2da41

commit 7c90ea83eff1bb65f50d36b74c54c38dd4e2da41
Author: Eric Kohl 
AuthorDate: Sun Jun 12 16:15:18 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jun 12 16:15:18 2022 +0200

[DISKPART] Add help text for the LIST DISK command
---
 base/system/diskpart/diskpart_msg.mc | 243 +--
 1 file changed, 233 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index df8fdc0d525..2daa41eaab4 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -2214,34 +2214,257 @@ SymbolicName=MSG_COMMAND_LIST_DISK
 Severity=Informational
 Facility=System
 Language=English
-
+Displays a list of disks.
+
+Syntax:  LIST DISK
+
+Displays a list of disks and information about them, such as their
+size, amount of available free space, whether the disk is a basic
+or dynamic disk, and whether the disk uses the master boot record
+(MBR) or GUID partition table (GPT) partition style. The disk marked
+with an asterisk (*) has focus.
+
+Note that the FREE column does not display the total amount of free
+space on the disk, but rather the amount of usable free space left
+on the disk. For example, if you have a 10GB disk with 4 primary
+partitions covering 5GB, there is no usable free space left (no
+more partitions may be created). Another example would be you have
+a 10GB disk with 3 primary partitions and an extended partition
+covering 8GB. The exended partition is of size 3GB with one logical
+drive of size 2GB. The disk will show only 1GB as free - the
+1GB of free space in the extended partition.
+
+Example:
+
+LIST DISK
 .
 Language=German
-
+Zeigt eine Liste der Datenträger an.
+
+Syntax:  LIST DISK
+
+Zeigt eine Liste mit Datenträgern und entsprechenden Informa-
+tionen an - beispielsweise Größe, verfügbarer Speicherplatz sowie
+Angaben dazu, ob es sich bei dem Datenträger um einen
+Basisdatenträger oder um einen dynamischer Datenträger handelt
+und ob der MBR- oder der GUID-Partitionsstil (Master Boot Record
+oder GUID-Partitionstabelle) verwendet wird.
+Den Fokus besitzt der mit einem Sternchen (*) markierte Datenträger.
+
+In der Spalte "FREE" wird nicht der gesamte freie Speicherplatz
+auf dem Datenträger, sondern der verbleibende, verwendbare freie
+Speicherplatz angezeigt. Bei einem Datenträger mit 10 GB mit
+4 primären Partitionen zu 5 GB verbleibt beispielsweise kein freier
+verwendbarer Speicherplatz (es können keine weiteren Partitionen
+erstellt werden). Ein weiteres Beispiel ist ein 10 GB Datenträger mit
+3 primären Partitionen und einer erweiterten Partition mit 8 GB. Die
+erweiterte Partition besitzt eine Größe von 3 GB mit einem logischen
+Laufwerk (2 GB). Für den Datenträger wird nur 1 GB als frei
+angezeigt - 1 GB freier Speicherplatz in der erweiterten Partition.
+
+Beispiel:
+
+LIST DISK
 .
 Language=Polish
-
+Displays a list of disks.
+
+Syntax:  LIST DISK
+
+Displays a list of disks and information about them, such as their
+size, amount of available free space, whether the disk is a basic
+or dynamic disk, and whether the disk uses the master boot record
+(MBR) or GUID partition table (GPT) partition style. The disk marked
+with an asterisk (*) has focus.
+
+Note that the FREE column does not display the total amount of free
+space on the disk, but rather the amount of usable free space left
+on the disk. For example, if you have a 10GB disk with 4 primary
+partitions covering 5GB, there is no usable free space left (no
+more partitions may be created). Another example would be you have
+a 10GB disk with 3 primary partitions and an extended partition
+covering 8GB. The exended partition is of size 3GB with one logical
+drive of size 2GB. The disk will show only 1GB as free - the
+1GB of free space in the extended partition.
+
+Example:
+
+LIST DISK
 .
 Language=Portugese
-
+Displays a list of disks.
+
+Syntax:  LIST DISK
+
+Displays a list of disks and information about them, such as their
+size, amount of available free space, whether the disk is a basic
+or dynamic disk, and whether the disk uses the master boot record
+(MBR) or GUID partition table (GPT) partition style. The disk marked
+with an asterisk (*) has focus.
+
+Note that the FREE column does not display the total amount of free
+space on the disk, but rather the amount of usable free space left
+on the disk. For example, if you have a 10GB disk with 4 primary
+partitions covering 5GB, there is no usable free space left (no
+more partitions may be created). Another example would be you have
+a 10GB disk with 3 primary partitions and an extended

[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the SELECT VOLUME command

2022-06-12 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ad9b9303545aec4a9edac1a26290d7e1f2fac31b

commit ad9b9303545aec4a9edac1a26290d7e1f2fac31b
Author: Eric Kohl 
AuthorDate: Sun Jun 12 09:32:40 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jun 12 09:32:40 2022 +0200

[DISKPART] Add help text for the SELECT VOLUME command
---
 base/system/diskpart/diskpart_msg.mc | 212 +--
 1 file changed, 202 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 472ff199dcd..df8fdc0d525 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -3417,34 +3417,226 @@ SymbolicName=MSG_COMMAND_SELECT_VOLUME
 Severity=Informational
 Facility=System
 Language=English
-
+Selects the specified volume and shifts the focus to it.
+
+Syntax:  SELECT VOLUME={ | }
+
+VOLUME=  The number of the volume to receive the focus.
+
+VOLUME=  The drive letter or mounted folder path of the volume
+to receive the focus.
+
+If no volume is specified, the select command lists the current volume with
+focus. You can specify the volume by number, drive letter, or mounted 
folder
+path. On a basic disk, selecting a volume also gives the corresponding
+partition focus. You can view the numbers of all volumes on the computer by
+using the list volume command.
+
+Example:
+
+SELECT VOLUME=1
+SELECT VOLUME=C
+SELECT VOLUME=C:\\MountH
 .
 Language=German
-
+Wählt das angegebene Volume aus und setzt den Fokus auf dieses Volume.
+
+Syntax:  SELECT VOLUME={ | }
+
+VOLUME=  Die Nummer des Volumes, das den Fokus erhalten soll.
+
+VOLUME=  Der Laufwerkbuchstabe oder Pfad des eingebundenen Ordners des
+Volumes, das den Fokus erhalten soll.
+
+Wenn kein Volume angegeben ist, listet der Befehl SELECT das aktuelle
+Volume auf, das den Fokus besitzt. Sie können das Volume mit einer Nummer,
+einem Laufwerkbuchstaben oder dem Pfad des eingebundenen
+Ordners angeben.
+Auf einem Basisdatenträger erhält bei Auswahl eines Volumes auch die
+entsprechende Partition den Fokus. Mit dem Befehl LIST VOLUME können Sie
+die Nummern aller auf dem Computer vorhandenen Volumes anzeigen.
+
+Beispiel:
+
+SELECT VOLUME=1
+SELECT VOLUME=C
+SELECT VOLUME=C:\\MountH
 .
 Language=Polish
-
+Selects the specified volume and shifts the focus to it.
+
+Syntax:  SELECT VOLUME={ | }
+
+VOLUME=  The number of the volume to receive the focus.
+
+VOLUME=  The drive letter or mounted folder path of the volume
+to receive the focus.
+
+If no volume is specified, the select command lists the current volume with
+focus. You can specify the volume by number, drive letter, or mounted 
folder
+path. On a basic disk, selecting a volume also gives the corresponding
+partition focus. You can view the numbers of all volumes on the computer by
+using the list volume command.
+
+Example:
+
+SELECT VOLUME=1
+SELECT VOLUME=C
+SELECT VOLUME=C:\\MountH
 .
 Language=Portugese
-
+Selects the specified volume and shifts the focus to it.
+
+Syntax:  SELECT VOLUME={ | }
+
+VOLUME=  The number of the volume to receive the focus.
+
+VOLUME=  The drive letter or mounted folder path of the volume
+to receive the focus.
+
+If no volume is specified, the select command lists the current volume with
+focus. You can specify the volume by number, drive letter, or mounted 
folder
+path. On a basic disk, selecting a volume also gives the corresponding
+partition focus. You can view the numbers of all volumes on the computer by
+using the list volume command.
+
+Example:
+
+SELECT VOLUME=1
+SELECT VOLUME=C
+SELECT VOLUME=C:\\MountH
 .
 Language=Romanian
-
+Selects the specified volume and shifts the focus to it.
+
+Syntax:  SELECT VOLUME={ | }
+
+VOLUME=  The number of the volume to receive the focus.
+
+VOLUME=  The drive letter or mounted folder path of the volume
+to receive the focus.
+
+If no volume is specified, the select command lists the current volume with
+focus. You can specify the volume by number, drive letter, or mounted 
folder
+path. On a basic disk, selecting a volume also gives the corresponding
+partition focus. You can view the numbers of all volumes on the computer by
+using the list volume command.
+
+Example:
+
+SELECT VOLUME=1
+SELECT VOLUME=C
+SELECT VOLUME=C:\\MountH
 .
 Language=Russian
-
+Selects the specified volume and shifts the focus to it.
+
+Syntax:  SELECT VOLUME={ | }
+
+VOLUME=  The number of the volume to receive the focus.
+
+VOLUME=  The drive letter or mounted folder path of the volume
+to receive the focus.
+
+If no volume is specified, the select command lists the current volume with
+focus. You

[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the SELECT PARTITION command

2022-06-11 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7bea98592fd64a8c98d5a1cbd314ef5cc9f2faa4

commit 7bea98592fd64a8c98d5a1cbd314ef5cc9f2faa4
Author: Eric Kohl 
AuthorDate: Sat Jun 11 22:34:07 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 11 22:34:07 2022 +0200

[DISKPART] Add help text for the SELECT PARTITION command
---
 base/system/diskpart/diskpart_msg.mc | 202 +--
 1 file changed, 192 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index ed0cebc248e..472ff199dcd 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -3199,34 +3199,216 @@ SymbolicName=MSG_COMMAND_SELECT_PARTITION
 Severity=Informational
 Facility=System
 Language=English
-
+Selects the specified partition and shifts the focus to it.
+
+Syntax:  SELECT PARTITION=
+
+PARTITION=
+
+The number of the partition to receive the focus.
+
+If no partition is specified, the select command lists the current
+partition with focus. You can specify the partition by its number. You can
+view the numbers of all partitions on the current disk by using the list
+partition command.
+
+You must first select a disk using the DiskPart select disk command before
+you can select a partition.
+
+Example:
+
+SELECT PARTITION=1
 .
 Language=German
-
+Wählt die angegebene Partition aus und setzt den Fokus auf diese
+Partition.
+
+Syntax:  SELECT PARTITION=
+
+PARTITION=
+
+Die Nummer der Partition, die den Fokus erhalten soll.
+
+Wenn keine Partition angegeben ist, listet der Befehl SELECT die
+aktuelle Partition auf, die den Fokus hat. Sie können die Partition
+mit ihrer Nummer angeben. Mit dem Befehl LIST PARTITION können die
+Nummern aller auf dem aktuellen Datenträger enthaltenen Partitionen
+angezeigt werden.
+
+Bevor Sie eine Partition auswählen können, müssen Sie zunächst mit dem
+DiskPart-Befehl SELECT DISK einen Datenträger auswählen.
+
+Beispiel:
+
+SELECT PARTITION=1
 .
 Language=Polish
-
+Selects the specified partition and shifts the focus to it.
+
+Syntax:  SELECT PARTITION=
+
+PARTITION=
+
+The number of the partition to receive the focus.
+
+If no partition is specified, the select command lists the current
+partition with focus. You can specify the partition by its number. You can
+view the numbers of all partitions on the current disk by using the list
+partition command.
+
+You must first select a disk using the DiskPart select disk command before
+you can select a partition.
+
+Example:
+
+SELECT PARTITION=1
 .
 Language=Portugese
-
+Selects the specified partition and shifts the focus to it.
+
+Syntax:  SELECT PARTITION=
+
+PARTITION=
+
+The number of the partition to receive the focus.
+
+If no partition is specified, the select command lists the current
+partition with focus. You can specify the partition by its number. You can
+view the numbers of all partitions on the current disk by using the list
+partition command.
+
+You must first select a disk using the DiskPart select disk command before
+you can select a partition.
+
+Example:
+
+SELECT PARTITION=1
 .
 Language=Romanian
-
+Selects the specified partition and shifts the focus to it.
+
+Syntax:  SELECT PARTITION=
+
+PARTITION=
+
+The number of the partition to receive the focus.
+
+If no partition is specified, the select command lists the current
+partition with focus. You can specify the partition by its number. You can
+view the numbers of all partitions on the current disk by using the list
+partition command.
+
+You must first select a disk using the DiskPart select disk command before
+you can select a partition.
+
+Example:
+
+SELECT PARTITION=1
 .
 Language=Russian
-
+Selects the specified partition and shifts the focus to it.
+
+Syntax:  SELECT PARTITION=
+
+PARTITION=
+
+The number of the partition to receive the focus.
+
+If no partition is specified, the select command lists the current
+partition with focus. You can specify the partition by its number. You can
+view the numbers of all partitions on the current disk by using the list
+partition command.
+
+You must first select a disk using the DiskPart select disk command before
+you can select a partition.
+
+Example:
+
+SELECT PARTITION=1
 .
 Language=Albanian
-
+Selects the specified partition and shifts the focus to it.
+
+Syntax:  SELECT PARTITION=
+
+PARTITION=
+
+The number of the partition to receive the focus.
+
+If no partition is specified, the select command lists the current
+partition with focus. You can specify the partition by its number. You can
+view the numbers of all partitions

[ros-diffs] [reactos] 01/01: [DISKPART] Implement the SETID command

2022-06-11 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7dec75ff670286f47d82431838330b1ee20a0f66

commit 7dec75ff670286f47d82431838330b1ee20a0f66
Author: Eric Kohl 
AuthorDate: Sat Jun 11 14:31:55 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 11 14:31:55 2022 +0200

[DISKPART] Implement the SETID command
---
 base/system/diskpart/lang/de-DE.rc |  8 
 base/system/diskpart/lang/en-US.rc |  8 
 base/system/diskpart/lang/pl-PL.rc |  8 
 base/system/diskpart/lang/pt-PT.rc |  8 
 base/system/diskpart/lang/ro-RO.rc |  8 
 base/system/diskpart/lang/ru-RU.rc |  8 
 base/system/diskpart/lang/sq-AL.rc |  8 
 base/system/diskpart/lang/tr-TR.rc |  8 
 base/system/diskpart/lang/zh-CN.rc |  8 
 base/system/diskpart/lang/zh-TW.rc |  8 
 base/system/diskpart/resource.h|  6 +++
 base/system/diskpart/setid.c   | 76 +-
 12 files changed, 161 insertions(+), 1 deletion(-)

diff --git a/base/system/diskpart/lang/de-DE.rc 
b/base/system/diskpart/lang/de-DE.rc
index 97378fd99fe..6de5a7687ba 100644
--- a/base/system/diskpart/lang/de-DE.rc
+++ b/base/system/diskpart/lang/de-DE.rc
@@ -117,6 +117,14 @@ BEGIN
 IDS_SELECT_VOLUME_INVALID "\nInvalid volume.\n\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_SETID_FAIL "\nDiskPart konnte den Partitionstyp nicht ändern.\n"
+IDS_SETID_SUCCESS "\nDer Partitionstyp wurde erfolgreich geändert.\n"
+IDS_SETID_INVALID_FORMAT "\nDas Format des Partitionstyps ist ungültig.\n"
+IDS_SETID_INVALID_TYPE "\nDer Partitionstyp ist ungültig.\n"
+END
+
 /* Disk Status */
 STRINGTABLE
 BEGIN
diff --git a/base/system/diskpart/lang/en-US.rc 
b/base/system/diskpart/lang/en-US.rc
index 8b3222d2de7..e0e23003df4 100644
--- a/base/system/diskpart/lang/en-US.rc
+++ b/base/system/diskpart/lang/en-US.rc
@@ -117,6 +117,14 @@ BEGIN
 IDS_SELECT_VOLUME_INVALID "\nInvalid volume.\n\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_SETID_FAIL "\nDiskPart was unable to change the partition type.\n"
+IDS_SETID_SUCCESS "\nThe partition type was changed successfully.\n"
+IDS_SETID_INVALID_FORMAT "\nThe format of the partition type is invalid.\n"
+IDS_SETID_INVALID_TYPE "\nThe partition type is invalid.\n"
+END
+
 /* Disk Status */
 STRINGTABLE
 BEGIN
diff --git a/base/system/diskpart/lang/pl-PL.rc 
b/base/system/diskpart/lang/pl-PL.rc
index 10c96c15d8e..d15721a8809 100644
--- a/base/system/diskpart/lang/pl-PL.rc
+++ b/base/system/diskpart/lang/pl-PL.rc
@@ -117,6 +117,14 @@ BEGIN
 IDS_SELECT_VOLUME_INVALID "\nNieprawidłowy wolumin.\n\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_SETID_FAIL "\nDiskPart was unable to change the partition type.\n"
+IDS_SETID_SUCCESS "\nThe partition type was changed successfully.\n"
+IDS_SETID_INVALID_FORMAT "\nThe format of the partition type is invalid.\n"
+IDS_SETID_INVALID_TYPE "\nThe partition type is invalid.\n"
+END
+
 /* Disk Status */
 STRINGTABLE
 BEGIN
diff --git a/base/system/diskpart/lang/pt-PT.rc 
b/base/system/diskpart/lang/pt-PT.rc
index b3ea79004d2..1187c52bad2 100644
--- a/base/system/diskpart/lang/pt-PT.rc
+++ b/base/system/diskpart/lang/pt-PT.rc
@@ -119,6 +119,14 @@ BEGIN
 IDS_SELECT_VOLUME_INVALID "\nInvalid volume.\n\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_SETID_FAIL "\nDiskPart was unable to change the partition type.\n"
+IDS_SETID_SUCCESS "\nThe partition type was changed successfully.\n"
+IDS_SETID_INVALID_FORMAT "\nThe format of the partition type is invalid.\n"
+IDS_SETID_INVALID_TYPE "\nThe partition type is invalid.\n"
+END
+
 /* Disk Status */
 STRINGTABLE
 BEGIN
diff --git a/base/system/diskpart/lang/ro-RO.rc 
b/base/system/diskpart/lang/ro-RO.rc
index de6dcf2e770..8ff6e4805f0 100644
--- a/base/system/diskpart/lang/ro-RO.rc
+++ b/base/system/diskpart/lang/ro-RO.rc
@@ -119,6 +119,14 @@ BEGIN
 IDS_SELECT_VOLUME_INVALID "\nInvalid volume.\n\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_SETID_FAIL "\nDiskPart was unable to change the partition type.\n"
+IDS_SETID_SUCCESS "\nThe partition type was changed successfully.\n"
+IDS_SETID_INVALID_FORMAT "\nThe format of the partition type is invalid.\n"
+IDS_SETID_INVALID_TYPE "\nThe partition type is invalid.\n"
+END
+
 /* Disk Status */
 STRINGTABLE
 BEGIN
diff --git a/base/system/diskpart/lang/ru-RU.rc 
b/base/system/diskpart/lang/ru-RU.rc
index acc78d19517..52a5058d27b 100644
--- a/base/system/diskpart/lang/ru-RU.rc
+++ b/base/system/diskpart/lang/ru-RU.rc
@@ -119,6 +119,14 @@ BEGIN
 IDS_SELECT_VOLUME_INVALID "\nInvalid volume.\n\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_SETID_FAIL "\nDiskPart was unable to change the partition type.\n"
+IDS_SETID_SUCCESS "\nThe partition type was changed successfully.\n&quo

[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the SELECT DISK command

2022-06-11 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f06066dc6e893d78a6c6bf3d4cc9224c4062edc0

commit f06066dc6e893d78a6c6bf3d4cc9224c4062edc0
Author: Eric Kohl 
AuthorDate: Sat Jun 11 13:13:27 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 11 13:13:27 2022 +0200

[DISKPART] Add help text for the SELECT DISK command
---
 base/system/diskpart/diskpart_msg.mc | 405 ++-
 1 file changed, 395 insertions(+), 10 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index c974c6ddc72..ed0cebc248e 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -2778,34 +2778,419 @@ SymbolicName=MSG_COMMAND_SELECT_DISK
 Severity=Informational
 Facility=System
 Language=English
-
+Selects the specified disk and shifts the focus to it.
+
+Syntax:  SELECT DISK=
+ SELECT DISK=SYSTEM
+ SELECT DISK=NEXT
+ SELECT DISK=
+
+DISK=
+The DiskPart disk index number of the disk to receive
+focus.
+
+DISK=
+The location path of the disk to receive focus.
+
+DISK=SYSTEM
+On BIOS machines, BIOS disk 0 will receive focus.
+On EFI machines, the disk containing the ESP partition
+used for the current boot will receive focus. On EFI
+machines, if there is no ESP, or there is more than
+one ESP present, or the machine is booted from Windows PE,
+the command will fail.
+
+DISK=NEXT
+Once a disk is selected, this command is used to iterate
+over all disks in the disk list. The next disk in the list
+will receive focus. If the next disk is the start of the
+enumeration, the command will fail and no disk will have
+focus.
+
+If no options are specified, the select command lists the disk that
+currently has the focus. You can view the DiskPart index numbers
+for all disks on the computer by using the LIST DISK command.
+
+Example:
+
+SELECT DISK=1
+SELECT DISK=SYSTEM
+SELECT DISK=NEXT
+SELECT DISK=PCIROOT(0)#PCI(0100)#ATA(C00T00L01)
 .
 Language=German
-
+Dient zum Auswählen des angegebenen Datenträgers sowie zum
+Festlegen des Fokus auf den Datenträger.
+
+Syntax:  SELECT DISK=
+ SELECT DISK=SYSTEM
+ SELECT DISK=NEXT
+ SELECT DISK=
+
+DISK=
+Die DiskPart-Datenträgerindexnummer des Datenträgers, auf
+den der Fokus festgelegt werden soll.
+
+DISK=
+Der Speicherortpfad des Datenträgers, auf den der Fokus
+festgelegt werden soll.
+
+DISK=SYSTEM
+Bei BIOS-Computern erhält der BIOS-Datenträger "0" den
+Fokus. Bei EFI-Computern erhält der Datenträger mit der
+ESP-Partition, der für den aktuellen Startvorgang verwendet
+wird, den Fokus. Bei EFI-Computern ohne ESP oder mit
+mehreren ESPs (oder beim Start des Computers unter Ver-
+wendung von Windows PE) tritt bei Verwendung des Befehls
+ein Fehler auf.
+
+DISK=NEXT
+Nach Auswahl eines Datenträgers erfolgt mithilfe dieses
+Befehls eine Iteration durch alle Datenträger in der Daten-
+trägerliste. Der nächste Datenträger in der Liste erhält den
+Fokus. Handelt es sich beim nächsten Datenträger um den
+Beginn der Aufzählung, tritt bei dem Befehl ein Fehler auf, und
+keiner der Datenträger erhält den Fokus.
+
+Ohne Angabe von Optionen wird mithilfe des Befehls "Select" der
+Datenträger angegeben, der derzeit den Fokus besitzt. Verwenden
+Sie zum Anzeigen der DiskPart-Indexnummern für alle Datenträger
+des Computers den Befehl "LIST DISK".
+
+Beispiele:
+
+SELECT DISK=1
+SELECT DISK=SYSTEM
+SELECT DISK=NEXT
+SELECT DISK=PCIROOT(0)#PCI(0100)#ATA(C00T00L01)
 .
 Language=Polish
-
+Selects the specified disk and shifts the focus to it.
+
+Syntax:  SELECT DISK=
+ SELECT DISK=SYSTEM
+ SELECT DISK=NEXT
+ SELECT DISK=
+
+DISK=
+The DiskPart disk index number of the disk to receive
+focus.
+
+DISK=
+The location path of the disk to receive focus.
+
+DISK=SYSTEM
+On BIOS machines, BIOS disk 0 will receive focus.
+On EFI machines, the disk containing the ESP partition
+used for the current boot will receive focus. On EFI
+machines, if there is no ESP, or there is more than
+one ESP present, or the machine is booted from Windows PE,
+the command will fail.
+
+DISK=NEXT
+Once a disk is selected, this command is used to ite

[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the SETID command

2022-06-10 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=84512b7abddffe28d9b95472635b9c2bcf4bd732

commit 84512b7abddffe28d9b95472635b9c2bcf4bd732
Author: Eric Kohl 
AuthorDate: Fri Jun 10 22:01:42 2022 +0200
Commit: Eric Kohl 
CommitDate: Fri Jun 10 22:02:07 2022 +0200

[DISKPART] Add help text for the SETID command
---
 base/system/diskpart/diskpart_msg.mc | 741 ++-
 1 file changed, 732 insertions(+), 9 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 15ccd2c3117..c974c6ddc72 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -3004,31 +3004,754 @@ Example:
 SET ID=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
 .
 Language=German
-
+
+Ändert das Partitionstypfeld für die Partition im Fokus.
+
+Syntax:  SET ID={ | } [OVERRIDE] [NOERR]
+
+ID={ | }
+
+Gibt den neuen Partitionstyp an.
+
+Für MBR-Datenträger (Master Boot Record) können Sie ein
+Partitionstypbyte im Hexadezimalformat angeben. Mit
+diesem Parameter können Sie jedes Partitionstypbyte angeben,
+außer Typ "0x42" (LDM-Partition). Das voranstehende "0x" wird
+bei Angabe des hexadezimalen Partitionstyps ausgelassen.
+
+Für GPT-Datenträger (GPT = GUID-Partitionstabelle) können
+Sie einen Partitionstyp-GUID für die zu erstellende Partition
+angeben: Zu den erkannten GUIDs gehören:
+
+EFI-Systempartition:
+c12a7328-f81f-11d2-ba4b-00a0c93ec93b
+
+Basisdatenpartition:
+ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
+
+Mit diesem Parameter kann jeder Partitionstyp-GUID
+angegeben werden, mit Ausnahme der folgenden:
+
+MSR-Partition (Microsoft Reserved):
+e3c9e316-0b5c-4db8-817d-f92df00215ae
+
+LDM-Metadatenpartition auf einem dynamischen Datenträger:
+5808c8aa-7e8f-42e0-85d2-e1e90434cfb3
+
+LDM-Datenpartition auf einem dynamischen Datenträger:
+af9b60a0-1431-4f62-bc68-3311714a69ad
+
+Clustermetadaten-Partition:
+db97dba9-0840-4bae-97f0-ffb9a327c7e1
+
+
+Abgesehen von den erwähnten Einschränkungen überprüft
+DiskPart die Gültigkeit des Partitionstyps nicht. Es wird
+lediglich sichergestellt, dass es sich um ein Byte im Hexadezi-
+malformat oder um einen GUID handelt
+
+OVERRIDEErmöglicht DiskPart die Aufhebung der Bereitstellung
+des Dateisystems auf dem Volume zu erzwingen, bevor der
+Partitionstyp geändert wird. Beim Ändern des Partitionstyps
+wird das Dateisystem auf dem Volume gesperrt und dessen
+Bereitstellung aufgehoben. Wird dieser Parameter nicht an-
+gegeben und schlägt der Aufruf zum Sperren des Dateisys-
+tems fehl (da einige andere Anwendungen über ein geöffne-
+tes Handle für das Volume verfügen), schlägt der gesamte
+Vorgang fehl. Bei Angabe dieses Parameters wird die Auf-
+hebung der Bereitstellung auch dann erzwungen, wenn der
+Aufruf des Dateisystems fehlschlägt. Wird die Bereitstellung
+eines Dateisystems aufgehoben, werden alle geöffneten
+Handles für das Volume ungültig.
+
+NOERR   Nur für Skripting. Bei einem Fehler wird die Verarbeitung von
+Befehlen fortgesetzt, als sei der Fehler nicht aufgetreten.
+Ohne NOERR-Parameter wird DiskPart bei einem Fehler mit
+dem entsprechenden Fehlercode beendet.
+
+Ist nur für die Verwendung durch Originalgerätehersteller
+(OEM, Original Equipment Manufacturer) vorgesehen.
+
+Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss
+eine Partition ausgewählt sein.
+
+Vorsicht:
+
+Das Ändern von Partitionstypfeldern mit diesem Parameter kann
+dazu führen, dass der Computer nicht mehr ordnungsgemäß
+funktioniert oder nicht mehr gestartet werden kann. Sofern Sie
+kein Originalgerätehersteller oder IT-Fachmann sind, der mit GPT-
+Datenträgern vertraut ist, sollten Sie keine Partitionstypfelder auf
+GPT-Datenträgern mit diesem Parameter ändern. Verwenden Sie
+stattdessen immer den Befehl "CREATE PARTITION EFI" zum
+Erstellen von EFI-Systempartitionen, den Befehl "CREATE
+PARTITION MSR" zum Erstellen von MSR-Partitionen und den
+Befehl "CREATE PARTITION PRIMARY" (ohne diesen Parameter)
+zum Erstellen von primären Partitionen auf GPT-Datenträgern.
+
+Dieser Befe

[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the UNIQUEID DISK command

2022-06-07 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dd2c7ea3ce05a74034e7cd98af6a61b579a78c5a

commit dd2c7ea3ce05a74034e7cd98af6a61b579a78c5a
Author: Eric Kohl 
AuthorDate: Tue Jun 7 23:08:05 2022 +0200
Commit: Eric Kohl 
CommitDate: Tue Jun 7 23:08:05 2022 +0200

[DISKPART] Add help text for the UNIQUEID DISK command
---
 base/system/diskpart/diskpart_msg.mc | 288 +--
 1 file changed, 277 insertions(+), 11 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 7fc7419829b..15ccd2c3117 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -2979,7 +2979,29 @@ Syntax:  SET ID={ | } [OVERRIDE] [NOERR]
 NOERR   For scripting only. When an error is encountered, DiskPart
 continues to process commands as if the error did not occur.
 Without the NOERR parameter, an error causes DiskPart to exit
-with an error code.\r\n\r\nIntended for Original Equipment 
Manufacturer (OEM) use only.\r\n\r\nA partition must be selected for this 
operation to succeed.\r\n\r\nCaution:\r\n\r\nChanging partition 
type fields with this parameter might cause your\r\ncomputer to fail or 
be unable to start up. Unless you are an OEM or an\r\nIT professional 
experienced with GPT disks, do not change partition\r\ntype fields on 
GPT disks using this pa [...]
+with an error code.
+
+Intended for Original Equipment Manufacturer (OEM) use only.
+
+A partition must be selected for this operation to succeed.
+
+Caution:
+
+Changing partition type fields with this parameter might cause your
+computer to fail or be unable to start up. Unless you are an OEM or an
+IT professional experienced with GPT disks, do not change partition
+type fields on GPT disks using this parameter. Instead, always use the
+CREATE PARTITION EFI command to create EFI System partitions, the
+CREATE PARTITION MSR command to create Microsoft Reserved partitions,
+and the CREATE PARTITION PRIMARY command without the ID parameter to
+create primary partitions on GPT disks.
+
+This command does not work on dynamic disks nor on Microsoft Reserved
+partitions.
+
+Example:
+SET ID=07 OVERRIDE
+SET ID=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
 .
 Language=German
 
@@ -3051,32 +3073,276 @@ SymbolicName=MSG_COMMAND_UNIQUEID_DISK
 Severity=Informational
 Facility=System
 Language=English
-
+Displays or sets the GUID partition table (GPT) identifier or master boot
+record (MBR) signature for the disk with focus.
+
+Syntax:  UNIQUEID DISK [ID={ | }]  [NOERR]
+
+ID={ | }
+
+For MBR disks, you can specify a four-byte (DWORD) value in
+hexadecimal form for the signature.
+
+For GPT disks, specify a GUID for the identifier.
+
+NOERR   For scripting only. When an error is encountered, DiskPart
+continues to process commands as if the error did not occur.
+Without the NOERR parameter, an error causes DiskPart to exit
+with an error code.
+
+A disk must be selected for this operation to succeed.  This command works
+on basic and dynamic disks.
+
+Example:
+
+UNIQUEID DISK
+UNIQUEID DISK ID=5f1b2c36
+UNIQUEID DISK ID=baf784e7-6bbd-4cfb-aaac-e86c96e166ee
 .
 Language=German
-
+Dient zum Anzeigen oder Festlegen des GPT-Bezeichners (GPT =
+GUID-Partitionstabelle) oder der MBR-Signatur (Master Boot Record)
+für den Datenträger, der den Fokus hat.
+
+Syntax:  UNIQUEID DISK [ID={ | }]  [NOERR]
+
+ID={ | }
+
+Für MBR-Datenträger können Sie einen Wert mit einer
+Länge von vier Bytes (DWORD) im Hexadezimalformat für die
+Signatur angeben.
+
+Für GPT-Datenträger können Sie einen GUID für den
+Bezeichner angeben.
+
+NOERR   Nur für Skripting. Wenn ein Fehler auftritt, setzt DiskPart
+die Verarbeitung von Befehlen fort, als sei der Fehler nicht
+aufgetreten. Ohne den Parameter NOERR wird DiskPart bei
+einem Fehler mit dem entsprechenden Fehlercode beendet.
+
+Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss ein
+Datenträger ausgewählt sein. Der Befehl kann für Basisdatenträger und
+dynamische Datenträger verwendet werden.
+
+Beispiel:
+
+UNIQUEID DISK
+UNIQUEID DISK ID=5f1b2c36
+UNIQUEID DISK ID=baf784e7-6bbd-4cfb-aaac-e86c96e166ee
 .
 Language=Polish
-
+Displays or sets the GUID partition table (GPT) identifier or master boot
+record (MBR) signature for the disk with focus.
+
+Syntax:  UNIQUEID DISK [ID={ | }]  [NOERR]
+
+ID={ | }
+
+For MBR disks, you can specify a four-byte (DWORD) value

[ros-diffs] [reactos] 01/01: [DISKPART] Implement the UNIQUEID command

2022-06-07 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=da0bff2a50ed0ed3bf624abbbc974481eba456dd

commit da0bff2a50ed0ed3bf624abbbc974481eba456dd
Author: Eric Kohl 
AuthorDate: Tue Jun 7 19:42:09 2022 +0200
Commit: Eric Kohl 
CommitDate: Tue Jun 7 19:42:09 2022 +0200

[DISKPART] Implement the UNIQUEID command
---
 base/system/diskpart/uniqueid.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/base/system/diskpart/uniqueid.c b/base/system/diskpart/uniqueid.c
index 0637112cdb9..712ca56a96f 100644
--- a/base/system/diskpart/uniqueid.c
+++ b/base/system/diskpart/uniqueid.c
@@ -48,7 +48,7 @@ UniqueIdDisk(
 }
 
 if ((pszSuffix == NULL) ||
-(wcslen(pszSuffix) > 8) ||
+(wcslen(pszSuffix) != 8) ||
 (IsHexString(pszSuffix) == FALSE))
 {
 ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
@@ -62,12 +62,11 @@ UniqueIdDisk(
 return TRUE;
 }
 
-ConPrintf(StdOut, L"Setting the disk signature is not implemented yet!\n");
-#if 0
-DPRINT1("New Signature: %lx\n", ulValue);
+DPRINT("New Signature: 0x%08lx\n", ulValue);
 CurrentDisk->LayoutBuffer->Signature = ulValue;
-//SetDiskLayout(CurrentDisk);
-#endif
+CurrentDisk->Dirty = TRUE;
+UpdateDiskLayout(CurrentDisk);
+WritePartitions(CurrentDisk);
 
 return TRUE;
 }



[ros-diffs] [reactos] 01/01: [DISKPART] Implement the ACTIVE and INACTIVE commands

2022-06-06 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c8f6440a78c45721b11b06902f3be9eb2ea7ade2

commit c8f6440a78c45721b11b06902f3be9eb2ea7ade2
Author: Eric Kohl 
AuthorDate: Mon Jun 6 11:22:48 2022 +0200
Commit: Eric Kohl 
CommitDate: Mon Jun 6 11:23:11 2022 +0200

[DISKPART] Implement the ACTIVE and INACTIVE commands
---
 base/system/diskpart/active.c  | 45 --
 base/system/diskpart/inactive.c| 44 -
 base/system/diskpart/lang/de-DE.rc | 14 
 base/system/diskpart/lang/en-US.rc | 14 
 base/system/diskpart/lang/pl-PL.rc | 14 
 base/system/diskpart/lang/pt-PT.rc | 40 ++---
 base/system/diskpart/lang/ro-RO.rc | 40 ++---
 base/system/diskpart/lang/ru-RU.rc | 40 ++---
 base/system/diskpart/lang/sq-AL.rc | 40 ++---
 base/system/diskpart/lang/tr-TR.rc | 40 ++---
 base/system/diskpart/lang/zh-CN.rc | 40 ++---
 base/system/diskpart/lang/zh-TW.rc | 40 ++---
 base/system/diskpart/resource.h| 20 -
 13 files changed, 331 insertions(+), 100 deletions(-)

diff --git a/base/system/diskpart/active.c b/base/system/diskpart/active.c
index 77b9d062781..deba7cef705 100644
--- a/base/system/diskpart/active.c
+++ b/base/system/diskpart/active.c
@@ -8,8 +8,49 @@
 
 #include "diskpart.h"
 
-BOOL active_main(INT argc, LPWSTR *argv)
+#define NDEBUG
+#include 
+
+
+BOOL
+active_main(
+_In_ INT argc,
+_In_ PWSTR *argv)
 {
-ConPuts(StdOut, L"\nActive\n");
+NTSTATUS Status;
+
+DPRINT("Active()\n");
+
+if (CurrentDisk == NULL)
+{
+ConResPuts(StdOut, IDS_SELECT_NO_DISK);
+return TRUE;
+}
+
+if (CurrentPartition == NULL)
+{
+ConResPuts(StdOut, IDS_SELECT_NO_PARTITION);
+return TRUE;
+}
+
+if (CurrentPartition->BootIndicator)
+{
+ConResPuts(StdOut, IDS_ACTIVE_ALREADY);
+return TRUE;
+}
+
+CurrentPartition->BootIndicator = TRUE;
+CurrentDisk->Dirty = TRUE;
+UpdateDiskLayout(CurrentDisk);
+Status = WritePartitions(CurrentDisk);
+if (NT_SUCCESS(Status))
+{
+ConResPuts(StdOut, IDS_ACTIVE_SUCCESS);
+}
+else
+{
+ConResPuts(StdOut, IDS_ACTIVE_FAIL);
+}
+
 return TRUE;
 }
diff --git a/base/system/diskpart/inactive.c b/base/system/diskpart/inactive.c
index 0376bc79d32..e5e85edd9a1 100644
--- a/base/system/diskpart/inactive.c
+++ b/base/system/diskpart/inactive.c
@@ -8,7 +8,49 @@
 
 #include "diskpart.h"
 
-BOOL inactive_main(INT argc, LPWSTR *argv)
+#define NDEBUG
+#include 
+
+
+BOOL
+inactive_main(
+_In_ INT argc,
+_In_ PWSTR *argv)
 {
+NTSTATUS Status;
+
+DPRINT("Inactive()\n");
+
+if (CurrentDisk == NULL)
+{
+ConResPuts(StdOut, IDS_SELECT_NO_DISK);
+return TRUE;
+}
+
+if (CurrentPartition == NULL)
+{
+ConResPuts(StdOut, IDS_SELECT_NO_PARTITION);
+return TRUE;
+}
+
+if (!CurrentPartition->BootIndicator)
+{
+ConResPuts(StdOut, IDS_INACTIVE_ALREADY);
+return TRUE;
+}
+
+CurrentPartition->BootIndicator = FALSE;
+CurrentDisk->Dirty = TRUE;
+UpdateDiskLayout(CurrentDisk);
+Status = WritePartitions(CurrentDisk);
+if (NT_SUCCESS(Status))
+{
+ConResPuts(StdOut, IDS_INACTIVE_SUCCESS);
+}
+else
+{
+ConResPuts(StdOut, IDS_INACTIVE_FAIL);
+}
+
 return TRUE;
 }
diff --git a/base/system/diskpart/lang/de-DE.rc 
b/base/system/diskpart/lang/de-DE.rc
index 6265a226f9a..97378fd99fe 100644
--- a/base/system/diskpart/lang/de-DE.rc
+++ b/base/system/diskpart/lang/de-DE.rc
@@ -15,6 +15,13 @@ Usage: DISKPART [/S filename] [/T timeout] [/?]\n\n\
 IDS_APP_PROMPT "DISKPART> "
 END
 
+STRINGTABLE
+BEGIN
+IDS_ACTIVE_FAIL "\nDie Partition konnte nicht als aktiv markiert 
werden.\nVergewissern Sie sich, dass diese Partition gültig ist.\n"
+IDS_ACTIVE_SUCCESS "\nDie aktuelle Partition wurde als aktiv markiert.\n"
+IDS_ACTIVE_ALREADY "\nDie aktuelle Partition wurde bereits als aktiv 
markiert.\n"
+END
+
 STRINGTABLE
 BEGIN
 IDS_CREATE_PARTITION_FAIL "\nDie angegebene Partition konnte nicht 
erstellt werden.\n"
@@ -66,6 +73,13 @@ BEGIN
 IDS_HELP_FORMAT_STRING "%-11.11s - %s"
 END
 
+STRINGTABLE
+BEGIN
+IDS_INACTIVE_FAIL "\nDie Partition konnte nicht als inaktiv markiert 
werden.\nVergewissern Sie sich, dass diese Partition gültig ist.\n"
+IDS_INACTIVE_SUCCESS "\nDie aktuelle Partition wurde als inaktiv 
markiert.\n"
+IDS_INACTIVE_ALREADY "\nDie aktuelle Partition wurde bereits als inaktiv 
markiert.\n"
+END
+
 /* Detail header tit

[ros-diffs] [reactos] 01/01: [DISKPART] Add help text for the DETAIL DISK command

2022-06-05 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=216d69c59e8809eb56880be15b7605ec662d3871

commit 216d69c59e8809eb56880be15b7605ec662d3871
Author: Eric Kohl 
AuthorDate: Sun Jun 5 22:22:16 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jun 5 22:22:16 2022 +0200

[DISKPART] Add help text for the DETAIL DISK command
---
 base/system/diskpart/diskpart_msg.mc | 115 +++
 1 file changed, 103 insertions(+), 12 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index d079e2dc190..7fc7419829b 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -531,7 +531,7 @@ Syntax:  CLEAN [ALL]
 that had been previously applied to the disk. The disk's state after 
 cleaning the disk is 'UNINITIALIZED'.
 
-Example:
+Beispiel:
 
 CLEAN
 .
@@ -1047,7 +1047,7 @@ Syntax:  DELETE PARTITION [NOERR] [OVERRIDE]
 Partitionen könnnen nicht von dynamischen Datenträgern gelöscht oder auf
 dynamischen Datenträgern erstellt werden.
 
-Example:
+Beispiel:
 
 DELETE PARTITION
 .
@@ -1302,34 +1302,125 @@ SymbolicName=MSG_COMMAND_DETAIL_DISK
 Severity=Informational
 Facility=System
 Language=English
-
+Displays the properties of the selected disk and the list of volumes on
+the disk.
+
+Syntax:  DETAIL DISK
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+DETAIL DISK
 .
 Language=German
-
+Zeigt die Eigenschaften des ausgewählten Datenträgers und die Liste der
+Volumes auf dem Datenträger an.
+
+Syntax:  DETAIL DISK
+
+Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss ein
+Datenträger ausgewählt sein.
+
+Beispiel:
+
+DETAIL DISK
 .
 Language=Polish
-
+Displays the properties of the selected disk and the list of volumes on
+the disk.
+
+Syntax:  DETAIL DISK
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+DETAIL DISK
 .
 Language=Portugese
-
+Displays the properties of the selected disk and the list of volumes on
+the disk.
+
+Syntax:  DETAIL DISK
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+DETAIL DISK
 .
 Language=Romanian
-
+Displays the properties of the selected disk and the list of volumes on
+the disk.
+
+Syntax:  DETAIL DISK
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+DETAIL DISK
 .
 Language=Russian
-
+Displays the properties of the selected disk and the list of volumes on
+the disk.
+
+Syntax:  DETAIL DISK
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+DETAIL DISK
 .
 Language=Albanian
-
+Displays the properties of the selected disk and the list of volumes on
+the disk.
+
+Syntax:  DETAIL DISK
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+DETAIL DISK
 .
 Language=Turkish
-
+Displays the properties of the selected disk and the list of volumes on
+the disk.
+
+Syntax:  DETAIL DISK
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+DETAIL DISK
 .
 Language=Chinese
-
+Displays the properties of the selected disk and the list of volumes on
+the disk.
+
+Syntax:  DETAIL DISK
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+DETAIL DISK
 .
 Language=Taiwanese
-
+Displays the properties of the selected disk and the list of volumes on
+the disk.
+
+Syntax:  DETAIL DISK
+
+A disk must be selected for this operation to succeed.
+
+Example:
+
+DETAIL DISK
 .
 
 MessageId=10020



[ros-diffs] [reactos] 01/01: [DISKPART] Implements part of the FILESYSTEMS command

2022-06-05 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=be88af54e7382703334efc89f0fccaa45e8dc86e

commit be88af54e7382703334efc89f0fccaa45e8dc86e
Author: Eric Kohl 
AuthorDate: Sun Jun 5 18:23:08 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jun 5 18:23:08 2022 +0200

[DISKPART] Implements part of the FILESYSTEMS command
---
 base/system/diskpart/diskpart_msg.mc | 364 +--
 base/system/diskpart/filesystems.c   |  25 ++-
 base/system/diskpart/lang/de-DE.rc   |   8 +
 base/system/diskpart/lang/en-US.rc   |   8 +
 base/system/diskpart/lang/pl-PL.rc   |   8 +
 base/system/diskpart/lang/pt-PT.rc   |   8 +
 base/system/diskpart/lang/ro-RO.rc   |   8 +
 base/system/diskpart/lang/ru-RU.rc   |   8 +
 base/system/diskpart/lang/sq-AL.rc   |   8 +
 base/system/diskpart/lang/tr-TR.rc   |   8 +
 base/system/diskpart/lang/zh-CN.rc   |   8 +
 base/system/diskpart/lang/zh-TW.rc   |   8 +
 base/system/diskpart/resource.h  |   6 +
 13 files changed, 454 insertions(+), 21 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 248238e30ef..d079e2dc190 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -998,34 +998,266 @@ SymbolicName=MSG_COMMAND_DELETE_PARTITION
 Severity=Informational
 Facility=System
 Language=English
-
+Deletes the partition with focus.
+
+Syntax:  DELETE PARTITION [NOERR] [OVERRIDE]
+
+NOERR   For scripting only. When an error is encountered, DiskPart
+continues to process commands as if the error did not occur.
+Without the NOERR parameter, an error causes DiskPart to exit
+with an error code.
+
+OVERRIDEEnables DiskPart to delete any partition regardless of type.
+Typically, DiskPart only permits you to delete known data
+partitions.
+
+You cannot delete the system partition, boot partition, or any partition
+that contains the active paging file or crash dump (memory dump) filed.
+
+A partition must be selected for this operation to succeed.
+
+Partitions cannot be deleted from dynamic disks or created on dynamic
+disks.
+
+Example:
+
+DELETE PARTITION
 .
 Language=German
-
+Löscht die Partition, die den Fokus hat.
+
+Syntax:  DELETE PARTITION [NOERR] [OVERRIDE]
+
+NOERR   Nur für Skripting. Bei einem Fehler setzt DiskPart die
+Verarbeitung von Befehlen fort, als sei der Fehler nicht
+aufgetreten. Ohne den Parameter NOERR wird DiskPart bei
+einem Fehler mit dem entsprechenden Fehlercode beendet.
+
+OVERRIDEErmöglicht DiskPart das Löschen einer beliebigen Partition
+unabhängig von deren Typ. Normalerweise gestattet DiskPart
+nur das Löschen bekannter Datenpartitionen.
+
+Sie können keine Systempartition, Startpartition oder Partition löschen,
+die eine aktive Auslagerungsdatei oder ein Absturzabbild (Speicherabbild)
+enthält.
+
+Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss eine
+Partition ausgewählt sein.
+
+Partitionen könnnen nicht von dynamischen Datenträgern gelöscht oder auf
+dynamischen Datenträgern erstellt werden.
+
+Example:
+
+DELETE PARTITION
 .
 Language=Polish
-
+Deletes the partition with focus.
+
+Syntax:  DELETE PARTITION [NOERR] [OVERRIDE]
+
+NOERR   For scripting only. When an error is encountered, DiskPart
+continues to process commands as if the error did not occur.
+Without the NOERR parameter, an error causes DiskPart to exit
+with an error code.
+
+OVERRIDEEnables DiskPart to delete any partition regardless of type.
+Typically, DiskPart only permits you to delete known data
+partitions.
+
+You cannot delete the system partition, boot partition, or any partition
+that contains the active paging file or crash dump (memory dump) filed.
+
+A partition must be selected for this operation to succeed.
+
+Partitions cannot be deleted from dynamic disks or created on dynamic
+disks.
+
+Example:
+
+DELETE PARTITION
 .
 Language=Portugese
-
+Deletes the partition with focus.
+
+Syntax:  DELETE PARTITION [NOERR] [OVERRIDE]
+
+NOERR   For scripting only. When an error is encountered, DiskPart
+continues to process commands as if the error did not occur.
+Without the NOERR parameter, an error causes DiskPart to exit
+with an error code.
+
+OVERRIDEEnables DiskPart to delete any partition regardless of type.
+Typically, DiskPart only permits you to delete known data
+partitions.
+
+You cannot delete the system partition, boot partition, or any partition
+that contains the active paging file or crash dump (memory dump) filed.
+
+A partition must be selected

[ros-diffs] [reactos] 01/01: [DISKPART] Add the SET command as a SETID alias

2022-06-05 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d3d5eae19e1f6890e6390fab0d6f8f044bf61835

commit d3d5eae19e1f6890e6390fab0d6f8f044bf61835
Author: Eric Kohl 
AuthorDate: Sun Jun 5 17:36:32 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jun 5 17:36:32 2022 +0200

[DISKPART] Add the SET command as a SETID alias
---
 base/system/diskpart/interpreter.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/base/system/diskpart/interpreter.c 
b/base/system/diskpart/interpreter.c
index 08be9411fdb..34fdd034d68 100644
--- a/base/system/diskpart/interpreter.c
+++ b/base/system/diskpart/interpreter.c
@@ -86,6 +86,7 @@ COMMAND cmds[] =
 {L"SELECT",  L"VOLUME",NULL,SelectVolume,
IDS_HELP_SELECT_VOLUME, MSG_COMMAND_SELECT_VOLUME},
 //{L"SELECT",  L"VDISK", NULL,SelectVirtualDisk,   
IDS_HELP_SELECT_VDISK,  MSG_COMMAND_SELECT_VDISK},
 
+{L"SET", NULL, NULL,setid_main,  
IDS_HELP_SETID, MSG_COMMAND_SETID},
 {L"SETID",   NULL, NULL,setid_main,  
IDS_HELP_SETID, MSG_COMMAND_SETID},
 {L"SHRINK",  NULL, NULL,shrink_main, 
IDS_HELP_SHRINK,MSG_COMMAND_SHRINK},
 



[ros-diffs] [reactos] 01/01: [DISKPART] Implement the OVERRIDE option for the DELETE PARTITION command

2022-06-05 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c70f5033ec01c8a9bed5b71f12b184db135daf95

commit c70f5033ec01c8a9bed5b71f12b184db135daf95
Author: Eric Kohl 
AuthorDate: Sun Jun 5 10:30:55 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jun 5 10:30:55 2022 +0200

[DISKPART] Implement the OVERRIDE option for the DELETE PARTITION command
---
 base/system/diskpart/delete.c   | 46 +
 base/system/diskpart/diskpart.h |  1 +
 2 files changed, 47 insertions(+)

diff --git a/base/system/diskpart/delete.c b/base/system/diskpart/delete.c
index 6841b3d9a27..feb66e58c9a 100644
--- a/base/system/diskpart/delete.c
+++ b/base/system/diskpart/delete.c
@@ -11,6 +11,19 @@
 #define NDEBUG
 #include 
 
+static
+BOOL
+IsKnownPartition(
+_In_ PPARTENTRY PartEntry)
+{
+if (IsRecognizedPartition(PartEntry->PartitionType) ||
+IsContainerPartition(PartEntry->PartitionType))
+return TRUE;
+
+return FALSE;
+}
+
+
 BOOL
 DeleteDisk(
 _In_ INT argc,
@@ -29,6 +42,8 @@ DeletePartition(
 PPARTENTRY NextPartEntry;
 PPARTENTRY LogicalPartEntry;
 PLIST_ENTRY Entry;
+INT i;
+BOOL bOverride = FALSE;
 NTSTATUS Status;
 
 DPRINT("DeletePartition()\n");
@@ -47,6 +62,31 @@ DeletePartition(
 
 ASSERT(CurrentPartition->PartitionType != PARTITION_ENTRY_UNUSED);
 
+for (i = 2; i < argc; i++)
+{
+if (_wcsicmp(argv[i], L"noerr") == 0)
+{
+/* noerr */
+DPRINT("NOERR\n");
+ConPuts(StdOut, L"The NOERR option is not supported yet!\n");
+#if 0
+bNoErr = TRUE;
+#endif
+}
+else if (_wcsicmp(argv[i], L"override") == 0)
+{
+/* noerr */
+DPRINT("OVERRIDE\n");
+bOverride = TRUE;
+}
+else
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+}
+
+
 /* Clear the system partition if it is being deleted */
 #if 0
 if (List->SystemPartition == PartEntry)
@@ -56,6 +96,12 @@ DeletePartition(
 }
 #endif
 
+if ((bOverride == FALSE) && (IsKnownPartition(CurrentPartition) == FALSE))
+{
+ConResPuts(StdOut, IDS_DELETE_PARTITION_FAIL);
+return FALSE;
+}
+
 /* Check which type of partition (primary/logical or extended) is being 
deleted */
 if (CurrentDisk->ExtendedPartition == CurrentPartition)
 {
diff --git a/base/system/diskpart/diskpart.h b/base/system/diskpart/diskpart.h
index 755dc7b44c4..fbf63bc7dc4 100644
--- a/base/system/diskpart/diskpart.h
+++ b/base/system/diskpart/diskpart.h
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 



[ros-diffs] [reactos] 01/01: [DISKPART] Add success and failure messages for the DELETE PARTITION command

2022-06-05 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=58eb4e5bde8df108ab4b91ba319c343257e21204

commit 58eb4e5bde8df108ab4b91ba319c343257e21204
Author: Eric Kohl 
AuthorDate: Sun Jun 5 08:47:22 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Jun 5 08:47:46 2022 +0200

[DISKPART] Add success and failure messages for the DELETE PARTITION command
---
 base/system/diskpart/delete.c  | 10 +-
 base/system/diskpart/lang/de-DE.rc |  6 ++
 base/system/diskpart/lang/en-US.rc |  6 ++
 base/system/diskpart/lang/pl-PL.rc |  6 ++
 base/system/diskpart/lang/pt-PT.rc |  6 ++
 base/system/diskpart/lang/ro-RO.rc |  6 ++
 base/system/diskpart/lang/ru-RU.rc |  6 ++
 base/system/diskpart/lang/sq-AL.rc |  6 ++
 base/system/diskpart/lang/tr-TR.rc |  6 ++
 base/system/diskpart/lang/zh-CN.rc |  6 ++
 base/system/diskpart/lang/zh-TW.rc |  6 ++
 base/system/diskpart/resource.h|  2 ++
 12 files changed, 71 insertions(+), 1 deletion(-)

diff --git a/base/system/diskpart/delete.c b/base/system/diskpart/delete.c
index c17498bd863..6841b3d9a27 100644
--- a/base/system/diskpart/delete.c
+++ b/base/system/diskpart/delete.c
@@ -29,6 +29,7 @@ DeletePartition(
 PPARTENTRY NextPartEntry;
 PPARTENTRY LogicalPartEntry;
 PLIST_ENTRY Entry;
+NTSTATUS Status;
 
 DPRINT("DeletePartition()\n");
 
@@ -139,7 +140,14 @@ DeletePartition(
 CurrentPartition = NULL;
 
 UpdateDiskLayout(CurrentDisk);
-WritePartitions(CurrentDisk);
+Status = WritePartitions(CurrentDisk);
+if (!NT_SUCCESS(Status))
+{
+ConResPuts(StdOut, IDS_DELETE_PARTITION_FAIL);
+return TRUE;
+}
+
+ConResPuts(StdOut, IDS_DELETE_PARTITION_SUCCESS);
 
 return TRUE;
 }
diff --git a/base/system/diskpart/lang/de-DE.rc 
b/base/system/diskpart/lang/de-DE.rc
index 4b7b5a2836d..545a3550203 100644
--- a/base/system/diskpart/lang/de-DE.rc
+++ b/base/system/diskpart/lang/de-DE.rc
@@ -21,6 +21,12 @@ BEGIN
 IDS_CREATE_PARTITION_SUCCESS "\nDie angegebene Partition wurde erfolgreich 
erstellt.\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_DELETE_PARTITION_FAIL "\nDie gewählte Partition konnte nicht gelöscht 
werden.\nVergewissern Sie sich, dass die Partition wirklich gelöscht werden 
kann.\n"
+IDS_DELETE_PARTITION_SUCCESS "\nDer gewählte Partition wurde erfolgreich 
gelöscht.\n"
+END
+
 /* Disk Information Labels */
 STRINGTABLE
 BEGIN
diff --git a/base/system/diskpart/lang/en-US.rc 
b/base/system/diskpart/lang/en-US.rc
index 07f4c0a5fe7..6657371ba78 100644
--- a/base/system/diskpart/lang/en-US.rc
+++ b/base/system/diskpart/lang/en-US.rc
@@ -21,6 +21,12 @@ BEGIN
 IDS_CREATE_PARTITION_SUCCESS "\nDiskPart succeeded in creating the 
specified partition.\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_DELETE_PARTITION_FAIL "\nDiskPart failed to delete the selected 
partition.\nPlease make sure the selected partition is valid to delete.\n"
+IDS_DELETE_PARTITION_SUCCESS "\nDiskPart successfully deleted the selected 
partition.\n"
+END
+
 /* Disk Information Labels */
 STRINGTABLE
 BEGIN
diff --git a/base/system/diskpart/lang/pl-PL.rc 
b/base/system/diskpart/lang/pl-PL.rc
index 662761d248c..296bbf2162b 100644
--- a/base/system/diskpart/lang/pl-PL.rc
+++ b/base/system/diskpart/lang/pl-PL.rc
@@ -21,6 +21,12 @@ BEGIN
 IDS_CREATE_PARTITION_SUCCESS "\nDiskPart succeeded in creating the 
specified partition.\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_DELETE_PARTITION_FAIL "\nDiskPart failed to delete the selected 
partition.\nPlease make sure the selected partition is valid to delete.\n"
+IDS_DELETE_PARTITION_SUCCESS "\nDiskPart successfully deleted the selected 
partition.\n"
+END
+
 /* Disk Information Labels */
 STRINGTABLE
 BEGIN
diff --git a/base/system/diskpart/lang/pt-PT.rc 
b/base/system/diskpart/lang/pt-PT.rc
index 176a551d0e6..fbeb8f17e51 100644
--- a/base/system/diskpart/lang/pt-PT.rc
+++ b/base/system/diskpart/lang/pt-PT.rc
@@ -23,6 +23,12 @@ BEGIN
 IDS_CREATE_PARTITION_SUCCESS "\nDiskPart succeeded in creating the 
specified partition.\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_DELETE_PARTITION_FAIL "\nDiskPart failed to delete the selected 
partition.\nPlease make sure the selected partition is valid to delete.\n"
+IDS_DELETE_PARTITION_SUCCESS "\nDiskPart successfully deleted the selected 
partition.\n"
+END
+
 /* Disk Information Labels */
 STRINGTABLE
 BEGIN
diff --git a/base/system/diskpart/lang/ro-RO.rc 
b/base/system/diskpart/lang/ro-RO.rc
index b867bd0befe..aef9208a70e 100644
--- a/base/system/diskpart/lang/ro-RO.rc
+++ b/base/system/diskpart/lang/ro-RO.rc
@@ -23,6 +23,12 @@ BEGIN
 IDS_CREATE_PARTITION_SUCCESS "\nDiskPart succeeded in creating the 
specified partition.\n"
 END
 
+STRINGTABLE
+BEGIN
+IDS_DELETE_PARTITION_FAIL "\nDiskPart failed to delete the selected 
partition.\nPlease make sure 

[ros-diffs] [reactos] 01/01: [DISKPART] Report success or failure for CREATE PARTITION commands

2022-06-04 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6c797bf86a00e554ca231b235ceed0c5e0e8fcaf

commit 6c797bf86a00e554ca231b235ceed0c5e0e8fcaf
Author: Eric Kohl 
AuthorDate: Sat Jun 4 20:27:11 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 4 20:27:11 2022 +0200

[DISKPART] Report success or failure for CREATE PARTITION commands
---
 base/system/diskpart/create.c|  42 +-
 base/system/diskpart/diskpart_msg.mc | 261 +--
 base/system/diskpart/lang/de-DE.rc   |   6 +
 base/system/diskpart/lang/en-US.rc   |   6 +
 base/system/diskpart/lang/pl-PL.rc   |   6 +
 base/system/diskpart/lang/pt-PT.rc   |   6 +
 base/system/diskpart/lang/ro-RO.rc   |   6 +
 base/system/diskpart/lang/ru-RU.rc   |   6 +
 base/system/diskpart/lang/sq-AL.rc   |   6 +
 base/system/diskpart/lang/tr-TR.rc   |   6 +
 base/system/diskpart/lang/zh-CN.rc   |   6 +
 base/system/diskpart/lang/zh-TW.rc   |   6 +
 base/system/diskpart/resource.h  |   4 +
 13 files changed, 353 insertions(+), 14 deletions(-)

diff --git a/base/system/diskpart/create.c b/base/system/diskpart/create.c
index 9617b7c4e60..52526573d85 100644
--- a/base/system/diskpart/create.c
+++ b/base/system/diskpart/create.c
@@ -27,6 +27,7 @@ CreateExtendedPartition(
 #endif
 INT i;
 PWSTR pszSuffix = NULL;
+NTSTATUS Status;
 
 if (CurrentDisk == NULL)
 {
@@ -128,6 +129,7 @@ CreateExtendedPartition(
 PartEntry->FormatState = Unformatted;
 PartEntry->FileSystemName[0] = L'\0';
 
+CurrentPartition = PartEntry;
 CurrentDisk->Dirty = TRUE;
 }
 else
@@ -140,6 +142,7 @@ CreateExtendedPartition(
 PartEntry->FormatState = Unformatted;
 PartEntry->FileSystemName[0] = L'\0';
 
+CurrentPartition = PartEntry;
 CurrentDisk->Dirty = TRUE;
 }
 else if (PartEntry->SectorCount.QuadPart > ullSectorCount)
@@ -168,12 +171,21 @@ CreateExtendedPartition(
 
 InsertTailList(ListEntry, >ListEntry);
 
+CurrentPartition = NewPartEntry;
 CurrentDisk->Dirty = TRUE;
 }
 }
 
 UpdateDiskLayout(CurrentDisk);
-WritePartitions(CurrentDisk);
+Status = WritePartitions(CurrentDisk);
+if (!NT_SUCCESS(Status))
+{
+ConResPuts(StdOut, IDS_CREATE_PARTITION_FAIL);
+CurrentPartition = NULL;
+return TRUE;
+}
+
+ConResPuts(StdOut, IDS_CREATE_PARTITION_SUCCESS);
 
 return TRUE;
 }
@@ -195,6 +207,7 @@ CreateLogicalPartition(
 UCHAR PartitionType = 6;
 INT i, length;
 PWSTR pszSuffix = NULL;
+NTSTATUS Status;
 
 if (CurrentDisk == NULL)
 {
@@ -312,6 +325,7 @@ CreateLogicalPartition(
 PartEntry->FormatState = Unformatted;
 PartEntry->FileSystemName[0] = L'\0';
 
+CurrentPartition = PartEntry;
 CurrentDisk->Dirty = TRUE;
 break;
 }
@@ -325,6 +339,7 @@ CreateLogicalPartition(
 PartEntry->FormatState = Unformatted;
 PartEntry->FileSystemName[0] = L'\0';
 
+CurrentPartition = PartEntry;
 CurrentDisk->Dirty = TRUE;
 break;
 }
@@ -354,6 +369,7 @@ CreateLogicalPartition(
 
 InsertTailList(ListEntry, >ListEntry);
 
+CurrentPartition = NewPartEntry;
 CurrentDisk->Dirty = TRUE;
 break;
 }
@@ -361,7 +377,15 @@ CreateLogicalPartition(
 }
 
 UpdateDiskLayout(CurrentDisk);
-WritePartitions(CurrentDisk);
+Status = WritePartitions(CurrentDisk);
+if (!NT_SUCCESS(Status))
+{
+ConResPuts(StdOut, IDS_CREATE_PARTITION_FAIL);
+CurrentPartition = NULL;
+return TRUE;
+}
+
+ConResPuts(StdOut, IDS_CREATE_PARTITION_SUCCESS);
 
 return TRUE;
 }
@@ -383,6 +407,7 @@ CreatePrimaryPartition(
 UCHAR PartitionType = 6;
 INT i, length;
 PWSTR pszSuffix = NULL;
+NTSTATUS Status;
 
 if (CurrentDisk == NULL)
 {
@@ -506,6 +531,7 @@ CreatePrimaryPartition(
 PartEntry->FormatState = Unformatted;
 PartEntry->FileSystemName[0] = L'\0';
 
+CurrentPartition = PartEntry;
 CurrentDisk->Dirty = TRUE;
 break;
 }
@@ -519,6 +545,7 @@ CreatePrimaryPartition(
 PartEntry->FormatState = Unformatted;
 PartEntry->FileSystemName[0] = L'\0';
 
+CurrentPartition = PartEntry;
 CurrentDisk->Dirty = TRUE;
 break;
 }
@@ -548,6 +575,7 @@ CreatePrimaryPartition(
 
 InsertTailList(ListEntry, >ListEntry);
 
+CurrentPartition = NewPartEntry;
 CurrentDisk->Dirty = TRUE;
 break;
 }
@@ -555,7 +583,15 @@ CreatePrimaryPartition(
 }
 
 UpdateDiskLayout(CurrentDisk)

[ros-diffs] [reactos] 01/01: [DISKPART] Add help texts for the ACTIVE and INACTIVE commands

2022-06-04 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e636b14d7ec29c4ec9c471a39ade4181f97d845d

commit e636b14d7ec29c4ec9c471a39ade4181f97d845d
Author: Eric Kohl 
AuthorDate: Sat Jun 4 13:36:17 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 4 13:36:17 2022 +0200

[DISKPART] Add help texts for the ACTIVE and INACTIVE commands
---
 base/system/diskpart/diskpart_msg.mc | 454 +--
 1 file changed, 434 insertions(+), 20 deletions(-)

diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index d635439fcd1..ea90f9d9a6a 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -28,34 +28,245 @@ SymbolicName=MSG_COMMAND_ACTIVE
 Severity=Informational
 Facility=System
 Language=English
-
+On disks with master boot record (MBR) disk formatting, marks
+the partition with focus as active.
+
+Syntax:  ACTIVE
+
+Writes a value to the disk which is read by the basic input/output
+system (BIOS) at boot. This value specifies that the partition is
+a valid system partition.
+
+A partition must be selected for this operation to succeed.
+
+Caution:
+
+DiskPart verifies only that the partition is capable of containing the
+operating system startup files. DiskPart does not check the contents of
+the partition. If you mistakenly mark a partition as active and it does
+not contain the operating system startup files, your computer might not
+start.
+
+Example:
+
+ACTIVE
 .
 Language=German
-
+Markiert auf Datenträgern mit MBR-Datenträgerformat (Master Boot
+Record) die Partition, die den Fokus hat, als aktive Partition.
+
+Syntax:  ACTIVE
+
+Schreibt einen Wert auf den Datenträger, der Beim Start vom BIOS
+(Basic Input/Output System) gelesen wird. Durch diesen Wert wird
+angegeben, dass die Partition eine gültige Systempartition ist.
+
+Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss eine
+Partition ausgewählt sein.
+
+Vorsicht:
+
+DiskPart überprüft nur, ob die Partition in der Lage ist, die
+Startdateien des Betriebssystems aufzunehmen. Der Inhalt der Partition
+wird hierbei nicht überprüft. Falls versehentlich eine Partition als
+aktiv markiert wird, die nicht die Startdateien des Betriebssystems
+enthält, kann der Computer möglicherweise nicht gestartet werden.
+
+Beispiel:
+
+ACTIVE
 .
 Language=Polish
-
+On disks with master boot record (MBR) disk formatting, marks
+the partition with focus as active.
+
+Syntax:  ACTIVE
+
+Writes a value to the disk which is read by the basic input/output
+system (BIOS) at boot. This value specifies that the partition is
+a valid system partition.
+
+A partition must be selected for this operation to succeed.
+
+Caution:
+
+DiskPart verifies only that the partition is capable of containing the
+operating system startup files. DiskPart does not check the contents of
+the partition. If you mistakenly mark a partition as active and it does
+not contain the operating system startup files, your computer might not
+start.
+
+Example:
+
+ACTIVE
 .
 Language=Portugese
-
+On disks with master boot record (MBR) disk formatting, marks
+the partition with focus as active.
+
+Syntax:  ACTIVE
+
+Writes a value to the disk which is read by the basic input/output
+system (BIOS) at boot. This value specifies that the partition is
+a valid system partition.
+
+A partition must be selected for this operation to succeed.
+
+Caution:
+
+DiskPart verifies only that the partition is capable of containing the
+operating system startup files. DiskPart does not check the contents of
+the partition. If you mistakenly mark a partition as active and it does
+not contain the operating system startup files, your computer might not
+start.
+
+Example:
+
+ACTIVE
 .
 Language=Romanian
-
+On disks with master boot record (MBR) disk formatting, marks
+the partition with focus as active.
+
+Syntax:  ACTIVE
+
+Writes a value to the disk which is read by the basic input/output
+system (BIOS) at boot. This value specifies that the partition is
+a valid system partition.
+
+A partition must be selected for this operation to succeed.
+
+Caution:
+
+DiskPart verifies only that the partition is capable of containing the
+operating system startup files. DiskPart does not check the contents of
+the partition. If you mistakenly mark a partition as active and it does
+not contain the operating system startup files, your computer might not
+start.
+
+Example:
+
+ACTIVE
 .
 Language=Russian
-
+On disks with master boot record (MBR) disk formatting, marks
+the partition with focus as active.
+
+Syntax:  ACTIVE
+
+Writes a value to the disk

[ros-diffs] [reactos] 01/01: [DISKPART] German translation part 1

2022-06-04 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f3ff7ddd092cb4c8b983fc34c8a8d4af5ba81f26

commit f3ff7ddd092cb4c8b983fc34c8a8d4af5ba81f26
Author: Eric Kohl 
AuthorDate: Sat Jun 4 11:44:57 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Jun 4 11:44:57 2022 +0200

[DISKPART] German translation part 1
---
 base/system/diskpart/lang/de-DE.rc | 124 ++---
 1 file changed, 62 insertions(+), 62 deletions(-)

diff --git a/base/system/diskpart/lang/de-DE.rc 
b/base/system/diskpart/lang/de-DE.rc
index ab80dc0022a..85a656dd066 100644
--- a/base/system/diskpart/lang/de-DE.rc
+++ b/base/system/diskpart/lang/de-DE.rc
@@ -105,74 +105,74 @@ END
 /* Help Command Descriptions */
 STRINGTABLE
 BEGIN
-IDS_HELP_ACTIVE"Mark the selected partition as 
active.\n"
-IDS_HELP_ADD   "Add a mirror to a simple volume.\n"
-IDS_HELP_ASSIGN"Assign a drive letter or mount point 
to the selected volume.\n"
-IDS_HELP_ATTACH"Attaches a virtual disk file.\n"
-IDS_HELP_ATTRIBUTES"Manipulate volume or disk 
attributes.\n"
-IDS_HELP_AUTOMOUNT "Enable and Disable automatic mounting 
of basic volumes.\n"
-IDS_HELP_BREAK "Break a mirror set.\n"
-IDS_HELP_CLEAN "Clear the configuration information, 
or all information, off\n  the disk.\n"
-IDS_HELP_COMPACT   "Attempts to reduce the physical size 
of the file.\n"
-IDS_HELP_CONVERT   "Convert between different disk 
formats.\n"
-
-IDS_HELP_CREATE"Create a volume, partition, or virtual 
disk.\n"
-IDS_HELP_CREATE_PARTITION  "Create a partition.\n"
-IDS_HELP_CREATE_PARTITION_EFI  "Create an EFI system partition.\n"
-IDS_HELP_CREATE_PARTITION_EXTENDED "Create an extended partition.\n"
-IDS_HELP_CREATE_PARTITION_LOGICAL  "Create a logical drive.\n"
-IDS_HELP_CREATE_PARTITION_MSR  "Create an MSR partition.\n"
-IDS_HELP_CREATE_PARTITION_PRIMARY  "Create a primary partition.\n"
-IDS_HELP_CREATE_VOLUME "Create a volume.\n"
-IDS_HELP_CREATE_VDISK  "Create a virtual disk file.\n"
-
-IDS_HELP_DELETE"Delete an object.\n"
-IDS_HELP_DELETE_DISK   "Delete a disk.\n"
-IDS_HELP_DELETE_PARTITION  "Delete a partition.\n"
-IDS_HELP_DELETE_VOLUME "Delete a volume.\n"
-
-IDS_HELP_DETACH"Detaches a virtual disk file.\n"
-
-IDS_HELP_DETAIL"Provide details about an object.\n"
-IDS_HELP_DETAIL_DISK   "Print disk details.\n"
-IDS_HELP_DETAIL_PARTITION  "Print partition details.\n"
-IDS_HELP_DETAIL_VOLUME "Print volume details.\n"
-
-IDS_HELP_EXIT  "Exit DiskPart.\n"
-IDS_HELP_EXPAND"Expands the maximum size available on 
a virtual disk.\n"
-IDS_HELP_EXTEND"Extend a volume.\n"
-IDS_HELP_FILESYSTEMS   "Display current and supported file 
systems on the volume.\n"
-IDS_HELP_FORMAT"Format the volume or partition.\n"
-IDS_HELP_GPT   "Assign attributes to the selected GPT 
partition.\n"
-IDS_HELP_HELP  "Display a list of commands.\n"
-IDS_HELP_IMPORT"Import a disk group.\n"
-IDS_HELP_INACTIVE  "Mark the selected partition as 
inactive.\n"
-
-IDS_HELP_LIST  "Display a list of objects.\n"
-IDS_HELP_LIST_DISK "List disks.\n"
-IDS_HELP_LIST_PARTITION"List partitions.\n"
-IDS_HELP_LIST_VOLUME   "List volumes.\n"
-IDS_HELP_LIST_VDISK"List virtual disk files.\n"
-
-IDS_HELP_MERGE "Merges a child disk with its 
parents.\n"
-IDS_HELP_OFFLINE   "Offline an object that is currently 
marked as online.\n"
-IDS_HELP_ONLINE"Online an object that is currently 
marked as offline.\n"
+IDS_HELP_ACTIVE"Markiert die ausgewählte Partition als 
aktiv.\n"
+IDS_HELP_ADD   "Fügt eine Spiegelung einem einfachen 
Volume hinzu.\n"
+IDS_HELP_ASSIGN"Weist dem gewählten Volume einen 
Laufwerksbuchstaben oder\n

[ros-diffs] [reactos] 01/01: [DISKPART] Add german translation

2022-06-01 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a3a8fdc84bcbbce27e8f0cf51ff3303fa524a9e1

commit a3a8fdc84bcbbce27e8f0cf51ff3303fa524a9e1
Author: Eric Kohl 
AuthorDate: Wed Jun 1 23:25:54 2022 +0200
Commit: Eric Kohl 
CommitDate: Wed Jun 1 23:25:54 2022 +0200

[DISKPART] Add german translation
---
 base/system/diskpart/diskpart.rc |   3 +
 base/system/diskpart/diskpart_msg.mc | 314 +--
 base/system/diskpart/lang/de-DE.rc   | 187 +
 3 files changed, 486 insertions(+), 18 deletions(-)

diff --git a/base/system/diskpart/diskpart.rc b/base/system/diskpart/diskpart.rc
index f0d1dd71690..7bc1272ae2a 100644
--- a/base/system/diskpart/diskpart.rc
+++ b/base/system/diskpart/diskpart.rc
@@ -16,6 +16,9 @@
 #ifdef LANGUAGE_EN_US
 #include "lang/en-US.rc"
 #endif
+#ifdef LANGUAGE_DE_DE
+#include "lang/de-DE.rc"
+#endif
 #ifdef LANGUAGE_PL_PL
 #include "lang/pl-PL.rc"
 #endif
diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
index 669998227fd..d635439fcd1 100644
--- a/base/system/diskpart/diskpart_msg.mc
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -11,6 +11,7 @@ FacilityNames=(System=0x0:FACILITY_SYSTEM
   )
 
 LanguageNames=(English=0x409:MSG00409
+   German=0x407:MSG00407
Polish=0x415:MSG00415
Portugese=0x816:MSG00416
Romanian=0x418:MSG00418
@@ -29,6 +30,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -62,6 +66,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -95,6 +102,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -128,6 +138,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -161,6 +174,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -194,6 +210,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -228,6 +247,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -261,6 +283,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -294,6 +319,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -327,6 +355,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -360,6 +391,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -393,6 +427,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -426,6 +463,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -459,6 +499,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -492,6 +535,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -525,6 +571,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -558,6 +607,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -591,6 +643,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -624,6 +679,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -656,6 +714,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -688,6 +749,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -721,6 +785,9 @@ Facility=System
 Language=English
 
 .
+Language=German
+
+.
 Language=Polish
 
 .
@@ -752,31 +819,94 @@ SymbolicName=MSG_COMMAND_EXIT
 Severity=Informational
 Facility=System
 Language=English
-
+Exits the DiskPart command interpreter.
+
+Syntax:  EXIT
+
+Example:
+
+EXIT
+.
+Language=German
+Beendet den Befehlsinterpreter DiskPart.
+
+Syntax:  EXIT
+
+Beispiel:
+
+EXIT
 .
 Language=Polish
-
+Exits the DiskPart command interpreter.
+
+Syntax:  EXIT
+
+Example:
+
+EXIT
 .
 Language=Portugese
-
+Exits the DiskPart command interpreter.
+
+Syntax:  EXIT
+
+Example:
+
+EXIT
 .
 Language=Romanian
-
+Exits the DiskPart command interpreter.
+
+Syntax:  EXIT
+
+Example:
+
+EXIT
 .
 Language=Russian
-
+Exits the DiskPart command interpreter.
+
+Syntax:  EXIT
+
+Example:
+
+EXIT
 .
 Language=Albanian
-
+Exits the DiskPart command interpreter.
+
+Syntax:  EXIT
+
+Example:
+
+EXIT
 .
 Language=Turkish
-
+Exits the DiskPart command interpreter.
+
+Syntax:  EXIT
+
+Example:
+
+EXIT
 .
 Language=Chinese
-
+Exits the DiskPart command interpreter.
+
+Syntax:  EXIT
+
+Example:
+
+EXIT
 .
 Language=Taiwanese
-
+Exits the DiskPart command interpreter.
+
+Syntax:  EXIT
+
+Example:
+
+EXIT
 .
 
 
@@ -787,6 +917,9 @@ Facility=System
 Language=English
 
 .
+

[ros-diffs] [reactos] 01/01: [DISKPART] Get rid of PrintMessageString()

2022-05-31 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ca51f000495325be75153238309cd4595a1e6d0a

commit ca51f000495325be75153238309cd4595a1e6d0a
Author: Eric Kohl 
AuthorDate: Wed Jun 1 00:46:45 2022 +0200
Commit: Eric Kohl 
CommitDate: Wed Jun 1 00:46:45 2022 +0200

[DISKPART] Get rid of PrintMessageString()
---
 base/system/diskpart/diskpart.h |  4 
 base/system/diskpart/help.c | 12 ++--
 base/system/diskpart/misc.c | 12 
 3 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/base/system/diskpart/diskpart.h b/base/system/diskpart/diskpart.h
index e3b4c247861..755dc7b44c4 100644
--- a/base/system/diskpart/diskpart.h
+++ b/base/system/diskpart/diskpart.h
@@ -392,10 +392,6 @@ RoundingDivide(
 _In_ ULONGLONG Dividend,
 _In_ ULONGLONG Divisor);
 
-VOID
-PrintMessageString(
-_In_ DWORD dwMessage);
-
 /* offline.c */
 BOOL offline_main(INT argc, LPWSTR *argv);
 
diff --git a/base/system/diskpart/help.c b/base/system/diskpart/help.c
index f2a23960ae0..2caf271e5f2 100644
--- a/base/system/diskpart/help.c
+++ b/base/system/diskpart/help.c
@@ -89,7 +89,11 @@ HelpCommand(
 (wcsicmp(pCommand->cmd3, cmdptr->cmd3) == 0) &&
 (cmdptr->help_detail != MSG_NONE))
 {
-PrintMessageString(cmdptr->help_detail);
+ConMsgPuts(StdOut,
+   FORMAT_MESSAGE_FROM_HMODULE,
+   NULL,
+   cmdptr->help_detail,
+   LANG_USER_DEFAULT);
 bSubCommands = TRUE;
 }
 }
@@ -97,7 +101,11 @@ HelpCommand(
 
 if ((bSubCommands == FALSE) && (pCommand->help_detail != MSG_NONE))
 {
-PrintMessageString(pCommand->help_detail);
+ConMsgPuts(StdOut,
+   FORMAT_MESSAGE_FROM_HMODULE,
+   NULL,
+   pCommand->help_detail,
+   LANG_USER_DEFAULT);
 }
 
 ConPuts(StdOut, L"\n");
diff --git a/base/system/diskpart/misc.c b/base/system/diskpart/misc.c
index ddb2946a840..b46651b670b 100644
--- a/base/system/diskpart/misc.c
+++ b/base/system/diskpart/misc.c
@@ -78,15 +78,3 @@ RoundingDivide(
 {
 return (Dividend + Divisor / 2) / Divisor;
 }
-
-
-VOID
-PrintMessageString(
-_In_ DWORD dwMessage)
-{
-ConMsgPuts(StdOut,
-   FORMAT_MESSAGE_FROM_HMODULE,
-   NULL, //hModuleNetMsg,
-   dwMessage,
-   LANG_USER_DEFAULT);
-}



[ros-diffs] [reactos] 01/01: [DISKPART] Convert command help to messages and fix some texts

2022-05-29 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c287c08b278bb9f8998dbde0f5a21254eaf752c6

commit c287c08b278bb9f8998dbde0f5a21254eaf752c6
Author: Eric Kohl 
AuthorDate: Mon May 30 01:09:08 2022 +0200
Commit: Eric Kohl 
CommitDate: Mon May 30 01:09:08 2022 +0200

[DISKPART] Convert command help to messages and fix some texts
---
 base/system/diskpart/CMakeLists.txt  |1 +
 base/system/diskpart/detail.c|4 +-
 base/system/diskpart/diskpart.h  |5 +-
 base/system/diskpart/diskpart.rc |2 +
 base/system/diskpart/diskpart_msg.mc | 1736 ++
 base/system/diskpart/help.c  |8 +-
 base/system/diskpart/interpreter.c   |  155 +--
 base/system/diskpart/lang/en-US.rc   |  250 +
 base/system/diskpart/lang/pl-PL.rc   |  248 +
 base/system/diskpart/lang/pt-PT.rc   |  248 +
 base/system/diskpart/lang/ro-RO.rc   |  248 +
 base/system/diskpart/lang/ru-RU.rc   |  248 +
 base/system/diskpart/lang/sq-AL.rc   |  248 +
 base/system/diskpart/lang/tr-TR.rc   |  248 +
 base/system/diskpart/lang/zh-CN.rc   |  248 +
 base/system/diskpart/lang/zh-TW.rc   |  248 +
 base/system/diskpart/misc.c  |   23 +
 base/system/diskpart/resource.h  |   58 +-
 18 files changed, 1891 insertions(+), 2335 deletions(-)

diff --git a/base/system/diskpart/CMakeLists.txt 
b/base/system/diskpart/CMakeLists.txt
index 0c0c9977947..7f31e513b4f 100644
--- a/base/system/diskpart/CMakeLists.txt
+++ b/base/system/diskpart/CMakeLists.txt
@@ -55,4 +55,5 @@ if(MSVC)
 endif()
 
 add_pch(diskpart diskpart.h SOURCE)
+add_message_headers(UNICODE diskpart_msg.mc)
 add_cd_file(TARGET diskpart DESTINATION reactos/system32 FOR all)
diff --git a/base/system/diskpart/detail.c b/base/system/diskpart/detail.c
index 388cb8a45af..9182a7a46ab 100644
--- a/base/system/diskpart/detail.c
+++ b/base/system/diskpart/detail.c
@@ -186,7 +186,7 @@ DetailPartition(
 }
 
 if (bVolumeFound == FALSE)
-ConPuts(StdOut, L"\nThere is no volume associated with this 
partition.\n");
+ConResPuts(StdOut, IDS_DETAIL_NO_VOLUME);
 
 ConPuts(StdOut, L"\n");
 
@@ -241,7 +241,7 @@ DetailVolume(
 }
 
 if (bDiskFound == FALSE)
-ConPuts(StdOut, L"\nThere are no disks attached to this volume.\n");
+ConResPuts(StdOut, IDS_DETAIL_NO_DISKS);
 
 /* TODO: Print more volume details */
 
diff --git a/base/system/diskpart/diskpart.h b/base/system/diskpart/diskpart.h
index c4a4c2fad9e..e3b4c247861 100644
--- a/base/system/diskpart/diskpart.h
+++ b/base/system/diskpart/diskpart.h
@@ -57,7 +57,7 @@ typedef struct _COMMAND
 PWSTR cmd3;
 BOOL (*func)(INT, WCHAR**);
 INT help;
-INT help_detail;
+DWORD help_detail;
 } COMMAND, *PCOMMAND;
 
 extern COMMAND cmds[];
@@ -392,6 +392,9 @@ RoundingDivide(
 _In_ ULONGLONG Dividend,
 _In_ ULONGLONG Divisor);
 
+VOID
+PrintMessageString(
+_In_ DWORD dwMessage);
 
 /* offline.c */
 BOOL offline_main(INT argc, LPWSTR *argv);
diff --git a/base/system/diskpart/diskpart.rc b/base/system/diskpart/diskpart.rc
index a1df42efce4..f0d1dd71690 100644
--- a/base/system/diskpart/diskpart.rc
+++ b/base/system/diskpart/diskpart.rc
@@ -8,6 +8,8 @@
 #define REACTOS_STR_ORIGINAL_COPYRIGHT "(C) 2011 Lee Schroeder"
 #include 
 
+#include 
+
 /* UTF-8 */
 #pragma code_page(65001)
 
diff --git a/base/system/diskpart/diskpart_msg.mc 
b/base/system/diskpart/diskpart_msg.mc
new file mode 100644
index 000..669998227fd
--- /dev/null
+++ b/base/system/diskpart/diskpart_msg.mc
@@ -0,0 +1,1736 @@
+
+MessageIdTypedef=DWORD
+
+SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS
+   Informational=0x1:STATUS_SEVERITY_INFORMATIONAL
+   Warning=0x2:STATUS_SEVERITY_WARNING
+   Error=0x3:STATUS_SEVERITY_ERROR
+  )
+
+FacilityNames=(System=0x0:FACILITY_SYSTEM
+  )
+
+LanguageNames=(English=0x409:MSG00409
+   Polish=0x415:MSG00415
+   Portugese=0x816:MSG00416
+   Romanian=0x418:MSG00418
+   Russian=0x419:MSG00419
+   Albanian=0x41C:MSG0041C
+   Turkish=0x41F:MSG0041F
+   Chinese=0x804:MSG00804
+   Taiwanese=0x404:MSG00404
+  )
+
+
+MessageId=1
+SymbolicName=MSG_COMMAND_ACTIVE
+Severity=Informational
+Facility=System
+Language=English
+
+.
+Language=Polish
+
+.
+Language=Portugese
+
+.
+Language=Romanian
+
+.
+Language=Russian
+
+.
+Language=Albanian
+
+.
+Language=Turkish
+
+.
+Language=Chinese
+
+.
+Language=Taiwanese
+
+.
+
+
+MessageId=10001
+SymbolicName=MSG_COMMAND_ADD
+Severity=Informational
+Facility=System
+Language=English
+
+.
+Language=Polish
+
+.
+Language=Portugese
+
+.
+Language=Romanian
+
+.
+Language=Russian
+
+.
+Language=Albanian
+
+.
+Language=Turkish
+
+.
+Language=Chinese
+
+.
+Language=Taiwanese
+
+.
+
+
+MessageId=10002
+SymbolicName=MSG_COMMAND_ASSIGN
+Severity=

[ros-diffs] [reactos] 01/01: [DISKPART] Improve DETAIL commands

2022-05-29 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=54efd758891980351e73738a21432f7c9b01b223

commit 54efd758891980351e73738a21432f7c9b01b223
Author: Eric Kohl 
AuthorDate: Sun May 29 17:32:34 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun May 29 17:32:34 2022 +0200

[DISKPART] Improve DETAIL commands
---
 base/system/diskpart/detail.c   | 152 --
 base/system/diskpart/diskpart.h |   8 ++
 base/system/diskpart/list.c | 178 ++--
 3 files changed, 249 insertions(+), 89 deletions(-)

diff --git a/base/system/diskpart/detail.c b/base/system/diskpart/detail.c
index 0c0de3e262a..388cb8a45af 100644
--- a/base/system/diskpart/detail.c
+++ b/base/system/diskpart/detail.c
@@ -13,11 +13,66 @@
 
 /* FUNCTIONS 
**/
 
+static
+BOOL
+IsDiskInVolume(
+_In_ PVOLENTRY VolumeEntry,
+_In_ PDISKENTRY DiskEntry)
+{
+ULONG i;
+
+if ((VolumeEntry == NULL) ||
+(VolumeEntry->pExtents == NULL) ||
+(DiskEntry == NULL))
+return FALSE;
+
+for (i = 0; i < VolumeEntry->pExtents->NumberOfDiskExtents; i++)
+{
+if (VolumeEntry->pExtents->Extents[i].DiskNumber == 
DiskEntry->DiskNumber)
+return TRUE;
+}
+
+return FALSE;
+}
+
+
+static
+BOOL
+IsPartitionInVolume(
+_In_ PVOLENTRY VolumeEntry,
+_In_ PPARTENTRY PartEntry)
+{
+ULONG i;
+
+if ((VolumeEntry == NULL) ||
+(VolumeEntry->pExtents == NULL) ||
+(PartEntry == NULL) ||
+(PartEntry->DiskEntry == NULL))
+return FALSE;
+
+for (i = 0; i < VolumeEntry->pExtents->NumberOfDiskExtents; i++)
+{
+if (VolumeEntry->pExtents->Extents[i].DiskNumber == 
PartEntry->DiskEntry->DiskNumber)
+{
+if ((VolumeEntry->pExtents->Extents[i].StartingOffset.QuadPart == 
PartEntry->StartSector.QuadPart * PartEntry->DiskEntry->BytesPerSector) &&
+(VolumeEntry->pExtents->Extents[i].ExtentLength.QuadPart == 
PartEntry->SectorCount.QuadPart * PartEntry->DiskEntry->BytesPerSector))
+return TRUE;
+}
+}
+
+return FALSE;
+}
+
+
 BOOL
 DetailDisk(
-INT argc,
-PWSTR *argv)
+_In_ INT argc,
+_In_ PWSTR *argv)
 {
+PLIST_ENTRY Entry;
+PVOLENTRY VolumeEntry;
+BOOL bPrintHeader = TRUE;
+
 DPRINT("DetailDisk()\n");
 
 if (argc > 2)
@@ -38,6 +93,28 @@ DetailDisk(
 ConResPrintf(StdOut, IDS_DETAIL_INFO_PATH, CurrentDisk->PathId);
 ConResPrintf(StdOut, IDS_DETAIL_INFO_TARGET, CurrentDisk->TargetId);
 ConResPrintf(StdOut, IDS_DETAIL_INFO_LUN_ID, CurrentDisk->Lun);
+
+Entry = VolumeListHead.Flink;
+while (Entry != )
+{
+VolumeEntry = CONTAINING_RECORD(Entry, VOLENTRY, ListEntry);
+
+if (IsDiskInVolume(VolumeEntry, CurrentDisk))
+{
+if (bPrintHeader)
+{
+ConPuts(StdOut, L"\n");
+ConResPuts(StdOut, IDS_LIST_VOLUME_HEAD);
+ConResPuts(StdOut, IDS_LIST_VOLUME_LINE);
+bPrintHeader = FALSE;
+}
+
+PrintVolume(VolumeEntry);
+}
+
+Entry = Entry->Flink;
+}
+
 ConPuts(StdOut, L"\n");
 
 return TRUE;
@@ -46,11 +123,14 @@ DetailDisk(
 
 BOOL
 DetailPartition(
-INT argc,
-PWSTR *argv)
+_In_ INT argc,
+_In_ PWSTR *argv)
 {
 PPARTENTRY PartEntry;
 ULONGLONG PartOffset;
+PLIST_ENTRY Entry;
+PVOLENTRY VolumeEntry;
+BOOL bVolumeFound = FALSE, bPrintHeader = TRUE;
 
 DPRINT("DetailPartition()\n");
 
@@ -82,6 +162,32 @@ DetailPartition(
 ConResPrintf(StdOut, IDS_DETAIL_PARTITION_HIDDEN, "");
 ConResPrintf(StdOut, IDS_DETAIL_PARTITION_ACTIVE, PartEntry->BootIndicator 
? L"Yes" : L"No");
 ConResPrintf(StdOut, IDS_DETAIL_PARTITION_OFFSET, PartOffset);
+
+Entry = VolumeListHead.Flink;
+while (Entry != )
+{
+VolumeEntry = CONTAINING_RECORD(Entry, VOLENTRY, ListEntry);
+
+if (IsPartitionInVolume(VolumeEntry, CurrentPartition))
+{
+if (bPrintHeader)
+{
+ConPuts(StdOut, L"\n");
+ConResPuts(StdOut, IDS_LIST_VOLUME_HEAD);
+ConResPuts(StdOut, IDS_LIST_VOLUME_LINE);
+bPrintHeader = FALSE;
+}
+
+PrintVolume(VolumeEntry);
+bVolumeFound = TRUE;
+}
+
+Entry = Entry->Flink;
+}
+
+if (bVolumeFound == FALSE)
+ConPuts(StdOut, L"\nThere is no volume associated with this 
partition.\n");
+
 ConPuts(StdOut, L"\n");
 
 return TRUE;
@@ -90,9 +196,13 @@ DetailPartition(
 
 BOOL
 DetailVolume(
-INT argc,
-PWSTR *argv)
+_In_ INT argc,
+_In_ 

[ros-diffs] [reactos] 01/01: [DISKPART] Silence a debug message

2022-05-29 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=96d137a559c985f576b05e4942f1ce9d35dc5474

commit 96d137a559c985f576b05e4942f1ce9d35dc5474
Author: Eric Kohl 
AuthorDate: Sun May 29 13:07:53 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun May 29 13:07:53 2022 +0200

[DISKPART] Silence a debug message
---
 base/system/diskpart/partlist.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/base/system/diskpart/partlist.c b/base/system/diskpart/partlist.c
index 038557a4133..8d27b585ecc 100644
--- a/base/system/diskpart/partlist.c
+++ b/base/system/diskpart/partlist.c
@@ -1315,8 +1315,7 @@ AddVolumeToList(
 IO_STATUS_BLOCK Iosb;
 NTSTATUS Status;
 
-
-ConPrintf(StdOut, L"AddVolumeToList(%s)\n", pszVolumeName);
+DPRINT("AddVolumeToList(%S)\n", pszVolumeName);
 
 VolumeEntry = RtlAllocateHeap(RtlGetProcessHeap(),
   HEAP_ZERO_MEMORY,



[ros-diffs] [reactos] 01/01: [DISKPART] Improve the LIST VOLUME command

2022-05-29 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5a1c00c1178b79f550aed0430c8e26f4892032fa

commit 5a1c00c1178b79f550aed0430c8e26f4892032fa
Author: Eric Kohl 
AuthorDate: Sun May 29 12:41:42 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun May 29 12:41:42 2022 +0200

[DISKPART] Improve the LIST VOLUME command
---
 base/system/diskpart/diskpart.h|  12 ++-
 base/system/diskpart/lang/en-US.rc |   6 +-
 base/system/diskpart/lang/pl-PL.rc |   6 +-
 base/system/diskpart/lang/pt-PT.rc |   6 +-
 base/system/diskpart/lang/ro-RO.rc |   6 +-
 base/system/diskpart/lang/ru-RU.rc |   6 +-
 base/system/diskpart/lang/sq-AL.rc |   6 +-
 base/system/diskpart/lang/tr-TR.rc |   6 +-
 base/system/diskpart/lang/zh-CN.rc |   6 +-
 base/system/diskpart/lang/zh-TW.rc |   6 +-
 base/system/diskpart/list.c|  45 ++--
 base/system/diskpart/partlist.c| 211 -
 12 files changed, 258 insertions(+), 64 deletions(-)

diff --git a/base/system/diskpart/diskpart.h b/base/system/diskpart/diskpart.h
index 218b6030a17..23ea593e7b4 100644
--- a/base/system/diskpart/diskpart.h
+++ b/base/system/diskpart/diskpart.h
@@ -83,6 +83,14 @@ typedef enum _FORMATSTATE
 Formatted
 } FORMATSTATE, *PFORMATSTATE;
 
+typedef enum _VOLUME_TYPE
+{
+VOLUME_TYPE_CDROM,
+VOLUME_TYPE_PARTITION,
+VOLUME_TYPE_REMOVABLE,
+VOLUME_TYPE_UNKNOWN
+} VOLUME_TYPE, *PVOLUME_TYPE;
+
 typedef struct _PARTENTRY
 {
 LIST_ENTRY ListEntry;
@@ -185,9 +193,11 @@ typedef struct _VOLENTRY
 
 PWSTR pszLabel;
 PWSTR pszFilesystem;
-UINT DriveType;
+VOLUME_TYPE VolumeType;
 ULARGE_INTEGER Size;
 
+PVOLUME_DISK_EXTENTS pExtents;
+
 } VOLENTRY, *PVOLENTRY;
 
 
diff --git a/base/system/diskpart/lang/en-US.rc 
b/base/system/diskpart/lang/en-US.rc
index 7289cb2d159..4eeadf4066a 100644
--- a/base/system/diskpart/lang/en-US.rc
+++ b/base/system/diskpart/lang/en-US.rc
@@ -47,16 +47,16 @@ END
 /* Detail header titles */
 STRINGTABLE
 BEGIN
-IDS_LIST_DISK_HEAD "\n  Disk ###  Status  Size Free Dyn  Gpt\n"
+IDS_LIST_DISK_HEAD "  Disk ###  Status  Size Free Dyn  Gpt\n"
 IDS_LIST_DISK_LINE "    --  ---  ---  ---  ---\n"
 IDS_LIST_DISK_FORMAT "%c %7lu   %-10s  %4I64u %-2s  %4I64u %-2s   %1s
%1s\n"
-IDS_LIST_PARTITION_HEAD "\n  Partition  Type  Size 
Offset\n"
+IDS_LIST_PARTITION_HEAD "  Partition  Type  Size 
Offset\n"
 IDS_LIST_PARTITION_LINE "  -    ---  
---\n"
 IDS_LIST_PARTITION_FORMAT "%c Partition %2lu   %-16s  %4I64u %-2s  %4I64u 
%-2s\n"
 IDS_LIST_PARTITION_NO_DISK "\nThere is no disk to list partitions.\nPlease 
select a disk and try again.\n\n"
 IDS_LIST_VOLUME_HEAD "  Volume ###  Ltr  LabelFS Type
Size Status   Info\n"
 IDS_LIST_VOLUME_LINE "  --  ---  ---  -  --  
---  ---  \n"
-IDS_LIST_VOLUME_FORMAT "  Volume %-3lu   %c   %-11.11s  %-5s  %10u  %4I64u 
%-2s\n"
+IDS_LIST_VOLUME_FORMAT "%c Volume %-3lu   %c   %-11.11s  %-5s  %-10.10s  
%4I64u %-2s\n"
 END
 
 /* RESCAN command string */
diff --git a/base/system/diskpart/lang/pl-PL.rc 
b/base/system/diskpart/lang/pl-PL.rc
index 426c948519d..69de3471d20 100644
--- a/base/system/diskpart/lang/pl-PL.rc
+++ b/base/system/diskpart/lang/pl-PL.rc
@@ -47,16 +47,16 @@ END
 /* Detail header titles */
 STRINGTABLE
 BEGIN
-IDS_LIST_DISK_HEAD "\nDysk ###  StanRozmiar  WolneDyn  Gpt\n"
+IDS_LIST_DISK_HEAD "  Dysk ###  StanRozmiar  WolneDyn  Gpt\n"
 IDS_LIST_DISK_LINE "    --  ---  ---  ---  ---\n"
 IDS_LIST_DISK_FORMAT "%c %7lu   %-10s  %4I64u %-2s  %4I64u %-2s   %1s
%1s\n"
-IDS_LIST_PARTITION_HEAD "\nPartycja   Typ   Rozmiar  
Przesunięcie\n"
+IDS_LIST_PARTITION_HEAD "  Partycja   Typ   Rozmiar  
Przesunięcie\n"
 IDS_LIST_PARTITION_LINE "  -    ---  
\n"
 IDS_LIST_PARTITION_FORMAT "%c Partycja%2lu   %-16s  %4I64u %-2s  
%4I64u %-2s\n"
 IDS_LIST_PARTITION_NO_DISK "\nNie wybrano dysku do wyświetlenia 
partycji.\nWybierz dysk i spróbuj ponownie.\n\n"
 IDS_LIST_VOLUME_HEAD "  Wolumin ###  Lit  Etykieta FS Typ 
Rozmiar  Stan Info\n"
 IDS_LIST_VOLUME_LINE "  ---  ---  ---  -  --  
---  ---  \n"
-IDS_LIST_VOLUME_FORMAT "  Wolumin %-3lu   %c   %-11.11s  %-5s  %10u  
%4I64u %-2s\n"
+IDS_LIST_VOLUME_FORMAT "%c Wolumin %-3lu   %c   %-11.11s  %-5s  %-10.10s  
%4I64u %-2s\n"
 END
 
 /* RESCAN command stri

[ros-diffs] [reactos] 01/01: [DISKPART] Implement CREATE PARTITION LOGICAL

2022-05-29 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=863400813abe6c8dd4720997e7fe36325971967e

commit 863400813abe6c8dd4720997e7fe36325971967e
Author: Eric Kohl 
AuthorDate: Sun May 29 10:05:51 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun May 29 10:05:51 2022 +0200

[DISKPART] Implement CREATE PARTITION LOGICAL
---
 base/system/diskpart/create.c | 173 +-
 1 file changed, 172 insertions(+), 1 deletion(-)

diff --git a/base/system/diskpart/create.c b/base/system/diskpart/create.c
index 9fa6b189cbf..9617b7c4e60 100644
--- a/base/system/diskpart/create.c
+++ b/base/system/diskpart/create.c
@@ -184,13 +184,184 @@ CreateLogicalPartition(
 _In_ INT argc,
 _In_ PWSTR *argv)
 {
+PPARTENTRY PartEntry, NewPartEntry;
+PLIST_ENTRY ListEntry;
+ULONGLONG ullSize = 0ULL;
+ULONGLONG ullSectorCount;
+#if 0
+ULONGLONG ullOffset = 0ULL;
+BOOL bNoErr = FALSE;
+#endif
+UCHAR PartitionType = 6;
+INT i, length;
+PWSTR pszSuffix = NULL;
+
 if (CurrentDisk == NULL)
 {
 ConResPuts(StdOut, IDS_SELECT_NO_DISK);
 return TRUE;
 }
 
-ConPrintf(StdOut, L"Not implemented yet!\n");
+for (i = 3; i < argc; i++)
+{
+if (HasPrefix(argv[i], L"size=", ))
+{
+/* size= (MB) */
+DPRINT("Size : %s\n", pszSuffix);
+
+ullSize = _wcstoui64(pszSuffix, NULL, 10);
+if ((ullSize == 0) && (errno == ERANGE))
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+}
+else if (HasPrefix(argv[i], L"offset=", ))
+{
+/* offset= (KB) */
+DPRINT("Offset : %s\n", pszSuffix);
+ConPuts(StdOut, L"The OFFSET option is not supported yet!\n");
+#if 0
+ullOffset = _wcstoui64(pszSuffix, NULL, 10);
+if ((ullOffset == 0) && (errno == ERANGE))
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+#endif
+}
+else if (HasPrefix(argv[i], L"id=", ))
+{
+/* id=| */
+DPRINT("Id : %s\n", pszSuffix);
+
+length = wcslen(pszSuffix);
+if ((length == 1) || (length == 2))
+{
+/* Byte */
+PartitionType = (UCHAR)wcstoul(pszSuffix, NULL, 16);
+if ((PartitionType == 0) && (errno == ERANGE))
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+}
+#if 0
+else if ()
+{
+/* GUID */
+}
+#endif
+else
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE; 
+}
+}
+else if (HasPrefix(argv[i], L"align=", ))
+{
+/* align= */
+DPRINT("Align : %s\n", pszSuffix);
+ConPuts(StdOut, L"The ALIGN option is not supported yet!\n");
+#if 0
+bAlign = TRUE;
+#endif
+}
+else if (_wcsicmp(argv[i], L"noerr") == 0)
+{
+/* noerr */
+DPRINT("NoErr\n", pszSuffix);
+ConPuts(StdOut, L"The NOERR option is not supported yet!\n");
+#if 0
+bNoErr = TRUE;
+#endif
+}
+else
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+}
+
+DPRINT1("Size: %I64u\n", ullSize);
+#if 0
+DPRINT1("Offset: %I64u\n", ullOffset);
+#endif
+DPRINT1("Partition Type: %hx\n", PartitionType);
+
+if (ullSize != 0)
+ullSectorCount = (ullSize * 1024 * 1024) / CurrentDisk->BytesPerSector;
+else
+ullSectorCount = 0;
+
+DPRINT1("SectorCount: %I64u\n", ullSectorCount);
+
+for (ListEntry = CurrentDisk->LogicalPartListHead.Flink;
+ ListEntry != >LogicalPartListHead;
+ ListEntry = ListEntry->Flink)
+{
+PartEntry = CONTAINING_RECORD(ListEntry, PARTENTRY, ListEntry);
+if (PartEntry->IsPartitioned)
+continue;
+
+if (ullSectorCount == 0)
+{
+PartEntry->IsPartitioned = TRUE;
+PartEntry->New = TRUE;
+PartEntry->PartitionType = PartitionType;
+PartEntry->FormatState = Unformatted;
+PartEntry->FileSystemName[0] = L'\0';
+
+CurrentDisk->Dirty = TRUE;
+break;
+}
+else
+{
+if (PartEntry->SectorCount.QuadPart == ullSectorCount)
+{
+PartEntry->IsPartitioned = TRUE;
+PartEntry->

[ros-diffs] [reactos] 01/01: [DISKPART] Implement CREATE PARTITION EXTENDED and warn about unimplemented options

2022-05-28 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=52bbf6078ec2ea9e6d0467019d6d674de87878b4

commit 52bbf6078ec2ea9e6d0467019d6d674de87878b4
Author: Eric Kohl 
AuthorDate: Sat May 28 13:17:45 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat May 28 13:17:45 2022 +0200

[DISKPART] Implement CREATE PARTITION EXTENDED and warn about unimplemented 
options
---
 base/system/diskpart/create.c | 187 +++---
 1 file changed, 175 insertions(+), 12 deletions(-)

diff --git a/base/system/diskpart/create.c b/base/system/diskpart/create.c
index 095bf4e3d10..9fa6b189cbf 100644
--- a/base/system/diskpart/create.c
+++ b/base/system/diskpart/create.c
@@ -14,16 +14,166 @@
 
 BOOL
 CreateExtendedPartition(
-INT argc,
-PWSTR *argv)
+_In_ INT argc,
+_In_ PWSTR *argv)
 {
+PPARTENTRY PartEntry, NewPartEntry;
+PLIST_ENTRY ListEntry;
+ULONGLONG ullSize = 0ULL;
+ULONGLONG ullSectorCount;
+#if 0
+ULONGLONG ullOffset = 0ULL;
+BOOL bNoErr = FALSE;
+#endif
+INT i;
+PWSTR pszSuffix = NULL;
+
 if (CurrentDisk == NULL)
 {
 ConResPuts(StdOut, IDS_SELECT_NO_DISK);
 return TRUE;
 }
 
-ConPrintf(StdOut, L"Not implemented yet!\n");
+for (i = 3; i < argc; i++)
+{
+if (HasPrefix(argv[i], L"size=", ))
+{
+/* size= (MB) */
+DPRINT("Size : %s\n", pszSuffix);
+
+ullSize = _wcstoui64(pszSuffix, NULL, 10);
+if ((ullSize == 0) && (errno == ERANGE))
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+}
+else if (HasPrefix(argv[i], L"offset=", ))
+{
+/* offset= (KB) */
+DPRINT("Offset : %s\n", pszSuffix);
+ConPuts(StdOut, L"The OFFSET option is not supported yet!\n");
+#if 0
+ullOffset = _wcstoui64(pszSuffix, NULL, 10);
+if ((ullOffset == 0) && (errno == ERANGE))
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+#endif
+}
+else if (HasPrefix(argv[i], L"align=", ))
+{
+/* align= */
+DPRINT("Align : %s\n", pszSuffix);
+ConPuts(StdOut, L"The ALIGN option is not supported yet!\n");
+#if 0
+bAlign = TRUE;
+#endif
+}
+else if (_wcsicmp(argv[i], L"noerr") == 0)
+{
+/* noerr */
+DPRINT("NoErr\n", pszSuffix);
+ConPuts(StdOut, L"The NOERR option is not supported yet!\n");
+#if 0
+bNoErr = TRUE;
+#endif
+}
+else
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+}
+
+DPRINT1("Size: %I64u\n", ullSize);
+#if 0
+DPRINT1("Offset: %I64u\n", ullOffset);
+#endif
+
+if (GetPrimaryPartitionCount(CurrentDisk) >= 4)
+{
+ConPuts(StdOut, L"No space left for an extended partition!\n");
+return TRUE;
+}
+
+if (CurrentDisk->ExtendedPartition != NULL)
+{
+ConPuts(StdOut, L"We already have an extended partition on this 
disk!\n");
+return TRUE;
+}
+
+if (ullSize != 0)
+ullSectorCount = (ullSize * 1024 * 1024) / CurrentDisk->BytesPerSector;
+else
+ullSectorCount = 0;
+
+DPRINT1("SectorCount: %I64u\n", ullSectorCount);
+
+ListEntry = CurrentDisk->PrimaryPartListHead.Blink;
+
+PartEntry = CONTAINING_RECORD(ListEntry, PARTENTRY, ListEntry);
+if (PartEntry->IsPartitioned)
+{
+ConPuts(StdOut, L"No disk space left for an extended partition!\n");
+return TRUE;
+}
+
+if (ullSectorCount == 0)
+{
+PartEntry->IsPartitioned = TRUE;
+PartEntry->New = TRUE;
+PartEntry->PartitionType = PARTITION_EXTENDED;
+PartEntry->FormatState = Unformatted;
+PartEntry->FileSystemName[0] = L'\0';
+
+CurrentDisk->Dirty = TRUE;
+}
+else
+{
+if (PartEntry->SectorCount.QuadPart == ullSectorCount)
+{
+PartEntry->IsPartitioned = TRUE;
+PartEntry->New = TRUE;
+PartEntry->PartitionType = PARTITION_EXTENDED;
+PartEntry->FormatState = Unformatted;
+PartEntry->FileSystemName[0] = L'\0';
+
+CurrentDisk->Dirty = TRUE;
+}
+else if (PartEntry->SectorCount.QuadPart > ullSectorCount)
+{
+NewPartEntry = RtlAllocateHeap(RtlGetProcessHeap(), 
HEAP_ZERO_MEMORY, sizeof(PPARTENTRY));
+if (NewPartEntry == NULL)
+{
+ConPuts(StdOut, L"Memory allocation failed!\n");
+r

[ros-diffs] [reactos] 01/01: [DISKPART] Implement CREATE PARTITION PRIMARY and DELETE PARTITION

2022-05-28 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=723947eab127001405d07963f2046e147be6498f

commit 723947eab127001405d07963f2046e147be6498f
Author: Eric Kohl 
AuthorDate: Sat May 28 11:33:29 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat May 28 11:33:29 2022 +0200

[DISKPART] Implement CREATE PARTITION PRIMARY and DELETE PARTITION
---
 base/system/diskpart/create.c   | 146 --
 base/system/diskpart/delete.c   | 121 
 base/system/diskpart/diskpart.h |  34 ++-
 base/system/diskpart/partlist.c | 630 ++--
 4 files changed, 891 insertions(+), 40 deletions(-)

diff --git a/base/system/diskpart/create.c b/base/system/diskpart/create.c
index a933da2c5ae..095bf4e3d10 100644
--- a/base/system/diskpart/create.c
+++ b/base/system/diskpart/create.c
@@ -8,6 +8,10 @@
 
 #include "diskpart.h"
 
+#define NDEBUG
+#include 
+
+
 BOOL
 CreateExtendedPartition(
 INT argc,
@@ -47,32 +51,30 @@ CreatePrimaryPartition(
 INT argc,
 PWSTR *argv)
 {
-LARGE_INTEGER liSize, liOffset;
-INT i;
+PPARTENTRY PartEntry, NewPartEntry;
+PLIST_ENTRY ListEntry;
+ULONGLONG ullSize = 0ULL, ullOffset = 0ULL;
+ULONGLONG ullSectorCount;
+UCHAR PartitionType = 6;
+INT i, length;
 //BOOL bNoErr = FALSE;
 PWSTR pszSuffix = NULL;
 
-liSize.QuadPart = -1;
-liOffset.QuadPart = -1;
-
-/*
 if (CurrentDisk == NULL)
 {
 ConResPuts(StdOut, IDS_SELECT_NO_DISK);
 return TRUE;
 }
-*/
 
 for (i = 3; i < argc; i++)
 {
 if (HasPrefix(argv[i], L"size=", ))
 {
 /* size= (MB) */
-ConPrintf(StdOut, L"Size : %s\n", pszSuffix);
+DPRINT("Size : %s\n", pszSuffix);
 
-liSize.QuadPart = _wcstoui64(pszSuffix, NULL, 10);
-if (((liSize.QuadPart == 0) && (errno == ERANGE)) ||
-(liSize.QuadPart < 0))
+ullSize = _wcstoui64(pszSuffix, NULL, 10);
+if ((ullSize == 0) && (errno == ERANGE))
 {
 ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
 return TRUE;
@@ -81,11 +83,10 @@ CreatePrimaryPartition(
 else if (HasPrefix(argv[i], L"offset=", ))
 {
 /* offset= (KB) */
-ConPrintf(StdOut, L"Offset : %s\n", pszSuffix);
+DPRINT("Offset : %s\n", pszSuffix);
 
-liOffset.QuadPart = _wcstoui64(pszSuffix, NULL, 10);
-if (((liOffset.QuadPart == 0) && (errno == ERANGE)) ||
-(liOffset.QuadPart < 0))
+ullOffset = _wcstoui64(pszSuffix, NULL, 10);
+if ((ullOffset == 0) && (errno == ERANGE))
 {
 ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
 return TRUE;
@@ -94,17 +95,41 @@ CreatePrimaryPartition(
 else if (HasPrefix(argv[i], L"id=", ))
 {
 /* id=| */
-ConPrintf(StdOut, L"Id : %s\n", pszSuffix);
+DPRINT("Id : %s\n", pszSuffix);
+
+length = wcslen(pszSuffix);
+if ((length == 1) || (length == 2))
+{
+/* Byte */
+PartitionType = (UCHAR)wcstoul(pszSuffix, NULL, 16);
+if ((PartitionType == 0) && (errno == ERANGE))
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+}
+#if 0
+else if ()
+{
+/* GUID */
+}
+#endif
+else
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE; 
+}
 }
 else if (HasPrefix(argv[i], L"align=", ))
 {
 /* align= */
-ConPrintf(StdOut, L"Align : %s\n", pszSuffix);
+DPRINT("Align : %s\n", pszSuffix);
+//bAlign = TRUE;
 }
 else if (_wcsicmp(argv[i], L"noerr") == 0)
 {
 /* noerr */
-ConPrintf(StdOut, L"NoErr\n", pszSuffix);
+DPRINT("NoErr\n", pszSuffix);
 //bNoErr = TRUE;
 }
 else
@@ -114,8 +139,89 @@ CreatePrimaryPartition(
 }
 }
 
-ConPrintf(StdOut, L"Size: %I64d\n", liSize.QuadPart);
-ConPrintf(StdOut, L"Offset: %I64d\n", liOffset.QuadPart);
+DPRINT1("Size: %I64u\n", ullSize);
+DPRINT1("Offset: %I64u\n", ullOffset);
+DPRINT1("Partition Type: %hx\n", PartitionType);
+
+if (GetPrimaryPartitionCount(CurrentDisk) >= 4)
+{
+ConPuts(StdOut, L"No space left for another primary partition!\n");
+return TRUE;
+}
+
+if (ullSize != 0)
+ullSectorCount = (ullSize * 1024 * 1024) /

[ros-diffs] [reactos] 01/01: [DISKPART] Fix crashes in the interpreter

2022-05-28 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=166b88f95c1eed0be0340a25ba73da5911521159

commit 166b88f95c1eed0be0340a25ba73da5911521159
Author: Eric Kohl 
AuthorDate: Sat May 28 09:54:46 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat May 28 09:54:46 2022 +0200

[DISKPART] Fix crashes in the interpreter
---
 base/system/diskpart/interpreter.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/base/system/diskpart/interpreter.c 
b/base/system/diskpart/interpreter.c
index 5e4eafa47ee..d2decf537f1 100644
--- a/base/system/diskpart/interpreter.c
+++ b/base/system/diskpart/interpreter.c
@@ -128,20 +128,20 @@ InterpretCmd(
 for (cmdptr = cmds; cmdptr->cmd1; cmdptr++)
 {
 if ((cmdptr1 == NULL) &&
-(wcsicmp(argv[0], cmdptr->cmd1) == 0))
+(cmdptr->cmd1 != NULL) && (wcsicmp(argv[0], cmdptr->cmd1) == 0))
 cmdptr1 = cmdptr;
 
 if ((cmdptr2 == NULL) &&
 (argc >= 2) &&
-(wcsicmp(argv[0], cmdptr->cmd1) == 0) &&
-(wcsicmp(argv[1], cmdptr->cmd2) == 0))
+(cmdptr->cmd1 != NULL) && (wcsicmp(argv[0], cmdptr->cmd1) == 0) &&
+(cmdptr->cmd2 != NULL) && (wcsicmp(argv[1], cmdptr->cmd2) == 0))
 cmdptr2 = cmdptr;
 
 if ((cmdptr3 == NULL) &&
 (argc >= 3) &&
-(wcsicmp(argv[0], cmdptr->cmd1) == 0) &&
-(wcsicmp(argv[1], cmdptr->cmd2) == 0) &&
-(wcsicmp(argv[2], cmdptr->cmd3) == 0))
+(cmdptr->cmd1 != NULL) && (wcsicmp(argv[0], cmdptr->cmd1) == 0) &&
+(cmdptr->cmd2 != NULL) && (wcsicmp(argv[1], cmdptr->cmd2) == 0) &&
+(cmdptr->cmd3 != NULL) && (wcsicmp(argv[2], cmdptr->cmd3) == 0))
 cmdptr3 = cmdptr;
 }
 



[ros-diffs] [reactos] 01/01: [DISKPART] Do not print command descriptions twice

2022-05-21 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=434cf85d9696acea77fd45e9aa4aedbba4be08af

commit 434cf85d9696acea77fd45e9aa4aedbba4be08af
Author: Eric Kohl 
AuthorDate: Sat May 21 16:59:45 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat May 21 16:59:45 2022 +0200

[DISKPART] Do not print command descriptions twice
---
 base/system/diskpart/help.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/base/system/diskpart/help.c b/base/system/diskpart/help.c
index bd7bb490a42..d271844d0cf 100644
--- a/base/system/diskpart/help.c
+++ b/base/system/diskpart/help.c
@@ -88,7 +88,10 @@ HelpCommand(
 (wcsicmp(pCommand->cmd2, cmdptr->cmd2) == 0) &&
 (wcsicmp(pCommand->cmd3, cmdptr->cmd3) == 0) &&
 (cmdptr->help_detail != IDS_NONE))
+{
 ConResPuts(StdOut, cmdptr->help_detail);
+bSubCommands = TRUE;
+}
 }
 }
 



[ros-diffs] [reactos] 01/01: [DISKPART] Improvements to the dump, help and delete commands

2022-05-21 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=417687e92e8aff1933c231c6e7b8ee137c59e45c

commit 417687e92e8aff1933c231c6e7b8ee137c59e45c
Author: Eric Kohl 
AuthorDate: Sat May 21 10:43:38 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat May 21 10:43:38 2022 +0200

[DISKPART] Improvements to the dump, help and delete commands

- Print help only if a help string exists.
- Use the command table for the dump sub commands.
- Add sub commands for the delete command.
---
 base/system/diskpart/delete.c  |  21 -
 base/system/diskpart/diskpart.h|  39 +++--
 base/system/diskpart/dump.c|  46 ++
 base/system/diskpart/help.c|  13 ++-
 base/system/diskpart/interpreter.c |  10 ++-
 base/system/diskpart/lang/en-US.rc |   8 +-
 base/system/diskpart/lang/pl-PL.rc |   8 +-
 base/system/diskpart/lang/pt-PT.rc |   8 +-
 base/system/diskpart/lang/ro-RO.rc |   8 +-
 base/system/diskpart/lang/ru-RU.rc |   8 +-
 base/system/diskpart/lang/sq-AL.rc |   8 +-
 base/system/diskpart/lang/tr-TR.rc |   8 +-
 base/system/diskpart/lang/zh-CN.rc |   8 +-
 base/system/diskpart/lang/zh-TW.rc |   8 +-
 base/system/diskpart/resource.h| 166 +++--
 15 files changed, 226 insertions(+), 141 deletions(-)

diff --git a/base/system/diskpart/delete.c b/base/system/diskpart/delete.c
index 13b298c54c8..de712944dcc 100644
--- a/base/system/diskpart/delete.c
+++ b/base/system/diskpart/delete.c
@@ -8,7 +8,26 @@
 
 #include "diskpart.h"
 
-BOOL delete_main(INT argc, LPWSTR *argv)
+BOOL
+DeleteDisk(
+_In_ INT argc,
+_In_ PWSTR *argv)
+{
+return TRUE;
+}
+
+BOOL
+DeletePartition(
+_In_ INT argc,
+_In_ PWSTR *argv)
+{
+return TRUE;
+}
+
+BOOL
+DeleteVolume(
+_In_ INT argc,
+_In_ PWSTR *argv)
 {
 return TRUE;
 }
diff --git a/base/system/diskpart/diskpart.h b/base/system/diskpart/diskpart.h
index 5a1a3ba197b..f13e6724262 100644
--- a/base/system/diskpart/diskpart.h
+++ b/base/system/diskpart/diskpart.h
@@ -237,21 +237,35 @@ BOOL convert_main(INT argc, LPWSTR *argv);
 /* create.c */
 BOOL
 CreateExtendedPartition(
-INT argc,
-PWSTR *argv);
+_In_ INT argc,
+_In_ PWSTR *argv);
 
 BOOL
 CreateLogicalPartition(
-INT argc,
-PWSTR *argv);
+_In_ INT argc,
+_In_ PWSTR *argv);
 
 BOOL
 CreatePrimaryPartition(
-INT argc,
-PWSTR *argv);
+_In_ INT argc,
+_In_ PWSTR *argv);
 
 /* delete.c */
-BOOL delete_main(INT argc, LPWSTR *argv);
+BOOL
+DeleteDisk(
+_In_ INT argc,
+_In_ PWSTR *argv);
+
+BOOL
+DeletePartition(
+_In_ INT argc,
+_In_ PWSTR *argv);
+
+BOOL
+DeleteVolume(
+_In_ INT argc,
+_In_ PWSTR *argv);
+
 
 /* detach.c */
 BOOL detach_main(INT argc, LPWSTR *argv);
@@ -275,7 +289,16 @@ DetailVolume(
 /* diskpart.c */
 
 /* dump.c */
-BOOL dump_main(INT argc, LPWSTR *argv);
+BOOL
+DumpDisk(
+_In_ INT argc,
+_In_ LPWSTR *argv);
+
+BOOL
+DumpPartition(
+_In_ INT argc,
+_In_ LPWSTR *argv);
+
 
 /* expand.c */
 BOOL expand_main(INT argc, LPWSTR *argv);
diff --git a/base/system/diskpart/dump.c b/base/system/diskpart/dump.c
index 6e2e46a8733..bc20dff607e 100644
--- a/base/system/diskpart/dump.c
+++ b/base/system/diskpart/dump.c
@@ -44,8 +44,7 @@ HexDump(
 }
 
 
-static
-VOID
+BOOL
 DumpDisk(
 _In_ INT argc,
 _In_ LPWSTR *argv)
@@ -72,7 +71,7 @@ DumpDisk(
 if (CurrentDisk == NULL)
 {
 ConResPuts(StdOut, IDS_SELECT_NO_DISK);
-return;
+return TRUE;
 }
 
 Sector = _wcstoi64(argv[2], , 0);
@@ -80,7 +79,7 @@ DumpDisk(
 (Sector < 0))
 {
 ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
-return;
+return TRUE;
 }
 
 pSectorBuffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, 
CurrentDisk->BytesPerSector);
@@ -139,12 +138,11 @@ done:
 
 RtlFreeHeap(RtlGetProcessHeap(), 0, pSectorBuffer);
 
-return;
+return TRUE;
 }
 
 
-static
-VOID
+BOOL
 DumpPartition(
 _In_ INT argc,
 _In_ LPWSTR *argv)
@@ -172,13 +170,13 @@ DumpPartition(
 if (CurrentDisk == NULL)
 {
 ConResPuts(StdOut, IDS_SELECT_NO_DISK);
-return;
+return TRUE;
 }
 
 if (CurrentPartition == NULL)
 {
 ConResPuts(StdOut, IDS_SELECT_NO_PARTITION);
-return;
+return TRUE;
 }
 
 Sector = _wcstoi64(argv[2], , 0);
@@ -186,7 +184,7 @@ DumpPartition(
 (Sector < 0))
 {
 ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
-return;
+return TRUE;
 }
 
 pSectorBuffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, 
CurrentDisk->BytesPerSector);
@@ -246,33 +244,5 @@ done:
 
 RtlFreeHeap(RtlGetProcessHeap(), 0, pSectorBuffer);
 
-return;
-}
-
-
-BOOL
-dump_main(
-_In_ INT argc,
-_In_ LPWSTR *argv)
-{
-/* gets the first word from the string */
-#if 0
-if (argc == 1)
-{
-ConResPuts(StdOut, IDS_HELP_CMD_LIST);
-retur

[ros-diffs] [reactos] 01/01: [DISKPART] Improve the command table to support subcommands and start work on the create command

2022-05-15 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=566e8989c311d20e3ae04fd580fcc6a2fc2cebc5

commit 566e8989c311d20e3ae04fd580fcc6a2fc2cebc5
Author: Eric Kohl 
AuthorDate: Sun May 15 12:27:53 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun May 15 12:27:53 2022 +0200

[DISKPART] Improve the command table to support subcommands and start work 
on the create command

- Extend the command table to support subcommands.
- Get rid of the existing subcommand code.
- Use the new subcommand suport for the help system.
- Start work on the create command.

@Translators: Please do not translate any changes yet, because I will 
improve help system in one of the next steps.
---
 base/system/diskpart/create.c  | 109 -
 base/system/diskpart/detail.c  |  58 -
 base/system/diskpart/diskpart.h|  85 ++--
 base/system/diskpart/help.c|  68 +---
 base/system/diskpart/interpreter.c | 161 ++---
 base/system/diskpart/lang/en-US.rc |  55 -
 base/system/diskpart/list.c|  61 ++
 base/system/diskpart/misc.c|  12 ++-
 base/system/diskpart/resource.h|  17 +++-
 base/system/diskpart/select.c  |  76 ++---
 base/system/diskpart/uniqueid.c|  53 
 11 files changed, 513 insertions(+), 242 deletions(-)

diff --git a/base/system/diskpart/create.c b/base/system/diskpart/create.c
index 50e349e082d..a933da2c5ae 100644
--- a/base/system/diskpart/create.c
+++ b/base/system/diskpart/create.c
@@ -8,7 +8,114 @@
 
 #include "diskpart.h"
 
-BOOL create_main(INT argc, LPWSTR *argv)
+BOOL
+CreateExtendedPartition(
+INT argc,
+PWSTR *argv)
 {
+if (CurrentDisk == NULL)
+{
+ConResPuts(StdOut, IDS_SELECT_NO_DISK);
+return TRUE;
+}
+
+ConPrintf(StdOut, L"Not implemented yet!\n");
+
+return TRUE;
+}
+
+
+BOOL
+CreateLogicalPartition(
+INT argc,
+PWSTR *argv)
+{
+if (CurrentDisk == NULL)
+{
+ConResPuts(StdOut, IDS_SELECT_NO_DISK);
+return TRUE;
+}
+
+ConPrintf(StdOut, L"Not implemented yet!\n");
+
+return TRUE;
+}
+
+
+BOOL
+CreatePrimaryPartition(
+INT argc,
+PWSTR *argv)
+{
+LARGE_INTEGER liSize, liOffset;
+INT i;
+//BOOL bNoErr = FALSE;
+PWSTR pszSuffix = NULL;
+
+liSize.QuadPart = -1;
+liOffset.QuadPart = -1;
+
+/*
+if (CurrentDisk == NULL)
+{
+ConResPuts(StdOut, IDS_SELECT_NO_DISK);
+return TRUE;
+}
+*/
+
+for (i = 3; i < argc; i++)
+{
+if (HasPrefix(argv[i], L"size=", ))
+{
+/* size= (MB) */
+ConPrintf(StdOut, L"Size : %s\n", pszSuffix);
+
+liSize.QuadPart = _wcstoui64(pszSuffix, NULL, 10);
+if (((liSize.QuadPart == 0) && (errno == ERANGE)) ||
+(liSize.QuadPart < 0))
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+}
+else if (HasPrefix(argv[i], L"offset=", ))
+{
+/* offset= (KB) */
+ConPrintf(StdOut, L"Offset : %s\n", pszSuffix);
+
+liOffset.QuadPart = _wcstoui64(pszSuffix, NULL, 10);
+if (((liOffset.QuadPart == 0) && (errno == ERANGE)) ||
+(liOffset.QuadPart < 0))
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+}
+else if (HasPrefix(argv[i], L"id=", ))
+{
+/* id=| */
+ConPrintf(StdOut, L"Id : %s\n", pszSuffix);
+}
+else if (HasPrefix(argv[i], L"align=", ))
+{
+/* align= */
+ConPrintf(StdOut, L"Align : %s\n", pszSuffix);
+}
+else if (_wcsicmp(argv[i], L"noerr") == 0)
+{
+/* noerr */
+ConPrintf(StdOut, L"NoErr\n", pszSuffix);
+//bNoErr = TRUE;
+}
+else
+{
+ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
+return TRUE;
+}
+}
+
+ConPrintf(StdOut, L"Size: %I64d\n", liSize.QuadPart);
+ConPrintf(StdOut, L"Offset: %I64d\n", liOffset.QuadPart);
+
 return TRUE;
 }
diff --git a/base/system/diskpart/detail.c b/base/system/diskpart/detail.c
index 464085149fc..0c0de3e262a 100644
--- a/base/system/diskpart/detail.c
+++ b/base/system/diskpart/detail.c
@@ -13,24 +13,23 @@
 
 /* FUNCTIONS 
**/
 
-static
-VOID
+BOOL
 DetailDisk(
 INT argc,
-LPWSTR *argv)
+PWSTR *argv)
 {
 DPRINT("DetailDisk()\n");
 
 if (argc > 2)
 {
 ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
-return;
+ 

[ros-diffs] [reactos] 01/01: [NETAPI32] NetSessionEnum: UncClientName and username are optional

2022-05-07 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c70d7550597ba6977f8546c17a1ecb6360281e39

commit c70d7550597ba6977f8546c17a1ecb6360281e39
Author: Eric Kohl 
AuthorDate: Sat May 7 16:53:26 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat May 7 16:54:04 2022 +0200

[NETAPI32] NetSessionEnum: UncClientName and username are optional

Do not fail if UncClientName and username are null.
---
 dll/win32/netapi32/srvsvc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/dll/win32/netapi32/srvsvc.c b/dll/win32/netapi32/srvsvc.c
index 79a58fc83b6..e820c0d94ad 100644
--- a/dll/win32/netapi32/srvsvc.c
+++ b/dll/win32/netapi32/srvsvc.c
@@ -663,9 +663,6 @@ NetSessionEnum(
 if (level > 2 && level != 10 && level != 502)
 return ERROR_INVALID_LEVEL;
 
-if (UncClientName == NULL || username == NULL)
-return ERROR_INVALID_PARAMETER;
-
 *bufptr = NULL;
 *entriesread = 0;
 



[ros-diffs] [reactos] 01/01: [NTOS:PNP] IopInitializeDevice: Create a device, allocate a device node and attach it to the root node

2022-04-27 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=de316477b9aaaf830d1e9802bc5fec1800140461

commit de316477b9aaaf830d1e9802bc5fec1800140461
Author: Eric Kohl 
AuthorDate: Wed Apr 27 21:52:21 2022 +0200
Commit: Eric Kohl 
CommitDate: Wed Apr 27 21:52:21 2022 +0200

[NTOS:PNP] IopInitializeDevice: Create a device, allocate a device node and 
attach it to the root node
---
 ntoskrnl/io/pnpmgr/plugplay.c | 34 --
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c
index c1f108da332..46093b252b5 100644
--- a/ntoskrnl/io/pnpmgr/plugplay.c
+++ b/ntoskrnl/io/pnpmgr/plugplay.c
@@ -194,6 +194,7 @@ IopInitializeDevice(
 {
 UNICODE_STRING DeviceInstance;
 PDEVICE_OBJECT DeviceObject;
+PDEVICE_NODE DeviceNode;
 NTSTATUS Status = STATUS_SUCCESS;
 
 DPRINT("IopInitializeDevice(%p)\n", ControlData);
@@ -210,7 +211,7 @@ IopInitializeDevice(
 DeviceObject = IopGetDeviceObjectFromDeviceInstance();
 if (DeviceInstance.Buffer != NULL)
 {
-DPRINT("Device %wZ already exists!\n", );
+DPRINT1("Device %wZ already exists!\n", );
 Status = STATUS_SUCCESS;
 goto done;
 }
@@ -219,7 +220,36 @@ IopInitializeDevice(
 
 DPRINT("Device %wZ does not exist!\n", );
 
-/* FIXME: Create a device node for the device instan*/
+/* Create a device node for the device instance */
+Status = IoCreateDevice(IopRootDriverObject,
+0,
+NULL,
+FILE_DEVICE_CONTROLLER,
+FILE_AUTOGENERATED_DEVICE_NAME,
+FALSE,
+);
+if (!NT_SUCCESS(Status))
+{
+DPRINT1("IoCreateDevice() failed (Status 0x%08lx)\n", Status);
+goto done;
+}
+
+/* Allocate a new device node */
+DeviceNode = PipAllocateDeviceNode(DeviceObject);
+if (DeviceNode == NULL)
+{
+DPRINT1("Failed to allocate a device node!\n");
+IoDeleteDevice(DeviceObject);
+Status = STATUS_INSUFFICIENT_RESOURCES;
+goto done;
+}
+
+/* Set the device instance of the device node */
+RtlDuplicateUnicodeString(0, , >InstancePath);
+
+
+/* Insert as a root enumerated device node */
+PiInsertDevNode(DeviceNode, IopRootDeviceNode);
 
 done:
 ExFreePool(DeviceInstance.Buffer);



[ros-diffs] [reactos] 01/01: [BATT] Add the composite battery installer

2022-04-25 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b9c4b6aa65769f7aa67567b19bbdbdeeba4d132c

commit b9c4b6aa65769f7aa67567b19bbdbdeeba4d132c
Author: Eric Kohl 
AuthorDate: Mon Apr 25 23:33:25 2022 +0200
Commit: Eric Kohl 
CommitDate: Mon Apr 25 23:33:51 2022 +0200

[BATT] Add the composite battery installer
---
 dll/win32/batt/CMakeLists.txt |   2 +-
 dll/win32/batt/batt.c | 209 ++
 2 files changed, 191 insertions(+), 20 deletions(-)

diff --git a/dll/win32/batt/CMakeLists.txt b/dll/win32/batt/CMakeLists.txt
index cf775185b37..ac11165ce96 100644
--- a/dll/win32/batt/CMakeLists.txt
+++ b/dll/win32/batt/CMakeLists.txt
@@ -7,5 +7,5 @@ add_library(batt MODULE
 ${CMAKE_CURRENT_BINARY_DIR}/batt.def)
 
 set_module_type(batt win32dll UNICODE)
-add_importlibs(batt msvcrt kernel32 ntdll)
+add_importlibs(batt setupapi msvcrt kernel32 ntdll)
 add_cd_file(TARGET batt DESTINATION reactos/system32 FOR all)
diff --git a/dll/win32/batt/batt.c b/dll/win32/batt/batt.c
index 03695e319be..59def5430a7 100644
--- a/dll/win32/batt/batt.c
+++ b/dll/win32/batt/batt.c
@@ -15,27 +15,192 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #define NDEBUG
 #include 
 
+static
+DWORD
+InstallCompositeBattery(
+_In_ HDEVINFO DeviceInfoSet,
+_In_opt_ PSP_DEVINFO_DATA DeviceInfoData,
+_In_ PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
+{
+WCHAR szDeviceId[32];
+SP_DRVINFO_DATA DriverInfoData;
+HDEVINFO NewDeviceInfoSet = INVALID_HANDLE_VALUE;
+PSP_DEVINFO_DATA NewDeviceInfoData = NULL;
+BOOL  bDeviceRegistered = FALSE, bHaveDriverInfoList = FALSE;
+DWORD dwError = ERROR_SUCCESS;
 
-BOOL
+DPRINT("InstallCompositeBattery(%p %p %p)\n",
+   DeviceInfoSet, DeviceInfoData, DeviceInstallParams);
+
+NewDeviceInfoSet = SetupDiCreateDeviceInfoList(_DEVCLASS_SYSTEM,
+   
DeviceInstallParams->hwndParent);
+if (NewDeviceInfoSet == INVALID_HANDLE_VALUE)
+{
+DPRINT1("SetupDiCreateDeviceInfoList() failed (Error %lu)\n", 
GetLastError());
+return GetLastError();
+}
+ 
+NewDeviceInfoData = HeapAlloc(GetProcessHeap(),
+  HEAP_ZERO_MEMORY,
+  sizeof(SP_DEVINFO_DATA));
+if (NewDeviceInfoData == NULL)
+{
+dwError = ERROR_OUTOFMEMORY;
+goto done;
+}
+
+NewDeviceInfoData->cbSize = sizeof(SP_DEVINFO_DATA);
+if (!SetupDiCreateDeviceInfoW(NewDeviceInfoSet,
+  L"Root\\COMPOSITE_BATTERY\\",
+  _DEVCLASS_SYSTEM,
+  NULL,
+  DeviceInstallParams->hwndParent,
+  0,
+  NewDeviceInfoData))
+{
+dwError = GetLastError();
+if (dwError == ERROR_DEVINST_ALREADY_EXISTS)
+{
+dwError = ERROR_SUCCESS;
+goto done;
+}
+
+DPRINT1("SetupDiCreateDeviceInfoW() failed (Error %lu 0x%08lx)\n", 
dwError, dwError);
+goto done;
+}
+
+if (!SetupDiRegisterDeviceInfo(NewDeviceInfoSet,
+   NewDeviceInfoData,
+   0,
+   NULL,
+   NULL,
+   NULL))
+{
+dwError = GetLastError();
+DPRINT1("SetupDiRegisterDeviceInfo() failed (Error %lu 0x%08lx)\n", 
dwError, dwError);
+goto done;
+}
+
+bDeviceRegistered = TRUE;
+
+ZeroMemory(szDeviceId, sizeof(szDeviceId));
+wcscpy(szDeviceId, L"COMPOSITE_BATTERY");
+
+if (!SetupDiSetDeviceRegistryPropertyW(NewDeviceInfoSet,
+   NewDeviceInfoData,
+   SPDRP_HARDWAREID,
+   (PBYTE)szDeviceId,
+   (wcslen(szDeviceId) + 2) * 
sizeof(WCHAR)))
+{
+dwError = GetLastError();
+DPRINT1("SetupDiSetDeviceRegistryPropertyW() failed (Error %lu 
0x%08lx)\n", dwError, dwError);
+goto done;
+}
+
+if (!SetupDiBuildDriverInfoList(NewDeviceInfoSet,
+NewDeviceInfoData,
+SPDIT_COMPATDRIVER))
+{
+dwError = GetLastError();
+DPRINT1("SetupDiBuildDriverInfoList() failed (Error %lu 0x%08lx)\n", 
dwError, dwError);
+goto done;
+}
+
+bHaveDriverInfoList = TRUE;
+
+DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
+if (!SetupDiEnumDriverInfo(NewDeviceInfoSet,
+   NewDeviceInfoData,
+   SPDIT_COMPATDRIVER,
+   0,
+   ))
+

[ros-diffs] [reactos] 01/01: [UMPNPMGR] PNP_CreateDevInst: Create a device node for the device to be installed

2022-04-24 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=74efe979a89d4150b23f58a5499d1726ad63967b

commit 74efe979a89d4150b23f58a5499d1726ad63967b
Author: Eric Kohl 
AuthorDate: Sun Apr 24 12:56:42 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Apr 24 12:56:42 2022 +0200

[UMPNPMGR] PNP_CreateDevInst: Create a device node for the device to be 
installed
---
 base/services/umpnpmgr/rpcserver.c | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 50cf19b261c..f3dcd0817cc 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -3056,8 +3056,10 @@ PNP_CreateDevInst(
 PNP_RPC_STRING_LEN ulLength,
 DWORD ulFlags)
 {
+PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA ControlData;
 HKEY hKey = NULL;
 DWORD dwSize, dwPhantom;
+NTSTATUS Status;
 CONFIGRET ret = CR_SUCCESS;
 
 DPRINT("PNP_CreateDevInst(%p %S %S %lu 0x%08lx)\n",
@@ -3115,7 +3117,18 @@ PNP_CreateDevInst(
 RegOpenKeyEx(hEnumKey, pszDeviceID, 0, KEY_READ | KEY_WRITE, 
);
 }
 
-/* If the device instance is a phantom, turn it into an non-phantom */
+/* Create a device node for the device */
+RtlInitUnicodeString(, pszDeviceID);
+Status = NtPlugPlayControl(PlugPlayControlInitializeDevice,
+   ,
+   sizeof(ControlData));
+if (!NT_SUCCESS(Status))
+{
+ret = CR_FAILURE;
+goto done;
+}
+
+/* If the device is a phantom device, turn it into a normal device */
 if (hKey != NULL)
 {
 dwPhantom = 0;



[ros-diffs] [reactos] 01/01: [NTOS:PNP] Add a stub for NtPlugPlayControl:PlugPlayControlInitializeDevice

2022-04-24 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=969f950bf34c4789738785581d8c06fe8870b862

commit 969f950bf34c4789738785581d8c06fe8870b862
Author: Eric Kohl 
AuthorDate: Sun Apr 24 10:02:17 2022 +0200
Commit: Eric Kohl 
CommitDate: Sun Apr 24 10:02:17 2022 +0200

[NTOS:PNP] Add a stub for NtPlugPlayControl:PlugPlayControlInitializeDevice
---
 ntoskrnl/io/pnpmgr/plugplay.c | 48 ++-
 1 file changed, 47 insertions(+), 1 deletion(-)

diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c
index 4d64c1e54da..c1f108da332 100644
--- a/ntoskrnl/io/pnpmgr/plugplay.c
+++ b/ntoskrnl/io/pnpmgr/plugplay.c
@@ -186,6 +186,48 @@ IopCaptureUnicodeString(PUNICODE_STRING DstName, 
PUNICODE_STRING SrcName)
 return Status;
 }
 
+
+static
+NTSTATUS
+IopInitializeDevice(
+_In_ PPLUGPLAY_CONTROL_DEVICE_CONTROL_DATA ControlData)
+{
+UNICODE_STRING DeviceInstance;
+PDEVICE_OBJECT DeviceObject;
+NTSTATUS Status = STATUS_SUCCESS;
+
+DPRINT("IopInitializeDevice(%p)\n", ControlData);
+
+Status = IopCaptureUnicodeString(, 
>DeviceInstance);
+if (!NT_SUCCESS(Status))
+{
+return Status;
+}
+
+DPRINT("Device: %wZ\n", );
+
+/* Leave, if the device already exists */
+DeviceObject = IopGetDeviceObjectFromDeviceInstance();
+if (DeviceInstance.Buffer != NULL)
+{
+DPRINT("Device %wZ already exists!\n", );
+Status = STATUS_SUCCESS;
+goto done;
+}
+
+ObDereferenceObject(DeviceObject);
+
+DPRINT("Device %wZ does not exist!\n", );
+
+/* FIXME: Create a device node for the device instan*/
+
+done:
+ExFreePool(DeviceInstance.Buffer);
+
+return Status;
+}
+
+
 /*
  * Remove the current PnP event from the tail of the event queue
  * and signal IopPnpNotifyEvent if there is yet another event in the queue.
@@ -1308,7 +1350,11 @@ NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS 
PlugPlayControlClass,
 
 //case PlugPlayControlRegisterNewDevice:
 //case PlugPlayControlDeregisterDevice:
-//case PlugPlayControlInitializeDevice:
+
+case PlugPlayControlInitializeDevice:
+if (!Buffer || BufferLength < 
sizeof(PLUGPLAY_CONTROL_DEVICE_CONTROL_DATA))
+return STATUS_INVALID_PARAMETER;
+return 
IopInitializeDevice((PPLUGPLAY_CONTROL_DEVICE_CONTROL_DATA)Buffer);
 
 case PlugPlayControlStartDevice:
 case PlugPlayControlResetDevice:



[ros-diffs] [reactos] 01/01: [UMPNPMGR] PNP_CreateDevInst: Convert a phantom device to a normal device

2022-04-23 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a7a222b52db416283eeca2aa0e3d0a923d2881e9

commit a7a222b52db416283eeca2aa0e3d0a923d2881e9
Author: Eric Kohl 
AuthorDate: Sat Apr 23 16:59:47 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Apr 23 16:59:47 2022 +0200

[UMPNPMGR] PNP_CreateDevInst: Convert a phantom device to a normal device
---
 base/services/umpnpmgr/rpcserver.c | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 26b9ab88ab3..50cf19b261c 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -3057,6 +3057,7 @@ PNP_CreateDevInst(
 DWORD ulFlags)
 {
 HKEY hKey = NULL;
+DWORD dwSize, dwPhantom;
 CONFIGRET ret = CR_SUCCESS;
 
 DPRINT("PNP_CreateDevInst(%p %S %S %lu 0x%08lx)\n",
@@ -3104,8 +3105,26 @@ PNP_CreateDevInst(
 goto done;
 }
 
-/* Create the device instance */
-ret = CreateDeviceInstance(pszDeviceID, FALSE);
+/* If it does not already exist ... */
+if (hKey == NULL)
+{
+/* Create the device instance */
+ret = CreateDeviceInstance(pszDeviceID, FALSE);
+
+/* Open the device instance key */
+RegOpenKeyEx(hEnumKey, pszDeviceID, 0, KEY_READ | KEY_WRITE, 
);
+}
+
+/* If the device instance is a phantom, turn it into an non-phantom */
+if (hKey != NULL)
+{
+dwPhantom = 0;
+dwSize = sizeof(DWORD);
+RegQueryValueEx(hKey, L"Phantom", NULL, NULL, (PBYTE), 
);
+
+if (dwPhantom != 0)
+RegDeleteValue(hKey, L"Phantom");
+}
 }
 
 done:



[ros-diffs] [reactos] 01/01: [UMPNPMGR] PNP_CreateDevInst: Do not create a normal device if it is already present

2022-04-23 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=33a0c66f30d823b1adf21bb95c526e489847b38f

commit 33a0c66f30d823b1adf21bb95c526e489847b38f
Author: Eric Kohl 
AuthorDate: Sat Apr 23 15:35:45 2022 +0200
Commit: Eric Kohl 
CommitDate: Sat Apr 23 15:35:45 2022 +0200

[UMPNPMGR] PNP_CreateDevInst: Do not create a normal device if it is 
already present
---
 base/services/umpnpmgr/rpcserver.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 74a289205d0..26b9ab88ab3 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -3097,6 +3097,13 @@ PNP_CreateDevInst(
 }
 else
 {
+/* Fail, if the device exists and is present */
+if ((hKey != NULL) && (IsPresentDeviceInstanceID(pszDeviceID)))
+{
+ret = CR_ALREADY_SUCH_DEVINST;
+goto done;
+}
+
 /* Create the device instance */
 ret = CreateDeviceInstance(pszDeviceID, FALSE);
 }



[ros-diffs] [reactos] 01/01: [UMPNPMGR] GenerateDeviceID must fail, if pszDeviceID contains backslashes

2022-04-19 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0296fce00ee07ef9e3df2fe04f8b3f01343d35a7

commit 0296fce00ee07ef9e3df2fe04f8b3f01343d35a7
Author: Eric Kohl 
AuthorDate: Tue Apr 19 23:14:23 2022 +0200
Commit: Eric Kohl 
CommitDate: Tue Apr 19 23:14:23 2022 +0200

[UMPNPMGR] GenerateDeviceID must fail, if pszDeviceID contains backslashes
---
 base/services/umpnpmgr/rpcserver.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 25461975ee0..1d933e6942b 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -3004,11 +3004,20 @@ GenerateDeviceID(
 _In_ PNP_RPC_STRING_LEN ulLength)
 {
 WCHAR szGeneratedInstance[MAX_DEVICE_ID_LEN];
+PWCHAR ptr;
 HKEY hKey;
 DWORD dwInstanceNumber;
 DWORD dwError = ERROR_SUCCESS;
 CONFIGRET ret = CR_SUCCESS;
 
+/* Fail, if the device name contains backslashes */
+ptr = pszDeviceID;
+while (*ptr != UNICODE_NULL)
+{
+if (*ptr == L'\\')
+return CR_INVALID_DEVICE_ID;
+}
+
 /* Generated ID is: Root\\ */
 dwInstanceNumber = 0;
 while (dwError == ERROR_SUCCESS)



[ros-diffs] [reactos] 01/01: [UMPNPMGR] PNP_CreateDevInst: A phantom device can only be created if the device did not exist before

2022-04-18 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f3ac86713d7b519910e28430b5909c164b8fbe44

commit f3ac86713d7b519910e28430b5909c164b8fbe44
Author: Eric Kohl 
AuthorDate: Tue Apr 19 00:09:27 2022 +0200
Commit: Eric Kohl 
CommitDate: Tue Apr 19 00:09:54 2022 +0200

[UMPNPMGR] PNP_CreateDevInst: A phantom device can only be created if the 
device did not exist before
---
 base/services/umpnpmgr/rpcserver.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 140f1efa91a..25461975ee0 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -3052,6 +3052,7 @@ PNP_CreateDevInst(
 PNP_RPC_STRING_LEN ulLength,
 DWORD ulFlags)
 {
+HKEY hKey = NULL;
 CONFIGRET ret = CR_SUCCESS;
 
 DPRINT("PNP_CreateDevInst(%p %S %S %lu 0x%08lx)\n",
@@ -3075,8 +3076,18 @@ PNP_CreateDevInst(
 return ret;
 }
 
+/* Try to open the device instance key */
+RegOpenKeyEx(hEnumKey, pszDeviceID, 0, KEY_READ | KEY_WRITE, );
+
 if (ulFlags & CM_CREATE_DEVNODE_PHANTOM)
 {
+/* Fail, if the device already exists */
+if (hKey != NULL)
+{
+ret = CR_ALREADY_SUCH_DEVINST;
+goto done;
+}
+
 /* Create the phantom device instance */
 ret = CreateDeviceInstance(pszDeviceID, TRUE);
 }
@@ -3086,6 +3097,10 @@ PNP_CreateDevInst(
 ret = CreateDeviceInstance(pszDeviceID, FALSE);
 }
 
+done:
+if (hKey)
+RegCloseKey(hKey);
+
 DPRINT("PNP_CreateDevInst() done (returns %lx)\n", ret);
 
 return ret;



[ros-diffs] [reactos] 01/01: [UMPNPMGR] PNP_CreateDevInst: Support the creation of phantom devices

2022-04-18 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8897a890c94ed83f4e34147b63dc58b2108e16d7

commit 8897a890c94ed83f4e34147b63dc58b2108e16d7
Author: Eric Kohl 
AuthorDate: Mon Apr 18 19:53:18 2022 +0200
Commit: Eric Kohl 
CommitDate: Mon Apr 18 19:53:18 2022 +0200

[UMPNPMGR] PNP_CreateDevInst: Support the creation of phantom devices
---
 base/services/umpnpmgr/rpcserver.c | 30 ++
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index ae7337ce8eb..140f1efa91a 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -2877,8 +2877,11 @@ done:
 }
 
 
-static CONFIGRET
-CreateDeviceInstance(LPWSTR pszDeviceID)
+static
+CONFIGRET
+CreateDeviceInstance(
+_In_ LPWSTR pszDeviceID,
+_In_ BOOL bPhantomDevice)
 {
 WCHAR szEnumerator[MAX_DEVICE_ID_LEN];
 WCHAR szDevice[MAX_DEVICE_ID_LEN];
@@ -2962,6 +2965,17 @@ CreateDeviceInstance(LPWSTR pszDeviceID)
 return CR_REGISTRY_ERROR;
 }
 
+if (bPhantomDevice)
+{
+DWORD dwPhantomValue = 1;
+RegSetValueExW(hKeyInstance,
+   L"Phantom",
+   0,
+   REG_DWORD,
+   (PBYTE),
+   sizeof(dwPhantomValue));
+}
+
 /* Create the 'Control' sub key */
 lError = RegCreateKeyExW(hKeyInstance,
  L"Control",
@@ -3061,8 +3075,16 @@ PNP_CreateDevInst(
 return ret;
 }
 
-/* Create the device instance */
-ret = CreateDeviceInstance(pszDeviceID);
+if (ulFlags & CM_CREATE_DEVNODE_PHANTOM)
+{
+/* Create the phantom device instance */
+ret = CreateDeviceInstance(pszDeviceID, TRUE);
+}
+else
+{
+/* Create the device instance */
+ret = CreateDeviceInstance(pszDeviceID, FALSE);
+}
 
 DPRINT("PNP_CreateDevInst() done (returns %lx)\n", ret);
 



[ros-diffs] [reactos] 01/01: [UMPNPMGR] Move device id generation into a separate function and limit device instance number

2022-04-18 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f63e8f8a03c8c689b599d83c57184ece1634c818

commit f63e8f8a03c8c689b599d83c57184ece1634c818
Author: Eric Kohl 
AuthorDate: Mon Apr 18 14:14:11 2022 +0200
Commit: Eric Kohl 
CommitDate: Mon Apr 18 14:14:11 2022 +0200

[UMPNPMGR] Move device id generation into a separate function and limit 
device instance number
---
 base/services/umpnpmgr/rpcserver.c | 79 +++---
 1 file changed, 49 insertions(+), 30 deletions(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index be39d95c4c2..ae7337ce8eb 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -2983,6 +2983,51 @@ CreateDeviceInstance(LPWSTR pszDeviceID)
 }
 
 
+static
+CONFIGRET
+GenerateDeviceID(
+_Inout_ LPWSTR pszDeviceID,
+_In_ PNP_RPC_STRING_LEN ulLength)
+{
+WCHAR szGeneratedInstance[MAX_DEVICE_ID_LEN];
+HKEY hKey;
+DWORD dwInstanceNumber;
+DWORD dwError = ERROR_SUCCESS;
+CONFIGRET ret = CR_SUCCESS;
+
+/* Generated ID is: Root\\ */
+dwInstanceNumber = 0;
+while (dwError == ERROR_SUCCESS)
+{
+if (dwInstanceNumber >= 1)
+return CR_FAILURE;
+
+swprintf(szGeneratedInstance, L"Root\\%ls\\%04lu",
+ pszDeviceID, dwInstanceNumber);
+
+/* Try to open the enum key of the device instance */
+dwError = RegOpenKeyEx(hEnumKey, szGeneratedInstance, 0, 
KEY_QUERY_VALUE, );
+if (dwError == ERROR_SUCCESS)
+{
+RegCloseKey(hKey);
+dwInstanceNumber++;
+}
+}
+
+/* pszDeviceID is an out parameter too for generated IDs */
+if (wcslen(szGeneratedInstance) > ulLength)
+{
+ret = CR_BUFFER_SMALL;
+}
+else
+{
+wcscpy(pszDeviceID, szGeneratedInstance);
+}
+
+return ret;
+}
+
+
 /* Function 28 */
 DWORD
 WINAPI
@@ -3010,36 +3055,10 @@ PNP_CreateDevInst(
 
 if (ulFlags & CM_CREATE_DEVNODE_GENERATE_ID)
 {
-WCHAR szGeneratedInstance[MAX_DEVICE_ID_LEN];
-DWORD dwInstanceNumber;
-DWORD dwError = ERROR_SUCCESS;
-HKEY hKey;
-
-/* Generated ID is: Root\\ */
-dwInstanceNumber = 0;
-while (dwError == ERROR_SUCCESS)
-{
-swprintf(szGeneratedInstance, L"Root\\%ls\\%04lu",
- pszDeviceID, dwInstanceNumber);
-
-/* Try to open the enum key of the device instance */
-dwError = RegOpenKeyEx(hEnumKey, szGeneratedInstance, 0, 
KEY_QUERY_VALUE, );
-if (dwError == ERROR_SUCCESS)
-{
-RegCloseKey(hKey);
-dwInstanceNumber++;
-}
-}
-
-/* pszDeviceID is an out parameter too for generated IDs */
-if (wcslen(szGeneratedInstance) > ulLength)
-{
-ret = CR_BUFFER_SMALL;
-}
-else
-{
-wcscpy(pszDeviceID, szGeneratedInstance);
-}
+ret = GenerateDeviceID(pszDeviceID,
+   ulLength);
+if (ret != CR_SUCCESS)
+return ret;
 }
 
 /* Create the device instance */



[ros-diffs] [reactos] 01/01: [UMPNPMGR] PNP_CreateDevInst: Do not create a new device while generating a device id

2022-04-18 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=426687becf36fb4c9a51e7dc64e65ad0d969391b

commit 426687becf36fb4c9a51e7dc64e65ad0d969391b
Author: Eric Kohl 
AuthorDate: Mon Apr 18 12:59:41 2022 +0200
Commit: Eric Kohl 
CommitDate: Mon Apr 18 12:59:41 2022 +0200

[UMPNPMGR] PNP_CreateDevInst: Do not create a new device while generating a 
device id
---
 base/services/umpnpmgr/rpcserver.c | 41 +++---
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 1262e46d661..be39d95c4c2 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -3012,39 +3012,38 @@ PNP_CreateDevInst(
 {
 WCHAR szGeneratedInstance[MAX_DEVICE_ID_LEN];
 DWORD dwInstanceNumber;
+DWORD dwError = ERROR_SUCCESS;
+HKEY hKey;
 
 /* Generated ID is: Root\\ */
 dwInstanceNumber = 0;
-do
+while (dwError == ERROR_SUCCESS)
 {
 swprintf(szGeneratedInstance, L"Root\\%ls\\%04lu",
  pszDeviceID, dwInstanceNumber);
 
-/* Try to create a device instance with this ID */
-ret = CreateDeviceInstance(szGeneratedInstance);
-
-dwInstanceNumber++;
+/* Try to open the enum key of the device instance */
+dwError = RegOpenKeyEx(hEnumKey, szGeneratedInstance, 0, 
KEY_QUERY_VALUE, );
+if (dwError == ERROR_SUCCESS)
+{
+RegCloseKey(hKey);
+dwInstanceNumber++;
+}
 }
-while (ret == CR_ALREADY_SUCH_DEVINST);
 
-if (ret == CR_SUCCESS)
+/* pszDeviceID is an out parameter too for generated IDs */
+if (wcslen(szGeneratedInstance) > ulLength)
 {
-/* pszDeviceID is an out parameter too for generated IDs */
-if (wcslen(szGeneratedInstance) > ulLength)
-{
-ret = CR_BUFFER_SMALL;
-}
-else
-{
-wcscpy(pszDeviceID, szGeneratedInstance);
-}
+ret = CR_BUFFER_SMALL;
+}
+else
+{
+wcscpy(pszDeviceID, szGeneratedInstance);
 }
 }
-else
-{
-/* Create the device instance */
-ret = CreateDeviceInstance(pszDeviceID);
-}
+
+/* Create the device instance */
+ret = CreateDeviceInstance(pszDeviceID);
 
 DPRINT("PNP_CreateDevInst() done (returns %lx)\n", ret);
 



[ros-diffs] [reactos] 01/01: [UMPNPMGR] PNP_GetRelatedDeviceInstance must return the root device as the parent of non-existing devices

2022-04-18 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=11886ebec2ad98d4d9f0e75e88bcaa355e11596d

commit 11886ebec2ad98d4d9f0e75e88bcaa355e11596d
Author: Eric Kohl 
AuthorDate: Mon Apr 18 09:48:03 2022 +0200
Commit: Eric Kohl 
CommitDate: Mon Apr 18 09:48:03 2022 +0200

[UMPNPMGR] PNP_GetRelatedDeviceInstance must return the root device as the 
parent of non-existing devices
---
 base/services/umpnpmgr/rpcserver.c | 36 +---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index 470a9b67622..1262e46d661 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -413,6 +413,17 @@ IsRootDeviceInstanceID(
 }
 
 
+static
+BOOL
+IsPresentDeviceInstanceID(
+_In_ LPWSTR pszDeviceInstanceID)
+{
+DWORD ulStatus, ulProblem;
+
+return (GetDeviceStatus(pszDeviceInstanceID, , ) == 
CR_SUCCESS);
+}
+
+
 static
 CONFIGRET
 OpenConfigurationKey(
@@ -781,10 +792,29 @@ PNP_GetRelatedDeviceInstance(
 if (!IsValidDeviceInstanceID(pDeviceID))
 return CR_INVALID_DEVINST;
 
-/* The root device does not have a parent device or sibling devices */
-if ((ulRelationship == PNP_GET_PARENT_DEVICE_INSTANCE) ||
-(ulRelationship == PNP_GET_SIBLING_DEVICE_INSTANCE))
+if (ulRelationship == PNP_GET_PARENT_DEVICE_INSTANCE)
+{
+/* The root device does not have a parent */
+if (IsRootDeviceInstanceID(pDeviceID))
+return CR_NO_SUCH_DEVINST;
+
+/* Return the root device for non existing devices */
+if (!IsPresentDeviceInstanceID(pDeviceID))
+{
+if ((wcslen(szRootDeviceInstanceID) + 1) > *pulLength)
+{
+*pulLength = wcslen(szRootDeviceInstanceID) + 1;
+return CR_BUFFER_SMALL;
+}
+
+wcscpy(pRelatedDeviceId, szRootDeviceInstanceID);
+*pulLength = wcslen(szRootDeviceInstanceID) + 1;
+return CR_SUCCESS;
+}
+}
+else if (ulRelationship == PNP_GET_SIBLING_DEVICE_INSTANCE)
 {
+/* The root device does not have siblings */
 if (IsRootDeviceInstanceID(pDeviceID))
 return CR_NO_SUCH_DEVINST;
 }



  1   2   3   4   5   6   7   8   9   10   >