Code from the current process module program read data

zhaozj2021-02-17  48

// - The number of data bytes read from the current process module program read data // - parameter // buf / reception data (BUF must be sufficient) // POS / Start Read Data Offset Location // - Return // - Actual Read Data bytes (Generally I should equal to Size) Int Accessme (Char * BUF, Unsigned Int Size, Unsigned INT POS = 0) {INT RET = 0; if (null == buf || SIZE <= 0 || POS <0) Return Ret;

HModule HModule = getModuleHandle (NULL); char lpfilename [max_path] = {0}; :: getModuleFileName (HModule, LPFileName, Sizeof (lpfilename));

HANDLE hFile = :: CreateFile (lpFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL); if (!! NULL = hFile && INVALID_HANDLE_VALUE = hFile) {DWORD dwSize = :: GetFileSize (hFile, NULL); if (pos > 0 && POS

// - Read dword dwread = 0; :: readfile (hfile, buf, size, & dwread, null); :: closehandle (hfile); RET = dwread;

Return Ret;}

转载请注明原文地址:https://www.9cbs.com/read-28681.html

New Post(0)