regedit: Don't try to convert NULL pointers.
This commit is contained in:
parent
df84eb514c
commit
7aa56d249a
|
@ -69,6 +69,8 @@ if (!(p)) \
|
|||
* Returned string must be freed by the caller
|
||||
*/
|
||||
WCHAR* GetWideString(const char* strA)
|
||||
{
|
||||
if(strA)
|
||||
{
|
||||
WCHAR* strW = NULL;
|
||||
int len = MultiByteToWideChar(CP_ACP, 0, strA, -1, NULL, 0);
|
||||
|
@ -78,12 +80,16 @@ WCHAR* GetWideString(const char* strA)
|
|||
MultiByteToWideChar(CP_ACP, 0, strA, -1, strW, len);
|
||||
return strW;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Allocates memory and convers input from wide chars to multibyte
|
||||
* Returned string must be freed by the caller
|
||||
*/
|
||||
char* GetMultiByteString(const WCHAR* strW)
|
||||
{
|
||||
if(strW)
|
||||
{
|
||||
char* strA = NULL;
|
||||
int len = WideCharToMultiByte(CP_ACP, 0, strW, -1, NULL, 0, NULL, NULL);
|
||||
|
@ -93,6 +99,8 @@ char* GetMultiByteString(const WCHAR* strW)
|
|||
WideCharToMultiByte(CP_ACP, 0, strW, -1, strA, len, NULL, NULL);
|
||||
return strA;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Converts a hex representation of a DWORD into a DWORD.
|
||||
|
|
Loading…
Reference in New Issue