mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-01-20 20:37:27 +01:00
Updated various types from UINT to QWORD
The goal is to avoid pointer truncation where possible so this commit changes parameter types to qword where it makes the most sense. This includes all handles (event, process, thread, registry), addresses and generic parameters.
This commit is contained in:
parent
4043a6ff2b
commit
6b0637e45c
@ -28,7 +28,7 @@ DWORD request_sys_eventlog_open(Remote * remote, Packet * packet)
|
||||
result = GetLastError();
|
||||
}
|
||||
else {
|
||||
packet_add_tlv_uint(response, TLV_TYPE_EVENT_HANDLE, (DWORD)hEvent);
|
||||
packet_add_tlv_qword(response, TLV_TYPE_EVENT_HANDLE, (QWORD)hEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ DWORD request_sys_eventlog_numrecords(Remote * remote, Packet * packet)
|
||||
DWORD numRecords;
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
|
||||
hEvent = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_EVENT_HANDLE);
|
||||
hEvent = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_EVENT_HANDLE);
|
||||
|
||||
if(!hEvent) {
|
||||
result = ERROR_INVALID_PARAMETER;
|
||||
@ -88,7 +88,7 @@ DWORD request_sys_eventlog_read(Remote * remote, Packet * packet)
|
||||
EVENTLOGRECORD * buf = NULL;
|
||||
BYTE * str = NULL;
|
||||
|
||||
hEvent = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_EVENT_HANDLE);
|
||||
hEvent = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_EVENT_HANDLE);
|
||||
readFlags = (DWORD)packet_get_tlv_value_uint(packet, TLV_TYPE_EVENT_READFLAGS);
|
||||
recordOffset = (DWORD)packet_get_tlv_value_uint(packet, TLV_TYPE_EVENT_RECORDOFFSET);
|
||||
|
||||
@ -159,7 +159,7 @@ DWORD request_sys_eventlog_oldest(Remote * remote, Packet * packet)
|
||||
{
|
||||
Packet * response = packet_create_response(packet);
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
HANDLE hEvent = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_EVENT_HANDLE);
|
||||
HANDLE hEvent = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_EVENT_HANDLE);
|
||||
DWORD oldest;
|
||||
|
||||
if(GetOldestEventLogRecord(hEvent, &oldest) == 0) {
|
||||
@ -187,7 +187,7 @@ DWORD request_sys_eventlog_clear(Remote * remote, Packet * packet)
|
||||
{
|
||||
Packet * response = packet_create_response(packet);
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
HANDLE hEvent = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_EVENT_HANDLE);
|
||||
HANDLE hEvent = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_EVENT_HANDLE);
|
||||
|
||||
if(ClearEventLog(hEvent, NULL) == 0) {
|
||||
result = GetLastError();
|
||||
@ -209,7 +209,7 @@ DWORD request_sys_eventlog_close(Remote * remote, Packet * packet)
|
||||
{
|
||||
Packet * response = packet_create_response(packet);
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
HANDLE hEvent = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_EVENT_HANDLE);
|
||||
HANDLE hEvent = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_EVENT_HANDLE);
|
||||
|
||||
if(CloseEventLog(hEvent) == 0) {
|
||||
result = GetLastError();
|
||||
|
@ -21,7 +21,7 @@ DWORD request_sys_process_image_load(Remote *remote, Packet *packet)
|
||||
LPCSTR image;
|
||||
HMODULE base;
|
||||
|
||||
handle = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
handle = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
image = packet_get_tlv_value_string(packet, TLV_TYPE_IMAGE_FILE_PATH);
|
||||
|
||||
do
|
||||
@ -77,7 +77,7 @@ DWORD request_sys_process_image_get_proc_address(Remote *remote, Packet *packet)
|
||||
LPCSTR procedure;
|
||||
LPVOID address = NULL;
|
||||
|
||||
process = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
process = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
image = packet_get_tlv_value_string(packet, TLV_TYPE_IMAGE_FILE);
|
||||
procedure = packet_get_tlv_value_string(packet, TLV_TYPE_PROCEDURE_NAME);
|
||||
|
||||
@ -122,8 +122,7 @@ DWORD request_sys_process_image_get_proc_address(Remote *remote, Packet *packet)
|
||||
}
|
||||
|
||||
// Set the procedure address on the response
|
||||
packet_add_tlv_uint(response, TLV_TYPE_PROCEDURE_ADDRESS,
|
||||
(DWORD)address);
|
||||
packet_add_tlv_qword(response, TLV_TYPE_PROCEDURE_ADDRESS, (QWORD)address);
|
||||
|
||||
} while (0);
|
||||
|
||||
@ -153,7 +152,7 @@ DWORD request_sys_process_image_unload(Remote *remote, Packet *packet)
|
||||
LPVOID base;
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
|
||||
handle = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
handle = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
base = (LPVOID)packet_get_tlv_value_uint(packet, TLV_TYPE_IMAGE_BASE);
|
||||
|
||||
do
|
||||
@ -205,7 +204,7 @@ DWORD request_sys_process_image_get_images(Remote *remote, Packet *packet)
|
||||
DWORD needed = 0, actual, tries = 0;
|
||||
DWORD index;
|
||||
|
||||
handle = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
handle = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ DWORD request_sys_process_memory_allocate(Remote *remote, Packet *packet)
|
||||
DWORD alloc, prot;
|
||||
|
||||
// Snag the TLV values
|
||||
handle = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
handle = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
base = (LPVOID)packet_get_tlv_value_qword(packet, TLV_TYPE_BASE_ADDRESS);
|
||||
size = (SIZE_T)packet_get_tlv_value_uint(packet, TLV_TYPE_LENGTH);
|
||||
alloc = packet_get_tlv_value_uint(packet, TLV_TYPE_ALLOCATION_TYPE);
|
||||
@ -56,7 +56,7 @@ DWORD request_sys_process_memory_free(Remote *remote, Packet *packet)
|
||||
LPVOID base;
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
|
||||
handle = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
handle = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
base = (LPVOID)packet_get_tlv_value_qword(packet, TLV_TYPE_BASE_ADDRESS);
|
||||
size = packet_get_tlv_value_uint(packet, TLV_TYPE_LENGTH);
|
||||
|
||||
@ -88,7 +88,7 @@ DWORD request_sys_process_memory_read(Remote *remote, Packet *packet)
|
||||
SIZE_T bytesRead = 0;
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
|
||||
handle = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
handle = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
base = (LPVOID)packet_get_tlv_value_qword(packet, TLV_TYPE_BASE_ADDRESS);
|
||||
size = packet_get_tlv_value_uint(packet, TLV_TYPE_LENGTH);
|
||||
|
||||
@ -151,7 +151,7 @@ DWORD request_sys_process_memory_write(Remote *remote, Packet *packet)
|
||||
size_t written = 0;
|
||||
Tlv data;
|
||||
|
||||
handle = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
handle = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
base = (LPVOID)packet_get_tlv_value_qword(packet, TLV_TYPE_BASE_ADDRESS);
|
||||
|
||||
do
|
||||
@ -200,7 +200,7 @@ DWORD request_sys_process_memory_query(Remote *remote, Packet *packet)
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
SIZE_T size = 0;
|
||||
|
||||
handle = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
handle = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
base = (LPVOID)packet_get_tlv_value_qword(packet, TLV_TYPE_BASE_ADDRESS);
|
||||
|
||||
// Zero the info buffer
|
||||
@ -256,7 +256,7 @@ DWORD request_sys_process_memory_protect(Remote *remote, Packet *packet)
|
||||
DWORD prot, old;
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
|
||||
handle = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
handle = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
base = (LPVOID)packet_get_tlv_value_qword(packet, TLV_TYPE_BASE_ADDRESS);
|
||||
size = packet_get_tlv_value_uint(packet, TLV_TYPE_LENGTH);
|
||||
prot = packet_get_tlv_value_uint(packet, TLV_TYPE_PROTECTION);
|
||||
|
@ -39,17 +39,15 @@ DWORD request_sys_process_attach(Remote *remote, Packet *packet)
|
||||
// Otherwise, attach.
|
||||
else
|
||||
{
|
||||
BOOLEAN inherit = packet_get_tlv_value_bool(packet,
|
||||
TLV_TYPE_INHERIT);
|
||||
DWORD permission = packet_get_tlv_value_uint(packet,
|
||||
TLV_TYPE_PROCESS_PERMS);
|
||||
BOOLEAN inherit = packet_get_tlv_value_bool(packet, TLV_TYPE_INHERIT);
|
||||
DWORD permission = packet_get_tlv_value_uint(packet, TLV_TYPE_PROCESS_PERMS);
|
||||
|
||||
handle = OpenProcess(permission, inherit, pid);
|
||||
}
|
||||
|
||||
// If we have a handle, add it to the response
|
||||
if (handle)
|
||||
packet_add_tlv_uint(response, TLV_TYPE_HANDLE, (DWORD)handle);
|
||||
packet_add_tlv_qword(response, TLV_TYPE_HANDLE, (QWORD)handle);
|
||||
else
|
||||
result = GetLastError();
|
||||
#else
|
||||
@ -72,7 +70,7 @@ DWORD request_sys_process_close(Remote *remote, Packet *packet)
|
||||
Packet *response = packet_create_response(packet);
|
||||
HANDLE handle;
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
handle = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
handle = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
|
||||
|
||||
if (handle)
|
||||
@ -572,7 +570,7 @@ DWORD request_sys_process_execute(Remote *remote, Packet *packet)
|
||||
// Add the process identifier to the response packet
|
||||
packet_add_tlv_uint(response, TLV_TYPE_PID, pi.dwProcessId);
|
||||
|
||||
packet_add_tlv_uint(response, TLV_TYPE_PROCESS_HANDLE,(DWORD)pi.hProcess);
|
||||
packet_add_tlv_qword(response, TLV_TYPE_PROCESS_HANDLE, (QWORD)pi.hProcess);
|
||||
|
||||
CloseHandle(pi.hThread);
|
||||
}
|
||||
@ -794,7 +792,7 @@ DWORD request_sys_process_execute(Remote *remote, Packet *packet)
|
||||
default:
|
||||
dprintf("child pid is %d\n", pid);
|
||||
packet_add_tlv_uint(response, TLV_TYPE_PID, (DWORD)pid);
|
||||
packet_add_tlv_uint(response, TLV_TYPE_PROCESS_HANDLE, (DWORD)pid);
|
||||
packet_add_tlv_qword(response, TLV_TYPE_PROCESS_HANDLE, (QWORD)pid);
|
||||
if (flags & PROCESS_EXECUTE_FLAG_CHANNELIZED) {
|
||||
if(have_pty) {
|
||||
dprintf("child channelized\n");
|
||||
@ -963,7 +961,7 @@ DWORD request_sys_process_get_info(Remote *remote, Packet *packet)
|
||||
DWORD needed;
|
||||
CHAR path[1024], name[256];
|
||||
|
||||
handle = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_HANDLE);
|
||||
handle = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
|
||||
|
||||
do
|
||||
{
|
||||
@ -1244,7 +1242,7 @@ DWORD request_sys_process_wait(Remote *remote, Packet *packet)
|
||||
HANDLE handle = NULL;
|
||||
DWORD result = ERROR_INVALID_PARAMETER;
|
||||
|
||||
handle = (HANDLE)packet_get_tlv_value_uint( packet, TLV_TYPE_HANDLE );
|
||||
handle = (HANDLE)packet_get_tlv_value_qword( packet, TLV_TYPE_HANDLE );
|
||||
#ifdef _WIN32
|
||||
|
||||
if( handle )
|
||||
|
@ -64,7 +64,7 @@ DWORD request_sys_process_thread_open(Remote *remote, Packet *packet)
|
||||
}
|
||||
|
||||
// Add the handle to the response packet
|
||||
packet_add_tlv_uint(response, TLV_TYPE_THREAD_HANDLE, (DWORD)handle);
|
||||
packet_add_tlv_qword(response, TLV_TYPE_THREAD_HANDLE, (QWORD)handle);
|
||||
|
||||
} while (0);
|
||||
|
||||
@ -95,9 +95,9 @@ DWORD request_sys_process_thread_create(Remote *remote, Packet *packet)
|
||||
DWORD dwThreadId;
|
||||
|
||||
// Snag the parameters
|
||||
hProcess = (HANDLE)packet_get_tlv_value_uint(packet, TLV_TYPE_PROCESS_HANDLE);
|
||||
lpEntryPoint = (LPVOID)packet_get_tlv_value_uint(packet, TLV_TYPE_ENTRY_POINT);
|
||||
lpEntryParam = (LPVOID)packet_get_tlv_value_uint(packet, TLV_TYPE_ENTRY_PARAMETER);
|
||||
hProcess = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_PROCESS_HANDLE);
|
||||
lpEntryPoint = (LPVOID)packet_get_tlv_value_qword(packet, TLV_TYPE_ENTRY_POINT);
|
||||
lpEntryParam = (LPVOID)packet_get_tlv_value_qword(packet, TLV_TYPE_ENTRY_PARAMETER);
|
||||
dwCreateFlags = packet_get_tlv_value_uint(packet, TLV_TYPE_CREATION_FLAGS);
|
||||
|
||||
do
|
||||
@ -149,7 +149,7 @@ DWORD request_sys_process_thread_create(Remote *remote, Packet *packet)
|
||||
dprintf("[THREAD CREATE] Thread creation succeeded");
|
||||
// Set the thread identifier and handle on the response
|
||||
packet_add_tlv_uint(response, TLV_TYPE_THREAD_ID, dwThreadId);
|
||||
packet_add_tlv_uint(response, TLV_TYPE_THREAD_HANDLE, (DWORD)hThread);
|
||||
packet_add_tlv_qword(response, TLV_TYPE_THREAD_HANDLE, (QWORD)hThread);
|
||||
|
||||
} while (0);
|
||||
|
||||
@ -169,8 +169,7 @@ DWORD request_sys_process_thread_close(Remote *remote, Packet *packet)
|
||||
HANDLE thread;
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_uint(packet,
|
||||
TLV_TYPE_THREAD_HANDLE)))
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_THREAD_HANDLE)))
|
||||
CloseHandle(thread);
|
||||
else
|
||||
result = ERROR_INVALID_PARAMETER;
|
||||
@ -258,8 +257,7 @@ DWORD request_sys_process_thread_suspend(Remote *remote, Packet *packet)
|
||||
HANDLE thread;
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_uint(packet,
|
||||
TLV_TYPE_THREAD_HANDLE)))
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_THREAD_HANDLE)))
|
||||
{
|
||||
if (SuspendThread(thread) == (DWORD)-1)
|
||||
result = GetLastError();
|
||||
@ -283,8 +281,7 @@ DWORD request_sys_process_thread_resume(Remote *remote, Packet *packet)
|
||||
HANDLE thread;
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_uint(packet,
|
||||
TLV_TYPE_THREAD_HANDLE)))
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_THREAD_HANDLE)))
|
||||
{
|
||||
if (ResumeThread(thread) == (DWORD)-1)
|
||||
result = GetLastError();
|
||||
@ -310,8 +307,7 @@ DWORD request_sys_process_thread_terminate(Remote *remote, Packet *packet)
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
DWORD code;
|
||||
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_uint(packet,
|
||||
TLV_TYPE_THREAD_HANDLE)))
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_THREAD_HANDLE)))
|
||||
{
|
||||
code = packet_get_tlv_value_uint(packet, TLV_TYPE_EXIT_CODE);
|
||||
|
||||
@ -339,8 +335,7 @@ DWORD request_sys_process_thread_query_regs(Remote *remote, Packet *packet)
|
||||
|
||||
do
|
||||
{
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_uint(packet,
|
||||
TLV_TYPE_THREAD_HANDLE)))
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_THREAD_HANDLE)))
|
||||
{
|
||||
CONTEXT context;
|
||||
DWORD index;
|
||||
@ -436,8 +431,7 @@ DWORD request_sys_process_thread_set_regs(Remote *remote, Packet *packet)
|
||||
|
||||
do
|
||||
{
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_uint(packet,
|
||||
TLV_TYPE_THREAD_HANDLE)))
|
||||
if ((thread = (HANDLE)packet_get_tlv_value_qword(packet, TLV_TYPE_THREAD_HANDLE)))
|
||||
{
|
||||
CONTEXT context;
|
||||
DWORD index = 0;
|
||||
|
@ -18,7 +18,7 @@ DWORD request_registry_check_key_exists(Remote *remote, Packet *packet)
|
||||
BOOL exists = FALSE;
|
||||
DWORD result;
|
||||
|
||||
rootKey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_ROOT_KEY);
|
||||
rootKey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_ROOT_KEY);
|
||||
baseKey = packet_get_tlv_value_string(packet, TLV_TYPE_BASE_KEY);
|
||||
|
||||
if (rootKey && baseKey)
|
||||
@ -67,7 +67,7 @@ DWORD request_registry_load_key(Remote *remote, Packet *packet)
|
||||
LPCSTR hiveFile = NULL;
|
||||
DWORD result;
|
||||
|
||||
rootKey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_ROOT_KEY);
|
||||
rootKey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_ROOT_KEY);
|
||||
baseKey = packet_get_tlv_value_string(packet, TLV_TYPE_BASE_KEY);
|
||||
hiveFile = packet_get_tlv_value_string(packet, TLV_TYPE_FILE_PATH);
|
||||
|
||||
@ -89,7 +89,7 @@ DWORD request_registry_unload_key(Remote *remote, Packet *packet)
|
||||
HKEY rootKey = NULL;
|
||||
DWORD result;
|
||||
|
||||
rootKey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_ROOT_KEY);
|
||||
rootKey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_ROOT_KEY);
|
||||
baseKey = packet_get_tlv_value_string(packet, TLV_TYPE_BASE_KEY);
|
||||
|
||||
if ((!rootKey) || (!baseKey))
|
||||
@ -112,7 +112,7 @@ DWORD request_registry_open_key(Remote *remote, Packet *packet)
|
||||
DWORD permission;
|
||||
DWORD result;
|
||||
|
||||
rootKey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_ROOT_KEY);
|
||||
rootKey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_ROOT_KEY);
|
||||
baseKey = packet_get_tlv_value_string(packet, TLV_TYPE_BASE_KEY);
|
||||
permission = packet_get_tlv_value_uint(packet, TLV_TYPE_PERMISSION);
|
||||
|
||||
@ -129,7 +129,9 @@ DWORD request_registry_open_key(Remote *remote, Packet *packet)
|
||||
|
||||
// Add the HKEY if we succeeded, but always return a result
|
||||
if (result == ERROR_SUCCESS)
|
||||
packet_add_tlv_uint(response, TLV_TYPE_HKEY, (DWORD)resKey);
|
||||
{
|
||||
packet_add_tlv_qword(response, TLV_TYPE_HKEY, (QWORD)resKey);
|
||||
}
|
||||
|
||||
packet_add_tlv_uint(response, TLV_TYPE_RESULT, result);
|
||||
|
||||
@ -156,7 +158,7 @@ DWORD request_registry_open_remote_key(Remote *remote, Packet *packet)
|
||||
DWORD result;
|
||||
|
||||
targetHost = packet_get_tlv_value_string(packet, TLV_TYPE_TARGET_HOST);
|
||||
rootKey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_ROOT_KEY);
|
||||
rootKey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_ROOT_KEY);
|
||||
|
||||
// Validate the parameters and then attempt to create the key
|
||||
if ((!rootKey) || (!targetHost))
|
||||
@ -168,7 +170,9 @@ DWORD request_registry_open_remote_key(Remote *remote, Packet *packet)
|
||||
|
||||
// Add the HKEY if we succeeded, but always return a result
|
||||
if (result == ERROR_SUCCESS)
|
||||
packet_add_tlv_uint(response, TLV_TYPE_HKEY, (DWORD)resKey);
|
||||
{
|
||||
packet_add_tlv_qword(response, TLV_TYPE_HKEY, (QWORD)resKey);
|
||||
}
|
||||
|
||||
packet_add_tlv_uint(response, TLV_TYPE_RESULT, result);
|
||||
|
||||
@ -196,7 +200,7 @@ DWORD request_registry_create_key(Remote *remote, Packet *packet)
|
||||
DWORD permission;
|
||||
DWORD result;
|
||||
|
||||
rootKey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_ROOT_KEY);
|
||||
rootKey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_ROOT_KEY);
|
||||
baseKey = packet_get_tlv_value_string(packet, TLV_TYPE_BASE_KEY);
|
||||
permission = packet_get_tlv_value_uint(packet, TLV_TYPE_PERMISSION);
|
||||
|
||||
@ -214,7 +218,9 @@ DWORD request_registry_create_key(Remote *remote, Packet *packet)
|
||||
|
||||
// Add the HKEY if we succeeded, but always return a result
|
||||
if (result == ERROR_SUCCESS)
|
||||
packet_add_tlv_uint(response, TLV_TYPE_HKEY, (DWORD)resKey);
|
||||
{
|
||||
packet_add_tlv_qword(response, TLV_TYPE_HKEY, (QWORD)resKey);
|
||||
}
|
||||
|
||||
packet_add_tlv_uint(response, TLV_TYPE_RESULT, result);
|
||||
|
||||
@ -235,7 +241,7 @@ DWORD request_registry_enum_key(Remote *remote, Packet *packet)
|
||||
{
|
||||
Packet *response = packet_create_response(packet);
|
||||
DWORD result;
|
||||
HKEY hkey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_HKEY);
|
||||
HKEY hkey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_HKEY);
|
||||
|
||||
if (!hkey)
|
||||
result = ERROR_INVALID_PARAMETER;
|
||||
@ -318,7 +324,7 @@ DWORD request_registry_delete_key(Remote *remote, Packet *packet)
|
||||
DWORD flags = 0;
|
||||
HKEY rootKey = NULL;
|
||||
|
||||
rootKey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_ROOT_KEY);
|
||||
rootKey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_ROOT_KEY);
|
||||
baseKey = packet_get_tlv_value_string(packet, TLV_TYPE_BASE_KEY);
|
||||
flags = packet_get_tlv_value_uint(packet, TLV_TYPE_FLAGS);
|
||||
|
||||
@ -352,7 +358,7 @@ DWORD request_registry_close_key(Remote *remote, Packet *packet)
|
||||
{
|
||||
Packet *response = packet_create_response(packet);
|
||||
DWORD result;
|
||||
HKEY hkey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_HKEY);
|
||||
HKEY hkey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_HKEY);
|
||||
|
||||
// No param? No love.
|
||||
if (!hkey)
|
||||
@ -388,7 +394,7 @@ DWORD request_registry_set_value(Remote *remote, Packet *packet)
|
||||
Tlv valueData;
|
||||
|
||||
// Acquire the standard TLVs
|
||||
hkey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_HKEY);
|
||||
hkey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_HKEY);
|
||||
valueName = packet_get_tlv_value_string(packet, TLV_TYPE_VALUE_NAME);
|
||||
valueType = packet_get_tlv_value_uint(packet, TLV_TYPE_VALUE_TYPE);
|
||||
|
||||
@ -436,7 +442,7 @@ DWORD request_registry_query_value(Remote *remote, Packet *packet)
|
||||
HKEY hkey = NULL;
|
||||
|
||||
// Acquire the standard TLVs
|
||||
hkey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_HKEY);
|
||||
hkey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_HKEY);
|
||||
valueName = packet_get_tlv_value_string(packet, TLV_TYPE_VALUE_NAME);
|
||||
|
||||
do
|
||||
@ -496,7 +502,7 @@ DWORD request_registry_enum_value(Remote *remote, Packet *packet)
|
||||
{
|
||||
Packet *response = packet_create_response(packet);
|
||||
DWORD result;
|
||||
HKEY hkey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_HKEY);
|
||||
HKEY hkey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_HKEY);
|
||||
|
||||
if (!hkey)
|
||||
result = ERROR_INVALID_PARAMETER;
|
||||
@ -580,7 +586,7 @@ DWORD request_registry_delete_value(Remote *remote, Packet *packet)
|
||||
DWORD result = ERROR_SUCCESS;
|
||||
HKEY hkey = NULL;
|
||||
|
||||
hkey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_HKEY);
|
||||
hkey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_HKEY);
|
||||
valueName = (LPCSTR)packet_get_tlv_value_string(packet, TLV_TYPE_VALUE_NAME);
|
||||
|
||||
// Check for invalid parameters
|
||||
@ -616,7 +622,7 @@ DWORD request_registry_query_class(Remote *remote, Packet *packet)
|
||||
HKEY hkey = NULL;
|
||||
|
||||
// Acquire the standard TLVs
|
||||
hkey = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_HKEY);
|
||||
hkey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_HKEY);
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
// General
|
||||
#define TLV_TYPE_HANDLE \
|
||||
MAKE_CUSTOM_TLV( \
|
||||
TLV_META_TYPE_UINT, \
|
||||
TLV_META_TYPE_QWORD, \
|
||||
TLV_TYPE_EXTENSION_STDAPI, \
|
||||
600)
|
||||
#define TLV_TYPE_INHERIT \
|
||||
@ -24,12 +24,12 @@
|
||||
601)
|
||||
#define TLV_TYPE_PROCESS_HANDLE \
|
||||
MAKE_CUSTOM_TLV( \
|
||||
TLV_META_TYPE_UINT, \
|
||||
TLV_META_TYPE_QWORD, \
|
||||
TLV_TYPE_EXTENSION_STDAPI, \
|
||||
630)
|
||||
#define TLV_TYPE_THREAD_HANDLE \
|
||||
MAKE_CUSTOM_TLV( \
|
||||
TLV_META_TYPE_UINT, \
|
||||
TLV_META_TYPE_QWORD, \
|
||||
TLV_TYPE_EXTENSION_STDAPI, \
|
||||
631)
|
||||
#define TLV_TYPE_PRIVILEGE \
|
||||
@ -168,7 +168,7 @@
|
||||
2402)
|
||||
#define TLV_TYPE_PROCEDURE_ADDRESS \
|
||||
MAKE_CUSTOM_TLV( \
|
||||
TLV_META_TYPE_UINT, \
|
||||
TLV_META_TYPE_QWORD, \
|
||||
TLV_TYPE_EXTENSION_STDAPI, \
|
||||
2403)
|
||||
#define TLV_TYPE_IMAGE_BASE \
|
||||
@ -204,12 +204,12 @@
|
||||
2510)
|
||||
#define TLV_TYPE_ENTRY_POINT \
|
||||
MAKE_CUSTOM_TLV( \
|
||||
TLV_META_TYPE_UINT, \
|
||||
TLV_META_TYPE_QWORD, \
|
||||
TLV_TYPE_EXTENSION_STDAPI, \
|
||||
2511)
|
||||
#define TLV_TYPE_ENTRY_PARAMETER \
|
||||
MAKE_CUSTOM_TLV( \
|
||||
TLV_META_TYPE_UINT, \
|
||||
TLV_META_TYPE_QWORD, \
|
||||
TLV_TYPE_EXTENSION_STDAPI, \
|
||||
2512)
|
||||
#define TLV_TYPE_CREATION_FLAGS \
|
||||
@ -242,7 +242,7 @@
|
||||
// Registry
|
||||
#define TLV_TYPE_HKEY \
|
||||
MAKE_CUSTOM_TLV( \
|
||||
TLV_META_TYPE_UINT, \
|
||||
TLV_META_TYPE_QWORD, \
|
||||
TLV_TYPE_EXTENSION_STDAPI, \
|
||||
1000)
|
||||
#define TLV_TYPE_ROOT_KEY TLV_TYPE_HKEY
|
||||
@ -515,7 +515,7 @@
|
||||
4000)
|
||||
#define TLV_TYPE_EVENT_HANDLE \
|
||||
MAKE_CUSTOM_TLV( \
|
||||
TLV_META_TYPE_UINT, \
|
||||
TLV_META_TYPE_QWORD, \
|
||||
TLV_TYPE_EXTENSION_STDAPI, \
|
||||
4001)
|
||||
#define TLV_TYPE_EVENT_NUMRECORDS \
|
||||
|
Loading…
Reference in New Issue
Block a user