| 309 | } |
| 310 | |
| 311 | int GetProcessPlatform( HANDLE hProcess ) |
| 312 | { |
| 313 | PVOID Wow64Info; |
| 314 | NTSTATUS Status; |
| 315 | |
| 316 | if (hProcess == (HANDLE)((LONG_PTR)-1)) |
| 317 | { |
| 318 | #if defined(_M_X64) |
| 319 | return ProcessPlatformX64; |
| 320 | #else |
| 321 | return ProcessPlatformX86; |
| 322 | #endif |
| 323 | } |
| 324 | |
| 325 | switch (Utils::GetProcessorArchitecture( )) |
| 326 | { |
| 327 | case PROCESSOR_ARCHITECTURE_INTEL: |
| 328 | return ProcessPlatformX86; |
| 329 | case PROCESSOR_ARCHITECTURE_AMD64: |
| 330 | //check on 64-bit platforms |
| 331 | Status = ntdll::NtQueryInformationProcess( hProcess, ProcessWow64Information, &Wow64Info, sizeof( Wow64Info ), NULL ); |
| 332 | if (NT_SUCCESS( Status )) |
| 333 | { |
| 334 | #if defined(_M_X64) |
| 335 | return (Wow64Info != NULL) ? ProcessPlatformX86 : ProcessPlatformX64; |
| 336 | #else |
| 337 | return (Wow64Info == NULL) ? ProcessPlatformX64 : ProcessPlatformX86; |
| 338 | #endif |
| 339 | } |
| 340 | |
| 341 | #if defined(_M_X64) |
| 342 | return ProcessPlatformX64; |
| 343 | #else |
| 344 | return ProcessPlatformX86; |
| 345 | #endif |
| 346 | |
| 347 | //case PROCESSOR_ARCHITECTURE_IA64: |
| 348 | //case PROCESSOR_ARCHITECTURE_ALPHA64: |
| 349 | } |
| 350 | |
| 351 | return ProcessPlatformNotSupported; |
| 352 | } |
| 353 | |
| 354 | HANDLE NtCreateThreadEx( HANDLE hProcess, LPVOID lpRemoteThreadStart, LPVOID lpParam, DWORD createFlags, DWORD* threadId ) |
| 355 | { |
no test coverage detected