Skip to content

Commit 957e677

Browse files
committed
Revert "Fix KPH install check and change KPH driver start to Auto"
This reverts commit c44b9b3.
1 parent d460e77 commit 957e677

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

phlib/kph.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,7 @@ NTSTATUS KphConnect2(
9191
_In_ PWSTR FileName
9292
)
9393
{
94-
KPH_PARAMETERS parameters;
95-
96-
parameters.SecurityLevel = KphSecuritySignatureCheck;
97-
parameters.CreateDynamicConfiguration = TRUE;
98-
99-
return KphConnect2Ex(DeviceName, FileName, &parameters);
94+
return KphConnect2Ex(DeviceName, FileName, NULL);
10095
}
10196

10297
NTSTATUS KphConnect2Ex(
@@ -122,12 +117,12 @@ NTSTATUS KphConnect2Ex(
122117

123118
status = KphConnect(fullDeviceName);
124119

125-
if (NT_SUCCESS(status) || status == STATUS_ADDRESS_ALREADY_EXISTS)
120+
if (status == STATUS_ADDRESS_ALREADY_EXISTS)
126121
return status;
127122

128123
// Load the driver, and try again.
129124

130-
KphInstallEx(DeviceName, FileName, Parameters);
125+
KphInstall(DeviceName, FileName);
131126

132127
// Try to open the device again.
133128

@@ -286,7 +281,7 @@ NTSTATUS KphInstallEx(
286281
return STATUS_OBJECT_NAME_NOT_FOUND;
287282
}
288283

289-
if (NT_SUCCESS(status = NtOpenProcessToken(
284+
if (NT_SUCCESS(NtOpenProcessToken(
290285
NtCurrentProcess(),
291286
TOKEN_ADJUST_PRIVILEGES,
292287
&tokenHandle
@@ -296,9 +291,6 @@ NTSTATUS KphInstallEx(
296291
NtClose(tokenHandle);
297292
}
298293

299-
if (!NT_SUCCESS(status))
300-
goto CleanupExit;
301-
302294
keyName = PhConcatStrings(
303295
2,
304296
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
@@ -347,7 +339,7 @@ NTSTATUS KphInstallEx(
347339
if (!NT_SUCCESS(status = NtSetValueKey(keyHandle, &valueName, 0, REG_DWORD, &parameters, sizeof(ULONG))))
348340
goto CleanupExit;
349341

350-
parameters = SERVICE_AUTO_START;
342+
parameters = SERVICE_DEMAND_START;
351343
RtlInitUnicodeString(&valueName, L"Start");
352344
if (!NT_SUCCESS(status = NtSetValueKey(keyHandle, &valueName, 0, REG_DWORD, &parameters, sizeof(ULONG))))
353345
goto CleanupExit;

0 commit comments

Comments
 (0)