https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a05051f5546ad2a118daf…
commit a05051f5546ad2a118daf4e9de484b10b472f152
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sat Feb 29 14:26:16 2020 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sat Feb 29 14:26:16 2020 +0100
[NTOS:IO] Move IopRemovePlugPlayEvent around and add the ResponseData parameter (not used yet)
---
ntoskrnl/io/pnpmgr/plugplay.c | 54 +++++++++++++++++++++++--------------------
1 file changed, 29 insertions(+), 25 deletions(-)
diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c
index 7782c3ee135..c1d5baa816a 100644
--- a/ntoskrnl/io/pnpmgr/plugplay.c
+++ b/ntoskrnl/io/pnpmgr/plugplay.c
@@ -91,30 +91,6 @@ IopQueueTargetDeviceEvent(const GUID *Guid,
}
-/*
- * Remove the current PnP event from the tail of the event queue
- * and signal IopPnpNotifyEvent if there is yet another event in the queue.
- */
-static NTSTATUS
-IopRemovePlugPlayEvent(VOID)
-{
- /* Remove a pnp event entry from the tail of the queue */
- if (!IsListEmpty(&IopPnpEventQueueHead))
- {
- ExFreePool(CONTAINING_RECORD(RemoveTailList(&IopPnpEventQueueHead), PNP_EVENT_ENTRY, ListEntry));
- }
-
- /* Signal the next pnp event in the queue */
- if (!IsListEmpty(&IopPnpEventQueueHead))
- {
- KeSetEvent(&IopPnpNotifyEvent,
- 0,
- FALSE);
- }
-
- return STATUS_SUCCESS;
-}
-
static PDEVICE_OBJECT
IopTraverseDeviceNode(PDEVICE_NODE Node, PUNICODE_STRING DeviceInstance)
{
@@ -245,6 +221,34 @@ IopPnpEnumerateDevice(PPLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA DeviceData)
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.
+ */
+static
+NTSTATUS
+IopRemovePlugPlayEvent(
+ _In_ PPLUGPLAY_CONTROL_USER_RESPONSE_DATA ResponseData)
+{
+ /* Remove a pnp event entry from the tail of the queue */
+ if (!IsListEmpty(&IopPnpEventQueueHead))
+ {
+ ExFreePool(CONTAINING_RECORD(RemoveTailList(&IopPnpEventQueueHead), PNP_EVENT_ENTRY, ListEntry));
+ }
+
+ /* Signal the next pnp event in the queue */
+ if (!IsListEmpty(&IopPnpEventQueueHead))
+ {
+ KeSetEvent(&IopPnpNotifyEvent,
+ 0,
+ FALSE);
+ }
+
+ return STATUS_SUCCESS;
+}
+
+
static NTSTATUS
IopGetInterfaceDeviceList(PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA DeviceList)
{
@@ -1348,7 +1352,7 @@ NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass,
case PlugPlayControlUserResponse:
if (!Buffer || BufferLength < sizeof(PLUGPLAY_CONTROL_USER_RESPONSE_DATA))
return STATUS_INVALID_PARAMETER;
- return IopRemovePlugPlayEvent();
+ return IopRemovePlugPlayEvent((PPLUGPLAY_CONTROL_USER_RESPONSE_DATA)Buffer);
// case PlugPlayControlGenerateLegacyDevice:
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ebeeb9dcb85726f08f5cc…
commit ebeeb9dcb85726f08f5ccaaaabbf28d20249cf21
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Tue Feb 25 03:12:35 2020 +0100
Commit: Victor Perevertkin <victor(a)perevertkin.ru>
CommitDate: Thu Feb 27 21:22:11 2020 +0300
[DOC] 3rd Party Files.txt: Add 'Schily Tools, mkisofs' entry
---
media/doc/3rd Party Files.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/media/doc/3rd Party Files.txt b/media/doc/3rd Party Files.txt
index ad235dfe8e6..9d7850fd3f6 100644
--- a/media/doc/3rd Party Files.txt
+++ b/media/doc/3rd Party Files.txt
@@ -1,3 +1,4 @@
+Files synced with various file system upstreams can be found in /media/doc/README.FSD
Files synced with Wine can be found in /media/doc/README.WINE
Other things synced with other projects:
@@ -93,3 +94,7 @@ Website: http://libpng.sourceforge.net/
Title: ACPICA
Used Version: 20200110
Website: https://acpica.org/
+
+Title: Schily Tools, mkisofs
+Used Version: schily-2017-09-07
+Website: https://sourceforge.net/projects/schilytools/
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dfe5e810cc493898c9ffe…
commit dfe5e810cc493898c9ffe482f0460325bededc35
Author: Bișoc George <fraizeraust99(a)gmail.com>
AuthorDate: Thu Feb 27 18:45:21 2020 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri Feb 28 02:45:21 2020 +0900
[UTILMAN] Small refactor on process management code (#2375)
Implement a small helper, GetProcessID(), that will be used to return the process ID which we are interested in. This largely removes some duplicated code. The following patch addresses the Jansen's comment on #1608 PR.
---
base/applications/utilman/precomp.h | 1 +
base/applications/utilman/process.c | 127 +++++++++++++++++++++++-------------
2 files changed, 81 insertions(+), 47 deletions(-)
diff --git a/base/applications/utilman/precomp.h b/base/applications/utilman/precomp.h
index db665e793c2..fba37387efc 100644
--- a/base/applications/utilman/precomp.h
+++ b/base/applications/utilman/precomp.h
@@ -59,6 +59,7 @@ INT ListBoxRefreshContents(VOID);
VOID CheckUtilityState(BOOL bUtilState);
/* process.c */
+DWORD GetProcessID(IN LPCWSTR lpProcessName);
BOOL IsProcessRunning(IN LPCWSTR lpProcessName);
BOOL LaunchProcess(LPCWSTR lpProcessName);
BOOL CloseProcess(IN LPCWSTR lpProcessName);
diff --git a/base/applications/utilman/process.c b/base/applications/utilman/process.c
index 45bae49276f..71e4c589360 100644
--- a/base/applications/utilman/process.c
+++ b/base/applications/utilman/process.c
@@ -12,29 +12,28 @@
/* FUNCTIONS ******************************************************************/
/**
- * @IsProcessRunning
+ * @GetProcessID
*
- * Checks if a process is running.
+ * Returns the process executable ID based on the given executable name.
*
- * @param[in] ProcName
+ * @param[in] lpProcessName
* The name of the executable process.
*
* @return
- * Returns TRUE if the given process' name is running,
- * FALSE otherwise.
+ * Returns the ID number of the process, otherwise 0.
*
*/
-BOOL IsProcessRunning(IN LPCWSTR lpProcessName)
+DWORD GetProcessID(IN LPCWSTR lpProcessName)
{
- BOOL bIsRunning = FALSE;
- PROCESSENTRY32W Process = {0};
+ PROCESSENTRY32W Process;
- /* Create a snapshot and check whether the given process' executable name is running */
+ /* Create a snapshot and check if the given process name matches with the one from the process entry structure */
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot == INVALID_HANDLE_VALUE)
- return FALSE;
+ return 0;
+ /* Get the whole size of the structure */
Process.dwSize = sizeof(Process);
/* Enumerate the processes */
@@ -44,17 +43,62 @@ BOOL IsProcessRunning(IN LPCWSTR lpProcessName)
{
if (_wcsicmp(Process.szExeFile, lpProcessName) == 0)
{
- /* The process we are searching for is running */
- bIsRunning = TRUE;
- break;
+ /* The names match, return the process ID we're interested */
+ CloseHandle(hSnapshot);
+ return Process.th32ProcessID;
}
}
while (Process32NextW(hSnapshot, &Process));
}
- /* Free the handle and return */
CloseHandle(hSnapshot);
- return bIsRunning;
+ return 0;
+}
+
+/**
+ * @IsProcessRunning
+ *
+ * Checks if a process is running.
+ *
+ * @param[in] lpProcessName
+ * The name of the executable process.
+ *
+ * @return
+ * Returns TRUE if the given process' name is running,
+ * FALSE otherwise.
+ *
+ */
+BOOL IsProcessRunning(IN LPCWSTR lpProcessName)
+{
+ DWORD dwReturn, dwProcessID;
+ HANDLE hProcess;
+
+ /* Get the process ID */
+ dwProcessID = GetProcessID(lpProcessName);
+ if (dwProcessID == 0)
+ {
+ return FALSE;
+ }
+
+ /* Synchronize the process to get its signaling state */
+ hProcess = OpenProcess(SYNCHRONIZE, FALSE, dwProcessID);
+ if (!hProcess)
+ {
+ DPRINT("IsProcessRunning(): Failed to open the process! (Error: %lu)", GetLastError());
+ return FALSE;
+ }
+
+ /* Wait for the process */
+ dwReturn = WaitForSingleObject(hProcess, 0);
+ if (dwReturn == WAIT_TIMEOUT)
+ {
+ /* The process is still running */
+ CloseHandle(hProcess);
+ return TRUE;
+ }
+
+ CloseHandle(hProcess);
+ return FALSE;
}
/**
@@ -147,43 +191,32 @@ BOOL LaunchProcess(LPCWSTR lpProcessName)
*/
BOOL CloseProcess(IN LPCWSTR lpProcessName)
{
- BOOL bSuccess = FALSE;
- PROCESSENTRY32W Process = {0};
+ HANDLE hProcess;
+ DWORD dwProcessID;
- /* Create a snapshot and check if the given process' executable name is running */
- HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
-
- if (hSnapshot == INVALID_HANDLE_VALUE)
+ /* Get the process ID */
+ dwProcessID = GetProcessID(lpProcessName);
+ if (dwProcessID == 0)
+ {
return FALSE;
+ }
- Process.dwSize = sizeof(Process);
+ /* Make sure that the given process ID is not ours, the parent process, so that we do not kill ourselves */
+ if (dwProcessID == GetCurrentProcessId())
+ {
+ return FALSE;
+ }
- /* Enumerate the processes */
- if (Process32FirstW(hSnapshot, &Process))
+ /* Open the process so that we can terminate it */
+ hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwProcessID);
+ if (!hProcess)
{
- do
- {
- if (_wcsicmp(Process.szExeFile, lpProcessName) == 0)
- {
- /*
- * We have found the process. However we must make
- * sure that we DO NOT kill ourselves (the process ID
- * matching with the current parent process ID).
- */
- HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, Process.th32ProcessID);
- if ((hProcess != NULL) && (Process.th32ProcessID != GetCurrentProcessId()))
- {
- TerminateProcess(hProcess, 0);
- CloseHandle(hProcess);
- }
- bSuccess = TRUE;
- break;
- }
- }
- while (Process32NextW(hSnapshot, &Process));
+ DPRINT("CloseProcess(): Failed to open the process for termination! (Error: %lu)", GetLastError());
+ return FALSE;
}
- /* Free the handle and return */
- CloseHandle(hSnapshot);
- return bSuccess;
+ /* Terminate it */
+ TerminateProcess(hProcess, 0);
+ CloseHandle(hProcess);
+ return TRUE;
}