Am Montag, 18. Mai 2009 17:44:17 schrieb Tony Wasserka:
+HRESULT LoadFileIntoMemoryA(LPCSTR filename, LPVOID *buffer, DWORD *length)
Do you need this function? Woudn't it be better to wrap A->W at the API level and have all internal functions W only?
- handle = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, 0,
OPEN_EXISTING, 0, 0);
- if(handle == INVALID_HANDLE_VALUE) return D3DERR_INVALIDCALL;
- *length = GetFileSize(handle, NULL);
- if(*length == INVALID_FILE_SIZE) return D3DERR_INVALIDCALL;
- *buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *length);
Is there a particular reason not to use mmap, or whatever the Windows equivalent is?