📜 ⬆️ ⬇️

Using WinAPI on Surface

Good day to all!
image
As I had previously suggested, using WinAPI in new Microsoft devices running under Windows RT will not be so difficult.

And I found a small post on xda .

And there, to invoke the native functions, a hack was suggested that works like viruses - searching for the kernel and entry points into the procedures manually.
')
In the post a small piece of code was proposed, demonstrating how WinAPI calls are executed:

void DoThings() { char *Tmp=(char*)GetTickCount64; Tmp=(char*)((~0xFFF)&(DWORD_PTR)Tmp); while(Tmp) { __try { if(Tmp[0]=='M' && Tmp[1]=='Z') break; } __except(EXCEPTION_EXECUTE_HANDLER) { } Tmp-=0x1000; } if(Tmp==0) return; LoadLibraryA=(t_LLA*)PeGetProcAddressA(Tmp,"LoadLibraryA"); GetProcAddressA=(t_GPA*)PeGetProcAddressA(Tmp,"GetProcAddress"); CreateProcessA=(t_CPA*)PeGetProcAddressA(Tmp,"CreateProcessA"); HMODULE hUser=LoadLibraryA("user32.dll"); MessageBoxA=(t_MBA*)GetProcAddressA(hUser,"MessageBoxA"); MessageBoxA(0,"A native MessageBox!","Test",MB_OK); STARTUPINFO si; memset(&si,0,sizeof(si)); si.cb=sizeof(si); PROCESS_INFORMATION pi; CreateProcessA("c:\\Windows\\system32\\cmd.exe",0,0,0,FALSE,0,0,0,&si,&pi); } 


Under the link you can download ready-made projects, incl. and compiled.

Behind this, let me leave. I hope you will be useful!

Source: https://habr.com/ru/post/160739/


All Articles