| 44 | #ifndef UNICODE |
| 45 | |
| 46 | LPWSTR WINAPI WideStringFromResource(__out_ecount(STR_MAX_LENGTH) LPWSTR pBuffer, int iResourceID) |
| 47 | { |
| 48 | *pBuffer = 0; |
| 49 | |
| 50 | if (g_amPlatform == VER_PLATFORM_WIN32_NT) |
| 51 | { |
| 52 | LoadStringW(g_hInst, iResourceID, pBuffer, STR_MAX_LENGTH); |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | |
| 57 | CHAR szBuffer[STR_MAX_LENGTH]; |
| 58 | DWORD dwStringLength = LoadString(g_hInst, iResourceID, szBuffer, STR_MAX_LENGTH); |
| 59 | // if we loaded a string convert it to wide characters, ensuring |
| 60 | // that we also null terminate the result. |
| 61 | if (dwStringLength++) |
| 62 | { |
| 63 | MultiByteToWideChar(CP_ACP, 0, szBuffer, dwStringLength, pBuffer, STR_MAX_LENGTH); |
| 64 | } |
| 65 | } |
| 66 | return pBuffer; |
| 67 | } |
| 68 | |
| 69 | #endif |
| 70 |
no outgoing calls
no test coverage detected