Go to the source code of this file.
◆ GetFileName()
static const char* GetFileName |
( |
const char * |
path | ) |
|
|
static |
Definition at line 83 of file io_rzk_windows.c.
84 const char *pfile =
path + strlen(
path);
85 for (; pfile >
path; pfile--) {
86 if ((*pfile ==
'\\') || (*pfile ==
'/')) {
static static fork const void static count static fd const char const char static newpath const char static path const char path
References path.
Referenced by GetSystemModules().
◆ GetSystemModules()
Definition at line 94 of file io_rzk_windows.c.
97 LPVOID lpBufMods =
NULL;
98 int bufmodsize = 1024 * 1024;
100 if (!(lpBufMods =
malloc(bufmodsize))) {
101 eprintf(
"[rzk] GetSystemModules: Error can't allocate %i bytes of memory.\n", bufmodsize);
113 eprintf(
"Driver not initialized.\n");
static const char * GetFileName(const char *path)
struct _RTL_PROCESS_MODULES * PRTL_PROCESS_MODULES
#define IOCTL_GET_SYSTEM_MODULES
void * malloc(size_t size)
RTL_PROCESS_MODULE_INFORMATION Modules[1]
References rz_io_t::cb_printf, DWORD, eprintf, test-lz4-speed::fileName, GetFileName(), gHandleDriver, i, IOCTL_GET_SYSTEM_MODULES, malloc(), _RTL_PROCESS_MODULES::Modules, NULL, and _RTL_PROCESS_MODULES::NumberOfModules.
Referenced by rzk__system().
◆ Init()
Definition at line 175 of file io_rzk_windows.c.
178 if (strlen(driverPath)) {
181 eprintf(
"Installing driver: %s\n", driverPath);
187 eprintf(
"Error initalizating driver, try rzk://pathtodriver\nEx: rizin.exe rzk://c:\\rzk.sys");
190 eprintf(
"Driver present [OK]\n");
static BOOL InstallService(const char *rutaDriver, LPCTSTR lpServiceName, LPCTSTR lpDisplayName)
static BOOL InitDriver(VOID)
static BOOL RemoveService(LPCTSTR lpServiceName)
BOOL StartStopService(LPCTSTR lpServiceName, BOOL bStop)
References eprintf, FALSE, InitDriver(), InstallService(), RemoveService(), StartStopService(), and TRUE.
Referenced by rzk__open().
◆ InitDriver()
static BOOL InitDriver |
( |
VOID |
| ) |
|
|
static |
◆ InstallService()
static BOOL InstallService |
( |
const char * |
rutaDriver, |
|
|
LPCTSTR |
lpServiceName, |
|
|
LPCTSTR |
lpDisplayName |
|
) |
| |
|
static |
Definition at line 10 of file io_rzk_windows.c.
13 HANDLE hSCManager = OpenSCManager(
NULL,
NULL, SC_MANAGER_CREATE_SERVICE);
15 LPTSTR rutaDriver_ = rz_sys_conv_utf8_to_win(rutaDriver);
16 hService = CreateService(hSCManager, lpServiceName, lpDisplayName, SERVICE_START | DELETE | SERVICE_STOP, SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_IGNORE, rutaDriver_,
NULL,
NULL,
NULL,
NULL,
NULL);
18 CloseServiceHandle(hService);
22 CloseServiceHandle(hSCManager);
RZ_API void Ht_() free(HtName_(Ht) *ht)
References FALSE, free(), HANDLE, NULL, and TRUE.
Referenced by Init().
◆ ReadKernelMemory()
Definition at line 118 of file io_rzk_windows.c.
119 DWORD ret = -1, bRead = 0;
120 LPVOID lpBuffer =
NULL;
125 bufsize =
sizeof(
PA) +
len;
126 if (!(lpBuffer =
malloc(bufsize))) {
127 eprintf(
"[rzk] ReadKernelMemory: Error can't allocate %i bytes of memory.\n", bufsize);
131 p->address.QuadPart = address;
142 eprintf(
"Driver not initialized.\n");
#define IOCTL_READ_KERNEL_MEM
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
References DWORD, eprintf, free(), gHandleDriver, IOCTL_READ_KERNEL_MEM, len, malloc(), memcpy(), memset(), NULL, and p.
Referenced by rzk__read().
◆ RemoveService()
static BOOL RemoveService |
( |
LPCTSTR |
lpServiceName | ) |
|
|
static |
Definition at line 27 of file io_rzk_windows.c.
30 HANDLE hSCManager = OpenSCManager(
NULL,
NULL, SC_MANAGER_CREATE_SERVICE);
32 hService = OpenService(hSCManager, lpServiceName, SERVICE_START | DELETE | SERVICE_STOP);
34 DeleteService(hService);
35 CloseServiceHandle(hService);
38 CloseServiceHandle(hSCManager);
References FALSE, HANDLE, NULL, and TRUE.
Referenced by Init().
◆ StartStopService()
BOOL StartStopService |
( |
LPCTSTR |
lpServiceName, |
|
|
BOOL |
bStop |
|
) |
| |
Definition at line 43 of file io_rzk_windows.c.
46 SERVICE_STATUS ssStatus;
48 hSCManager = OpenSCManager(
NULL,
NULL, SC_MANAGER_CREATE_SERVICE);
50 hService = OpenService(hSCManager, lpServiceName, SERVICE_START | DELETE | SERVICE_STOP);
53 if (StartService(hService, 0,
NULL)) {
54 eprintf(
"Service started [OK]\n");
57 eprintf(
"Service started [FAIL]\n");
60 if (ControlService(hService, SERVICE_CONTROL_STOP, &ssStatus)) {
61 eprintf(
"Service Stopped [OK]\n");
64 eprintf(
"Service Stopped [FAIL]\n");
67 CloseServiceHandle(hService);
68 DeleteService(hService);
70 CloseServiceHandle(hSCManager);
References eprintf, FALSE, HANDLE, NULL, and TRUE.
Referenced by Init(), and rzk__close().
◆ WriteKernelMemory()
Definition at line 147 of file io_rzk_windows.c.
148 DWORD ret = -1, bRead = 0;
149 LPVOID lpBuffer =
NULL;
153 bufsize =
sizeof(
PA) +
len;
154 if (!(lpBuffer =
malloc(bufsize))) {
155 eprintf(
"[rzk] WriteKernelMemory: Error can't allocate %i bytes of memory.\n", bufsize);
159 p->address.QuadPart = address;
165 eprintf(
"[rzk] WriteKernelMemory: Error IOCTL_WRITE_KERNEL_MEM.\n");
170 eprintf(
"Driver not initialized.\n");
#define IOCTL_WRITE_KERNEL_MEM
References DWORD, eprintf, free(), gHandleDriver, IOCTL_WRITE_KERNEL_MEM, len, malloc(), memcpy(), NULL, and p.
Referenced by rzk__write().
◆ gHandleDriver