flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 18 Apr 2009, 07:30
I think you need it like this:
Code: invoke SetProcessAffinityMask,[hProcess],[dwcpu1] |
|||
![]() |
|
mzneo 18 Apr 2009, 07:48
Code: BOOL WINAPI SetProcessAffinityMask( __in HANDLE hProcess, __in DWORD_PTR dwProcessAffinityMask ); but i tried debugging with ollydbg by changing and using both of these instruction, Code: invoke SetProcessAffinityMask,[hProcess],[dwcpu1] invoke SetProcessAffinityMask,[hProcess],dwcpu both instruction set the last error as -> ERROR_INVALID_PARAMETER(57) here i am using GetCurrentProcess to get the handle to the process. |
|||
![]() |
|
revolution 18 Apr 2009, 09:50
My Win32 doc has this:
Code: BOOL SetProcessAffinityMask( HANDLE hProcess, // handle to process DWORD dwProcessAffinityMask // process affinity mask ); Quote: If the function succeeds, the return value is nonzero. |
|||
![]() |
|
mzneo 18 Apr 2009, 11:59
You are right , but i am still getting the same error, here is the stack before the call was made
Code: 0007FFBC FFFFFFFF |Arg1 = FFFFFFFF 0007FFC0 00000000 \Arg2 = 00000000 but i am getting invalid parameter error, i am also using GetCurrnetProcess.i am not sure where i am going wrong here ?! here is the error Code: ERROR_INVALID_PARAMETER (00000057) |
|||
![]() |
|
revolution 18 Apr 2009, 12:09
You can't set an affinity mask of 0. You have to have at least one CPU selected in the mask. Try a value of 1 and see if you get the same error.
|
|||
![]() |
|
kempis 18 Apr 2009, 15:08
When using dwcpu0 dd 0x0, no errors.
When using dwcpu1 dd 0x1, error. ![]() |
|||
![]() |
|
revolution 18 Apr 2009, 15:46
This works for me:
Code: format PE GUI 4.0 entry start include 'win32a.inc' section '.data' readable executable dwcpu1 dd 0x1 section '.text' code readable executable start: invoke GetCurrentProcess invoke SetProcessAffinityMask,eax,[dwcpu1] stdcall ShowLastError,HWND_DESKTOP invoke ExitProcess,0 proc ShowErrorMessage hWnd,dwError local lpBuffer:DWORD lea eax,[lpBuffer] invoke FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0 invoke MessageBox,[hWnd],[lpBuffer],NULL,MB_ICONERROR+MB_OK invoke LocalFree,[lpBuffer] ret endp ; VOID ShowLastError(HWND hWnd); proc ShowLastError hWnd invoke GetLastError stdcall ShowErrorMessage,[hWnd],eax ret endp section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ GetLastError,'GetLastError',\ SetLastError,'SetLastError',\ FormatMessage,'FormatMessageA',\ LocalFree,'LocalFree',\ GetCurrentProcess,'GetCurrentProcess',\ SetProcessAffinityMask,'SetProcessAffinityMask',\ ExitProcess,'ExitProcess' import user,\ MessageBox,'MessageBoxA' |
|||
![]() |
|
mzneo 18 Apr 2009, 16:56
Revolution thanks you are right, with value 0x1 it was working fine now.Thanks a lot
![]() |
|||
![]() |
|
mzneo 20 Apr 2009, 06:04
I tried your program , but i am getting following error
"The Specified module could not be found" when tried to debug i found that EP the error was set as "ERROR_MOD_NOT_FOUND (0000007E)" - this is causing the issue. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.