Sign in to follow this  
Followers 0
0000

Help to Convert

6 posts in this topic

This is C++ function, which I need to convert to AutoIt...

void TakeRes()
{
  HRSRC hRes;
  HGLOBAL hRLoad;
  HANDLE hFile;
  char *cRes;
  DWORD BWritten,SzRsc;
  hRes = FindResource(NULL, MAKEINTRESOURCE(101), TEXT("S")); 
  if(hRes == NULL)
    MessageBox(NULL,"Error","Error",MB_OK);
  hRLoad = LoadResource(NULL,hRes);
  cRes = (char*)LockResource(hRLoad);
  SzRsc = SizeofResource(NULL,hRes); 

  hFile = CreateFile("Loader.exe",GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
  WriteFile(hFile,cRes,SzRsc,&BWritten,NULL);
  CloseHandle(hFile);
}

I tried convert it, using this topic:

http://www.autoitscript.com/forum/index.php?showtopic=66538

But it didint help me so much, there is another information which maybe will need:

http://msdn.microsoft.com/en-us/library/ms648042.asp

Because most errors I get with: hRes = FindResource(NULL, MAKEINTRESOURCE(101), TEXT("S"));

Thanks, 0000.

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Ok, I will check it.

Im training to make .exe dropper, which would be Unique from checkbox'es, like user selects his favorite answers, and my .exe generates .exe with his answers, and he can show that .exe to his friends or smthere :)

But I cant get Main.exe inside generator, because I still cant fix Resource Reader ;(

Edited by 0

Share this post


Link to post
Share on other sites

*BUMP*

Share this post


Link to post
Share on other sites

Func SetFilePointer($hFile,$nOffset, $nMethod = 0)

$Callresult = DllCall("kernel32.dll", "int", "SetFilePointer", "ptr", $hFile, "long", $nOffset,"ptr", 0, "dword", $nMethod) ; FILE_BEGIN

Return $Callresult[0]

EndFunc

Func WriteFile($hFile,$lpBuffer,$nNumberOfBytesToWrite)

Local $pRead = DllStructCreate("dword")

$Callresult = DllCall("kernel32.dll", "int", "WriteFile", "int", $hFile,"long",$lpBuffer,"int", $nNumberOfBytesToWrite,"ptr",DllStructGetPtr($pRead),"int", 0)

Return $Callresult[0]

EndFunc

Could somebody say, if I made correct functions, with DllCall, because basiclly, its not working for me, and I don't know what here can be bad :).

Also try to fix it :o

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0