-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathinvokesystemrelay.h
More file actions
50 lines (39 loc) · 993 Bytes
/
invokesystemrelay.h
File metadata and controls
50 lines (39 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
#pragma once
#include <fnioctl_km.h>
#include <invokesystemrelayioctl.h>
EXTERN_C_START
inline
INT
InvokeSystemRelay(
_In_z_ const CHAR *Command
)
{
INT Result = -1;
NTSTATUS Status;
FNIOCTL_HANDLE Handle = NULL;
ISR_OPEN_CLIENT *OpenClient;
CHAR EaBuffer[ISR_OPEN_EA_LENGTH + sizeof(*OpenClient)];
OpenClient =
(ISR_OPEN_CLIENT *)
IsrInitializeEa(ISR_FILE_TYPE_CLIENT, EaBuffer, sizeof(EaBuffer));
Status =
FnIoctlOpen(
ISR_DEVICE_NAME, FILE_CREATE, EaBuffer, sizeof(EaBuffer), &Handle);
if (!NT_SUCCESS(Status)) {
goto Exit;
}
Status =
FnIoctl(
Handle, ISR_IOCTL_INVOKE_SYSTEM_SUBMIT, (VOID *)Command,
(UINT32)strlen(Command) + 1, &Result, sizeof(Result), NULL, NULL);
Exit:
if (Handle != NULL) {
FnIoctlClose(Handle);
}
return Result;
}
EXTERN_C_END