Dear Group,
I am trying to convert a hWrite sample from C.
The code is as follows
Any assistance would be appreciated.
The problem I am having is the first instance of hWrite, which is expecting an ASCIIZ PTR, but I have DWORD data to write.
Regards
Andrew
------------------
--------------
andrew dot lindsay at westnet dot com dot au
I am trying to convert a hWrite sample from C.
The code is as follows
Code:
void FAR* lpdata; DWORD dwWritten; OFSTRUCT MyOF; HFILE hFile; HGLOBAL hGlobal = 0; DWORD dwSize = 0; /* to store the data */ if (!PEstore (hWndPE, &hGlobal, &dwSize)) { /* error handler */ } /* hGlobal now contains a valid handle and dwSize specifies the size stored. Use GlobalLock to get a pointer to data and then call GlobalUnlock when finished with the pointer. */ lpdata = GlobalLock(hGlobal); /* open file */ hFile = OpenFile("Test.dat", &MyOF, OF_CREATE|OF_READWRITE); /* save size so we know how much to allocate later when loading */ dwWritten = hwrite(hFile, dwSize, 4); /* save actual data */ dwWritten = hwrite(hFile, lpdata, dwSize); lclose(hFile); GlobalUnlock(hGlobal); GlobalFree(hGlobal);
The problem I am having is the first instance of hWrite, which is expecting an ASCIIZ PTR, but I have DWORD data to write.
Regards
Andrew
------------------
--------------
andrew dot lindsay at westnet dot com dot au
Comment