Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // - SutraPlex SoftWare
- #include <windows.h>
- #include <stdio.h>
- typedef __int8 u8;
- typedef __int32 s32;
- /**
- * HID_DeviceClose
- * Address : 0x100023F0
- *
- * .text:100023F0 HID_DeviceClose proc near
- * .text:100023F0
- * .text:100023F0 var_C = dword ptr -0Ch
- * .text:100023F0 var_8 = dword ptr -8
- * .text:100023F0
- * .text:100023F0 sub esp, 8
- * .text:100023F3 call sub_10002799
- * .text:100023F8 push eax
- * .text:100023F9 lea ecx, [esp+0Ch+var_8]
- * .text:100023FD call MFC42_6467
- * .text:10002402 call sub_10001E70
- * .text:10002407 mov eax, [esp+0Ch+var_8]
- * .text:1000240B mov ecx, [esp+0Ch+var_C]
- * .text:1000240F mov [eax+4], ecx
- * .text:10002412 add esp, 8
- * .text:10002415 retn
- * .text:10002415 HID_DeviceClose endp ; sp = -4
- */
- typedef s32 ( __cdecl* HID_DeviceClose ) ( void );
- HID_DeviceClose funcDeviceClose = NULL;
- /**
- * HID_DeviceInitialize
- * Address : 0x100023C0
- *
- * .text:100023C0 HID_DeviceInitialize proc near
- * .text:100023C0
- * .text:100023C0 var_C = dword ptr -0Ch
- * .text:100023C0 var_8 = dword ptr -8
- * .text:100023C0
- * .text:100023C0 sub esp, 8
- * .text:100023C3 call sub_10002799
- * .text:100023C8 push eax
- * .text:100023C9 lea ecx, [esp+0Ch+var_8]
- * .text:100023CD call MFC42_6467
- * .text:100023D2 call sub_10001000
- * .text:100023D7 mov ecx, [esp+0Ch+var_8]
- * .text:100023DB mov edx, [esp+0Ch+var_C]
- * .text:100023DF mov [ecx+4], edx
- * .text:100023E2 add esp, 8
- * .text:100023E5 retn
- * .text:100023E5 HID_DeviceInitialize endp ; sp = -4
- */
- typedef s32 ( __cdecl* HID_DeviceInitialize ) ( void );
- HID_DeviceInitialize funcDeviceInitialize = NULL;
- /**
- * HID_GetID
- * Address : 0x10002450
- *
- * .text:10002450 HID_GetID proc near
- * .text:10002450
- * .text:10002450 var_C = dword ptr -0Ch
- * .text:10002450 var_8 = dword ptr -8
- * .text:10002450
- * .text:10002450 sub esp, 8
- * .text:10002453 push esi
- * .text:10002454 call sub_10002799
- * .text:10002459 push eax
- * .text:1000245A lea ecx, [esp+10h+var_8]
- * .text:1000245E call MFC42_6467
- * .text:10002463 push 9 ; size_t
- * .text:10002465 push 1 ; size_t
- * .text:10002467 call ds:calloc
- * .text:1000246D mov esi, eax
- * .text:1000246F push esi
- * .text:10002470 call sub_100020D0
- * .text:10002475 add esp, 0Ch
- * .text:10002478 test eax, eax
- * .text:1000247A jz short loc_100024A4
- * .text:1000247C mov ecx, [esp+10h]
- * .text:10002480 mov al, [esi+1]
- * .text:10002483 push esi ; void *
- * .text:10002484 mov [ecx], al
- * .text:10002486 call ds:free
- * .text:1000248C mov edx, [esp+14h+var_8]
- * .text:10002490 mov eax, [esp+14h+var_C]
- * .text:10002494 add esp, 4
- * .text:10002497 mov [edx+4], eax
- * .text:1000249A mov eax, 1
- * .text:1000249F pop esi
- * .text:100024A0 add esp, 8
- * .text:100024A3 retn
- * .text:100024A4 ; ---------------------------------------------------------------------------
- * .text:100024A4
- * .text:100024A4 loc_100024A4: ; CODE XREF: HID_GetID+2Aj
- * .text:100024A4 push esi ; void *
- * .text:100024A5 call ds:free
- * .text:100024AB mov ecx, [esp+14h+var_8]
- * .text:100024AF mov edx, [esp+14h+var_C]
- * .text:100024B3 add esp, 4
- * .text:100024B6 xor eax, eax
- * .text:100024B8 mov [ecx+4], edx
- * .text:100024BB pop esi
- * .text:100024BC add esp, 8
- * .text:100024BF retn
- * .text:100024BF HID_GetID endp ; sp = -4
- */
- typedef s32 ( __cdecl* HID_GetID ) ( void* a_Buffer );
- HID_GetID funcGetID = NULL;
- /**
- * HID_ReadData
- * Address : 0x100024C0
- *
- * .text:100024C0 HID_ReadData proc near
- * .text:100024C0
- * .text:100024C0 var_C = dword ptr -0Ch
- * .text:100024C0 var_8 = dword ptr -8
- * .text:100024C0
- * .text:100024C0 sub esp, 8
- * .text:100024C3 push esi
- * .text:100024C4 call sub_10002799
- * .text:100024C9 push eax
- * .text:100024CA lea ecx, [esp+10h+var_8]
- * .text:100024CE call MFC42_6467
- * .text:100024D3 push 9 ; size_t
- * .text:100024D5 push 1 ; size_t
- * .text:100024D7 call ds:calloc
- * .text:100024DD mov esi, eax
- * .text:100024DF push esi
- * .text:100024E0 call sub_10002140
- * .text:100024E5 add esp, 0Ch
- * .text:100024E8 test eax, eax
- * .text:100024EA jz short loc_1000251E
- * .text:100024EC mov ecx, [esp+10h]
- * .text:100024F0 xor eax, eax
- * .text:100024F2
- * .text:100024F2 loc_100024F2: ; CODE XREF: HID_ReadData+3Dj
- * .text:100024F2 mov dl, [esi+eax+1]
- * .text:100024F6 mov [eax+ecx], dl
- * .text:100024F9 inc eax
- * .text:100024FA cmp eax, 8
- * .text:100024FD jl short loc_100024F2
- * .text:100024FF push esi ; void *
- * .text:10002500 call ds:free
- * .text:10002506 mov eax, [esp+14h+var_8]
- * .text:1000250A mov ecx, [esp+14h+var_C]
- * .text:1000250E add esp, 4
- * .text:10002511 mov [eax+4], ecx
- * .text:10002514 mov eax, 1
- * .text:10002519 pop esi
- * .text:1000251A add esp, 8
- * .text:1000251D retn
- * .text:1000251E ; ---------------------------------------------------------------------------
- * .text:1000251E
- * .text:1000251E loc_1000251E: ; CODE XREF: HID_ReadData+2Aj
- * .text:1000251E push esi ; void *
- * .text:1000251F call ds:free
- * .text:10002525 mov edx, [esp+14h+var_8]
- * .text:10002529 mov eax, [esp+14h+var_C]
- * .text:1000252D add esp, 4
- * .text:10002530 mov [edx+4], eax
- * .text:10002533 xor eax, eax
- * .text:10002535 pop esi
- * .text:10002536 add esp, 8
- * .text:10002539 retn
- * .text:10002539 HID_ReadData endp ; sp = -4
- */
- typedef s32 ( __cdecl* HID_ReadData ) ( void* a_Buffer );
- HID_ReadData funcReadData = NULL;
- /**
- * HID_SetCurrentDevice
- * Address : 0x10002540
- * .text:10002540 HID_SetCurrentDevice proc near
- * .text:10002540
- * .text:10002540 var_C = dword ptr -0Ch
- * .text:10002540 var_8 = dword ptr -8
- * .text:10002540
- * .text:10002540 sub esp, 8
- * .text:10002543 call sub_10002799
- * .text:10002548 push eax
- * .text:10002549 lea ecx, [esp+0Ch+var_8]
- * .text:1000254D call MFC42_6467
- * .text:10002552 mov eax, [esp+0Ch]
- * .text:10002556 dec eax
- * .text:10002557 push eax
- * .text:10002558 call sub_100013E0
- * .text:1000255D mov ecx, [esp+10h+var_8]
- * .text:10002561 mov edx, [esp+10h+var_C]
- * .text:10002565 mov [ecx+4], edx
- * .text:10002568 add esp, 0Ch
- * .text:1000256B retn
- * .text:1000256B HID_SetCurrentDevice endp ; sp = -4
- */
- typedef bool ( __cdecl* HID_SetCurrentDevice ) ( int a_Index );
- HID_SetCurrentDevice funcSetCurrentDevice = NULL;
- /**
- * HID_WriteCommand
- * Address : 0x10002420
- *
- * .text:10002420 HID_WriteCommand proc near
- * .text:10002420
- * .text:10002420 var_C = dword ptr -0Ch
- * .text:10002420 var_8 = dword ptr -8
- * .text:10002420
- * .text:10002420 sub esp, 8
- * .text:10002423 call sub_10002799
- * .text:10002428 push eax
- * .text:10002429 lea ecx, [esp+0Ch+var_8]
- * .text:1000242D call MFC42_6467
- * .text:10002432 mov eax, [esp+0Ch]
- * .text:10002436 push eax
- * .text:10002437 call sub_10002080
- * .text:1000243C mov ecx, [esp+10h+var_8]
- * .text:10002440 mov edx, [esp+10h+var_C]
- * .text:10002444 mov [ecx+4], edx
- * .text:10002447 add esp, 0Ch
- * .text:1000244A retn
- * .text:1000244A HID_WriteCommand endp ; sp = -4
- */
- typedef s32 ( __cdecl* HID_WriteCommand ) ( char a_Command );
- HID_WriteCommand funcWriteCommand = NULL;
- void ButtonPushed ( s32 a_NbrOfPush )
- {
- printf ( "Button Pressed %d Times\n", a_NbrOfPush );
- PROCESS_INFORMATION _ProcessInfo;
- STARTUPINFO _StartInfo;
- memset ( &_ProcessInfo, 0, sizeof ( PROCESS_INFORMATION ) );
- memset ( &_StartInfo, 0, sizeof ( STARTUPINFO ) );
- _StartInfo.cb = sizeof ( STARTUPINFO );
- CreateProcess ( "C:/Program Files/Rockstar Games/GTA San Andreas/samp.exe", "-conntect 213.251.162.217:7776", NULL, NULL, false, NULL, NULL, NULL, &_StartInfo, &_ProcessInfo );
- }
- int main ( int argc, char** argv )
- {
- u8 l_UsbResult[ 8 ] = { 0x00 };
- s32 l_Device = 1;
- HMODULE l_LibHandle = LoadLibrary ( "TenxHID.dll" );
- if ( l_LibHandle )
- {
- funcDeviceClose = ( HID_DeviceClose )GetProcAddress ( l_LibHandle, "HID_DeviceClose" );
- if ( !funcDeviceClose ) return 0;
- funcDeviceInitialize = ( HID_DeviceInitialize )GetProcAddress ( l_LibHandle, "HID_DeviceInitialize" );
- if ( !funcDeviceInitialize ) return 0;
- funcGetID = ( HID_GetID )GetProcAddress ( l_LibHandle, "HID_GetID" );
- if ( !funcGetID ) return 0;
- funcReadData = ( HID_ReadData )GetProcAddress ( l_LibHandle, "HID_ReadData" );
- if ( !funcReadData ) return 0;
- funcSetCurrentDevice = ( HID_SetCurrentDevice )GetProcAddress ( l_LibHandle, "HID_SetCurrentDevice" );
- if ( !funcSetCurrentDevice ) return 0;
- funcWriteCommand = ( HID_WriteCommand )GetProcAddress ( l_LibHandle, "HID_WriteCommand" );
- if ( !funcWriteCommand ) return 0;
- while ( 1 )
- {
- if ( funcDeviceInitialize() )
- {
- printf ( "Call Success : funcDeviceInitialize\n" );
- s32 l_Result = funcSetCurrentDevice ( l_Device );
- if ( l_Result )
- {
- printf ( "Call Success : funcSetCurrentDevice ( %d )\n", l_Device );
- if ( funcGetID ( l_UsbResult ) )
- {
- printf ( "Call Success : funcGetID | Device ID : %d\n", l_UsbResult[ 0 ] );
- while ( funcReadData ( l_UsbResult ) )
- {
- if ( l_UsbResult[ 0 ] > 0 )
- {
- printf ( "Call Success : funcReadData\n" );
- ButtonPushed ( l_UsbResult[ 0 ] );
- }
- Sleep ( 50 );
- }
- funcDeviceClose();
- }
- else
- {
- printf ( "Call Failed : funcGetID" );
- }
- }
- else
- {
- printf ( "Call Fail : funcSetCurrentDevice ( %d )\n", l_Device );
- }
- }
- else
- {
- printf ( "Call Fail : funcDeviceInitialize\n" );
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement