ChangeKeySeqDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-static inline WCHAR*
-DuplicateString(const WCHAR *pszString)
-{
- WCHAR *pszDuplicate;
- size_t size;
-
- size = (wcslen(pszString) + 1) * sizeof(WCHAR);
-
- pszDuplicate = (WCHAR*) malloc(size);
- if (pszDuplicate != NULL)
- {
- StringCbCopyW(pszDuplicate, size, pszString);
- }
-
- return pszDuplicate;
-}
-
static inline DWORD
DWORDfromString(const WCHAR *pszString)
{
ZeroMemory(pNew, sizeof(LAYOUT_LIST_NODE));
- pNew->pszName = DuplicateString(pszName);
+ pNew->pszName = _wcsdup(pszName);
if (pNew->pszName == NULL)
{
free(pNew);
(LPBYTE)szBuffer, &dwSize) == ERROR_SUCCESS &&
szBuffer[0] == L'@')
{
- WCHAR szPath[MAX_PATH];
WCHAR *pBuffer;
WCHAR *pIndex;
- INT iIndex;
/* Move to the position after the character "@" */
pBuffer = szBuffer + 1;
/* Get a pointer to the beginning ",-" */
pIndex = wcsstr(pBuffer, L",-");
- /* Convert the number in the string after the ",-" */
- iIndex = _wtoi(pIndex + 2);
+ if (pIndex != NULL)
+ {
+ WCHAR szPath[MAX_PATH];
+ INT iIndex;
- pIndex[0] = 0;
+ /* Convert the number in the string after the ",-" */
+ iIndex = _wtoi(pIndex + 2);
- if (ExpandEnvironmentStringsW(pBuffer, szPath, ARRAYSIZE(szPath)) != 0)
- {
- HANDLE hHandle;
+ pIndex[0] = 0;
- hHandle = LoadLibraryW(szPath);
- if (hHandle != NULL)
+ if (ExpandEnvironmentStringsW(pBuffer, szPath, ARRAYSIZE(szPath)) != 0)
{
- INT iLength = LoadStringW(hHandle, iIndex, szBuffer, ARRAYSIZE(szBuffer));
-
- FreeLibrary(hHandle);
+ HANDLE hHandle;
- if (iLength != 0)
+ hHandle = LoadLibraryW(szPath);
+ if (hHandle != NULL)
{
- DWORD dwLayoutId = DWORDfromString(szLayoutId);
+ INT iLength = LoadStringW(hHandle, iIndex, szBuffer, ARRAYSIZE(szBuffer));
+
+ FreeLibrary(hHandle);
+
+ if (iLength != 0)
+ {
+ DWORD dwLayoutId = DWORDfromString(szLayoutId);
- LayoutList_AppendNode(dwLayoutId, dwSpecialId, szBuffer);
+ LayoutList_AppendNode(dwLayoutId, dwSpecialId, szBuffer);
+ }
+ else
+ {
+ goto NotTranslated;
+ }
}
else
{