sprintf an LPCWSTR variable
- by Julio
Hello everyone.
I'm trying to debug print an LPCWSTR string, but I get a problem during the sprintf push in the buffer, because it retrieve only the first character from the string.
Here is the code:
HANDLE WINAPI hookedCreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) {
char buffer[1024];
sprintf_s(buffer, 1024, "CreateFileW: %s", lpFileName);
OutputDebugString(buffer);
return trueCreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwFlagsAndAttributes, dwCreationDisposition, hTemplateFile);
}
For example I get "CreateFileW: C" or "CreateFileW: \".
How do I properly push it in the buffer?
Thank you.