diff --git a/reactos/subsys/system/regedit/childwnd.c b/reactos/subsys/system/regedit/childwnd.c index 74a2ec1e125..96619396658 100644 --- a/reactos/subsys/system/regedit/childwnd.c +++ b/reactos/subsys/system/regedit/childwnd.c @@ -276,9 +276,9 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa if (keyPath) { RefreshListView(pChildWnd->hListWnd, hRootKey, keyPath); rootName = get_root_key_name(hRootKey); - fullPath = HeapAlloc(GetProcessHeap(), 0, (lstrlen(rootName) + 1 + lstrlen(keyPath) + 1) * sizeof(TCHAR)); + fullPath = HeapAlloc(GetProcessHeap(), 0, (_tcslen(rootName) + 1 + _tcslen(keyPath) + 1) * sizeof(TCHAR)); if (fullPath) { - _stprintf(fullPath, "%s\\%s", rootName, keyPath); + _stprintf(fullPath, _T("%s\\%s"), rootName, keyPath); SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)fullPath); HeapFree(GetProcessHeap(), 0, fullPath); } diff --git a/reactos/subsys/system/regedit/edit.c b/reactos/subsys/system/regedit/edit.c index abddc30a5fc..b7fa78dbf25 100644 --- a/reactos/subsys/system/regedit/edit.c +++ b/reactos/subsys/system/regedit/edit.c @@ -59,10 +59,10 @@ void error(HWND hwnd, INT resId, ...) hInstance = GetModuleHandle(0); if (!LoadString(hInstance, IDS_ERROR, title, COUNT_OF(title))) - lstrcpy(title, "Error"); + _tcscpy(title, _T("Error")); if (!LoadString(hInstance, resId, errfmt, COUNT_OF(errfmt))) - lstrcpy(errfmt, "Unknown error string!"); + _tcscpy(errfmt, _T("Unknown error string!")); va_start(ap, resId); _vsntprintf(errstr, COUNT_OF(errstr), errfmt, ap); @@ -82,10 +82,10 @@ void warning(HWND hwnd, INT resId, ...) hInstance = GetModuleHandle(0); if (!LoadString(hInstance, IDS_WARNING, title, COUNT_OF(title))) - lstrcpy(title, "Error"); + _tcscpy(title, _T("Warning")); if (!LoadString(hInstance, resId, errfmt, COUNT_OF(errfmt))) - lstrcpy(errfmt, "Unknown error string!"); + _tcscpy(errfmt, _T("Unknown error string!")); va_start(ap, resId); _vsntprintf(errstr, COUNT_OF(errstr), errfmt, ap); @@ -102,7 +102,7 @@ INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L switch(uMsg) { case WM_INITDIALOG: - if(editValueName && strcmp(editValueName, _T(""))) + if(editValueName && _tcscmp(editValueName, _T(""))) { SetDlgItemText(hwndDlg, IDC_VALUE_NAME, editValueName); } @@ -165,7 +165,7 @@ INT_PTR CALLBACK modify_multi_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wPa switch(uMsg) { case WM_INITDIALOG: - if(editValueName && strcmp(editValueName, _T(""))) + if(editValueName && _tcscmp(editValueName, _T(""))) { SetDlgItemText(hwndDlg, IDC_VALUE_NAME, editValueName); } @@ -282,7 +282,7 @@ INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP SetWindowLong(hwndValue, GWL_USERDATA, (LONG)oldproc); SetWindowLong(hwndValue, GWL_WNDPROC, (LONG)DwordEditSubclassProc); - if(editValueName && strcmp(editValueName, _T(""))) + if(editValueName && _tcscmp(editValueName, _T(""))) { SetDlgItemText(hwndDlg, IDC_VALUE_NAME, editValueName); } @@ -291,7 +291,7 @@ INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_VALUE_NAME, _T("(Default)")); } CheckRadioButton (hwndDlg, IDC_FORMAT_HEX, IDC_FORMAT_DEC, IDC_FORMAT_HEX); - sprintf (ValueString, "%lx", dwordValueData); + _stprintf (ValueString, _T("%lx"), dwordValueData); SetDlgItemText(hwndDlg, IDC_VALUE_DATA, ValueString); SetFocus(GetDlgItem(hwndDlg, IDC_VALUE_DATA)); return FALSE; @@ -313,7 +313,7 @@ INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP } else { - Value = strtoul (ValueString, &Remainder, 10); + Value = _tcstoul (ValueString, &Remainder, 10); } } else @@ -321,7 +321,7 @@ INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP Value = 0; } } - sprintf (ValueString, "%lx", Value); + _stprintf (ValueString, _T("%lx"), Value); SetDlgItemText(hwndDlg, IDC_VALUE_DATA, ValueString); return TRUE; } @@ -341,7 +341,7 @@ INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP } else { - Value = strtoul (ValueString, &Remainder, 16); + Value = _tcstoul (ValueString, &Remainder, 16); } } else @@ -349,7 +349,7 @@ INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP Value = 0; } } - sprintf (ValueString, "%lu", Value); + _stprintf (ValueString, _T("%lu"), Value); SetDlgItemText(hwndDlg, IDC_VALUE_DATA, ValueString); return TRUE; } @@ -367,7 +367,7 @@ INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP } Base = (dwordEditMode == EDIT_MODE_HEX) ? 16 : 10; - dwordValueData = strtoul (ValueString, &Remainder, Base); + dwordValueData = _tcstoul (ValueString, &Remainder, Base); } else { @@ -422,7 +422,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName) error(hwnd, IDS_TOO_BIG_VALUE, valueDataLen); goto done; } - lRet = RegQueryValueEx(hKey, valueName, 0, 0, stringValueData, &valueDataLen); + lRet = RegQueryValueEx(hKey, valueName, 0, 0, (LPBYTE)stringValueData, &valueDataLen); if (lRet != ERROR_SUCCESS) { error(hwnd, IDS_BAD_VALUE, valueName); @@ -438,7 +438,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName) { if (stringValueData) { - lRet = RegSetValueEx(hKey, valueName, 0, type, stringValueData, lstrlen(stringValueData) + 1); + lRet = RegSetValueEx(hKey, valueName, 0, type, (LPBYTE)stringValueData, (_tcslen(stringValueData) + 1) * sizeof(TCHAR)); } else { @@ -452,7 +452,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName) { if (valueDataLen > 0) { - DWORD NewLen, llen, listlen, nl_len; + DWORD llen, listlen, nl_len; LPTSTR src, lines = NULL; if (!(stringValueData = HeapAlloc(GetProcessHeap(), 0, valueDataLen))) @@ -460,7 +460,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName) error(hwnd, IDS_TOO_BIG_VALUE, valueDataLen); goto done; } - lRet = RegQueryValueEx(hKey, valueName, 0, 0, stringValueData, &valueDataLen); + lRet = RegQueryValueEx(hKey, valueName, 0, 0, (LPBYTE)stringValueData, &valueDataLen); if (lRet != ERROR_SUCCESS) { error(hwnd, IDS_BAD_VALUE, valueName); @@ -468,7 +468,6 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName) } /* convert \0 to \r\n */ - NewLen = valueDataLen; src = stringValueData; nl_len = _tcslen(_T("\r\n")) * sizeof(TCHAR); listlen = sizeof(TCHAR); @@ -510,7 +509,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName) { if((nl = _tcsstr(src, _T("\r\n")))) { - linechars = (nl - src) / sizeof(TCHAR); + linechars = nl - src; if(nl == src) { EmptyLines = TRUE; @@ -543,7 +542,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName) warning(hwnd, IDS_MULTI_SZ_EMPTY_STRING); } - lRet = RegSetValueEx(hKey, valueName, 0, type, lines, buflen); + lRet = RegSetValueEx(hKey, valueName, 0, type, (LPBYTE)lines, buflen); HeapFree(GetProcessHeap(), 0, lines); } else diff --git a/reactos/subsys/system/regedit/framewnd.c b/reactos/subsys/system/regedit/framewnd.c index 050b21a11e2..7947a525a31 100644 --- a/reactos/subsys/system/regedit/framewnd.c +++ b/reactos/subsys/system/regedit/framewnd.c @@ -245,7 +245,8 @@ static BOOL ImportRegistryFile(HWND hWnd) ofn.lpstrTitle = _T("Import Registry File"); /* ofn.lCustData = ;*/ if (GetOpenFileName(&ofn)) { - if (!import_registry_file(ofn.lpstrFile)) { + /* FIXME - convert to ascii */ + if (!import_registry_file((LPSTR)ofn.lpstrFile)) { /*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/ return FALSE; } @@ -287,8 +288,9 @@ static BOOL ExportRegistryFile(HWND hWnd) ofn.lpfnHook = ImportRegistryFile_OFNHookProc; ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1); if (GetSaveFileName(&ofn)) { - BOOL result; - result = export_registry_key(ofn.lpstrFile, ExportKeyPath); + BOOL result; + /* FIXME - convert strings to ascii! */ + result = export_registry_key((CHAR*)ofn.lpstrFile, (CHAR*)ExportKeyPath); /*result = export_registry_key(ofn.lpstrFile, NULL);*/ /*if (!export_registry_key(ofn.lpstrFile, NULL)) {*/ if (!result) { @@ -307,7 +309,7 @@ static BOOL ExportRegistryFile(HWND hWnd) if (s[0]) { TCHAR reg_key_name[KEY_MAX_LEN]; get_file_name(&s, reg_key_name, KEY_MAX_LEN); - export_registry_key(filename, reg_key_name); + export_registry_key((CHAR)filename, reg_key_name); } else { export_registry_key(filename, NULL); } diff --git a/reactos/subsys/system/regedit/listview.c b/reactos/subsys/system/regedit/listview.c index a9525a1c6de..ea637799225 100644 --- a/reactos/subsys/system/regedit/listview.c +++ b/reactos/subsys/system/regedit/listview.c @@ -106,7 +106,7 @@ BOOL IsDefaultValue(HWND hwndLV, int i) if(ListView_GetItem(hwndLV, &Item)) { lineinfo = (PLINE_INFO)Item.lParam; - return lineinfo && (!lineinfo->name || !strcmp(lineinfo->name, _T(""))); + return lineinfo && (!lineinfo->name || !_tcscmp(lineinfo->name, _T(""))); } return FALSE; } @@ -392,7 +392,7 @@ BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result) if(Info) { lineinfo = (PLINE_INFO)Info->item.lParam; - if(!lineinfo->name || !strcmp(lineinfo->name, _T(""))) + if(!lineinfo->name || !_tcscmp(lineinfo->name, _T(""))) { *Result = TRUE; } @@ -490,7 +490,7 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCTSTR keyPath) dwValSize = max_val_size; dwValType = 0L; ++dwIndex; - if(!strcmp(ValName, _T(""))) + if(!_tcscmp(ValName, _T(""))) { AddedDefault = TRUE; } diff --git a/reactos/subsys/system/regedit/regproc.c b/reactos/subsys/system/regedit/regproc.c index 0479c856d5b..974e3c0091a 100644 --- a/reactos/subsys/system/regedit/regproc.c +++ b/reactos/subsys/system/regedit/regproc.c @@ -424,7 +424,7 @@ HRESULT setValue(LPSTR val_name, LPSTR val_data) } } - hRes = RegSetValueEx( + hRes = RegSetValueExA( currentKeyHandle, val_name, 0, /* Reserved */ @@ -460,7 +460,7 @@ HRESULT openKey( LPSTR stdInput) if (currentKeyName == NULL) return ERROR_INVALID_PARAMETER; - hRes = RegCreateKeyEx( + hRes = RegCreateKeyExA( currentKeyClass, /* Class */ currentKeyName, /* Sub Key */ 0, /* MUST BE 0 */ @@ -986,7 +986,7 @@ void doRegisterDLL(LPSTR stdInput) return; /* Load and register the library, then free it */ - theLib = LoadLibrary(stdInput); + theLib = LoadLibraryA(stdInput); if (theLib) { FARPROC lpfnDLLRegProc = GetProcAddress(theLib, "DllRegisterServer"); if (lpfnDLLRegProc) @@ -1019,7 +1019,7 @@ void doUnregisterDLL(LPSTR stdInput) return; /* Load and unregister the library, then free it */ - theLib = LoadLibrary(stdInput); + theLib = LoadLibraryA(stdInput); if (theLib) { FARPROC lpfnDLLRegProc = GetProcAddress(theLib, "DllUnregisterServer"); if (lpfnDLLRegProc) @@ -1173,8 +1173,8 @@ void export_hkey(FILE *file, HKEY key, DWORD value_type; DWORD val_name_len1 = *val_name_len; DWORD val_size1 = *val_size; - ret = RegEnumValue(key, i, *val_name_buf, &val_name_len1, NULL, - &value_type, *val_buf, &val_size1); + ret = RegEnumValueA(key, i, *val_name_buf, &val_name_len1, NULL, + &value_type, *val_buf, &val_size1); if (ret != ERROR_SUCCESS) { more_data = FALSE; if (ret != ERROR_NO_MORE_ITEMS) { @@ -1257,8 +1257,8 @@ void export_hkey(FILE *file, HKEY key, while(more_data) { DWORD buf_len = *reg_key_name_len - curr_len; - ret = RegEnumKeyEx(key, i, *reg_key_name_buf + curr_len + 1, &buf_len, - NULL, NULL, NULL, NULL); + ret = RegEnumKeyExA(key, i, *reg_key_name_buf + curr_len + 1, &buf_len, + NULL, NULL, NULL, NULL); if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA) { more_data = FALSE; if (ret != ERROR_NO_MORE_ITEMS) { @@ -1268,8 +1268,8 @@ void export_hkey(FILE *file, HKEY key, HKEY subkey; i++; - if (RegOpenKey(key, *reg_key_name_buf + curr_len + 1, - &subkey) == ERROR_SUCCESS) { + if (RegOpenKeyA(key, *reg_key_name_buf + curr_len + 1, + &subkey) == ERROR_SUCCESS) { export_hkey(file, subkey, reg_key_name_buf, reg_key_name_len, val_name_buf, val_name_len, val_buf, val_size); RegCloseKey(subkey); @@ -1347,7 +1347,7 @@ BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name) ®_key_name_buf, ®_key_name_len, &val_name_buf, &val_name_len, &val_buf, &val_size); - } else if (RegOpenKey(reg_key_class, branch_name, &key) == ERROR_SUCCESS) { + } else if (RegOpenKeyA(reg_key_class, branch_name, &key) == ERROR_SUCCESS) { file = REGPROC_open_export_file(file_name); export_hkey(file, key, ®_key_name_buf, ®_key_name_len, @@ -1390,7 +1390,7 @@ BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name) /****************************************************************************** * Reads contents of the specified file into the registry. */ -BOOL import_registry_file(LPTSTR filename) +BOOL import_registry_file(LPSTR filename) { FILE* reg_file = fopen(filename, "r"); @@ -1414,7 +1414,7 @@ void delete_branch(HKEY key, LONG ret; long int i; - if (RegOpenKey(key, *reg_key_name_buf, &branch_key) != ERROR_SUCCESS) { + if (RegOpenKeyA(key, *reg_key_name_buf, &branch_key) != ERROR_SUCCESS) { REGPROC_print_error(); } @@ -1433,8 +1433,8 @@ void delete_branch(HKEY key, for (i = subkeys - 1; i >= 0; i--) { DWORD buf_len = *reg_key_name_len - curr_len; - ret = RegEnumKeyEx(branch_key, i, *reg_key_name_buf + curr_len + 1, - &buf_len, NULL, NULL, NULL, NULL); + ret = RegEnumKeyExA(branch_key, i, *reg_key_name_buf + curr_len + 1, + &buf_len, NULL, NULL, NULL, NULL); if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA && ret != ERROR_NO_MORE_ITEMS) { @@ -1445,7 +1445,7 @@ void delete_branch(HKEY key, } (*reg_key_name_buf)[curr_len] = '\0'; RegCloseKey(branch_key); - RegDeleteKey(key, *reg_key_name_buf); + RegDeleteKeyA(key, *reg_key_name_buf); } /****************************************************************************** @@ -1479,7 +1479,7 @@ void delete_registry_key(CHAR *reg_key_name) getAppName(), reg_key_name); exit(1); } - if (RegOpenKey(reg_key_class, branch_name, &branch_key) == ERROR_SUCCESS) { + if (RegOpenKeyA(reg_key_class, branch_name, &branch_key) == ERROR_SUCCESS) { /* check whether the key exists */ RegCloseKey(branch_key); delete_branch(reg_key_class, &branch_name, &branch_name_len); diff --git a/reactos/subsys/system/regedit/regproc.h b/reactos/subsys/system/regedit/regproc.h index 9a7d723d5b8..cc89aa0c575 100644 --- a/reactos/subsys/system/regedit/regproc.h +++ b/reactos/subsys/system/regedit/regproc.h @@ -37,7 +37,7 @@ void doRegisterDLL(LPSTR lpsLine); void doUnregisterDLL(LPSTR lpsLine); BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name); -BOOL import_registry_file(LPTSTR filename); +BOOL import_registry_file(LPSTR filename); void delete_registry_key(CHAR *reg_key_name); void setAppName(CHAR *name); diff --git a/reactos/subsys/system/regedit/treeview.c b/reactos/subsys/system/regedit/treeview.c index bc4cf004aa5..ba4927015b8 100644 --- a/reactos/subsys/system/regedit/treeview.c +++ b/reactos/subsys/system/regedit/treeview.c @@ -111,7 +111,7 @@ static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPTSTR label, HK tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM; tvi.pszText = label; - tvi.cchTextMax = lstrlen(tvi.pszText); + tvi.cchTextMax = _tcslen(tvi.pszText); tvi.iImage = Image_Closed; tvi.iSelectedImage = Image_Open; tvi.cChildren = dwChildren; @@ -132,7 +132,7 @@ static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName) tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM; /* Set the text of the item. */ tvi.pszText = pHostName; - tvi.cchTextMax = lstrlen(tvi.pszText); + tvi.cchTextMax = _tcslen(tvi.pszText); /* Assume the item is not a parent item, so give it an image. */ tvi.iImage = Image_Root; tvi.iSelectedImage = Image_Root;