Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 73 of file util.c.
Referenced by D3DXGetImageInfoFromFileW(), and D3DXLoadSurfaceFromFileW().
{ HANDLE hfile, hmapping = NULL; hfile = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if(hfile == INVALID_HANDLE_VALUE) goto error; *length = GetFileSize(hfile, NULL); if(*length == INVALID_FILE_SIZE) goto error; hmapping = CreateFileMappingW(hfile, NULL, PAGE_READONLY, 0, 0, NULL); if(!hmapping) goto error; *buffer = MapViewOfFile(hmapping, FILE_MAP_READ, 0, 0, 0); if(*buffer == NULL) goto error; CloseHandle(hmapping); CloseHandle(hfile); return S_OK; error: CloseHandle(hmapping); CloseHandle(hfile); return HRESULT_FROM_WIN32(GetLastError()); }