c++ - sprintf an LPCWSTR variable -


I'm trying to debug a LPCWSTR string, but I'm trying to sprintf < / Code> is pushing in buffer, because it only recovers the first character from the string

Here is the code:.

  handle WINAPI hookedCreateFileW (LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes handleHTemplateFile) {four buffer [1024] LPSECURITY_ATTRIBUTES; Sprintf_s (buffer, 1024, "create file w:% s", lpFileName); OutputDebugString (buffer); Return trueCreateFileW (lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwFlagsAndAttributes, dwCreationDisposition, hTemplateFile); }  

For example, I have to push CreateFileW: c or CreateFileW: \

Is it in buffer?

Thank you.

The version of which is sprintf_s which is designed for wide character strings.

You will also need an array of four of wchar_t and to use OutputDebugStringW ()

In addition, you should note that swprintf_w is probably what you want to call. If it encounters a string that is more than the size you give, then it makes some claim, I suggest that you specifically test this situation.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -