On 11/18/2013 16:02, Jactry Zeng wrote:
update:
- Use 0 in HeapAlloc instead of HEAP_ZERO_MEMORY;
- Return an E_OUTOFMEMORY instead of HRESULT_FROM_WIN32(GetLastError())
when HeapAlloc fail.
- FIXME("Don't support UTF-16.\n");
How is supposed to be handled?
- FIXME("Partial stub! Don't support flag: 0x%x\n", Flags);
At least some flags are easy to support mapping them to sharing and creation disposition modes.
- chBuffer = HeapAlloc(GetProcessHeap(), 0, size+1);
- if(!chBuffer)
- {
CloseHandle(hFile);
return E_OUTOFMEMORY;
- }
- if(!ReadFile(hFile, chBuffer, size, &dwReadSize, NULL))
- {
CloseHandle(hFile);
HeapFree(GetProcessHeap(), 0, chBuffer);
return HRESULT_FROM_WIN32(GetLastError());
- }
- chBuffer[size] = 0;
How will it work for UTF-16 input?
- SendMessageW(This->editor->hWnd, EM_SETTEXTEX, (int)&settextex, (LPARAM)chBuffer);
- CloseHandle(hFile);
- return S_OK;
Looks like you leak a buffer.