diff --git a/reactos/lib/comdlg32/colordlg.c b/reactos/lib/comdlg32/colordlg.c index a9ff14f38ba..096e1bb9c08 100644 --- a/reactos/lib/comdlg32/colordlg.c +++ b/reactos/lib/comdlg32/colordlg.c @@ -65,7 +65,7 @@ static const COLORREF predefcolors[6][8]= /* Chose Color PRIVATE Structure: * * This structure is duplicated in the 16 bit code with - * a extra member + * an extra member */ typedef struct CCPRIVATE diff --git a/reactos/lib/comdlg32/colordlg16.c b/reactos/lib/comdlg32/colordlg16.c index fb6f17244e3..0e70485d979 100644 --- a/reactos/lib/comdlg32/colordlg16.c +++ b/reactos/lib/comdlg32/colordlg16.c @@ -46,7 +46,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); /* Chose Color PRIVATE Structure: * * This is a duplicate of the 32bit code with - * a extra member + * an extra member */ typedef struct CCPRIVATE { diff --git a/reactos/lib/comdlg32/filedlg.c b/reactos/lib/comdlg32/filedlg.c index 926bf9c3781..41dd83ffde0 100644 --- a/reactos/lib/comdlg32/filedlg.c +++ b/reactos/lib/comdlg32/filedlg.c @@ -462,16 +462,17 @@ BOOL WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType) if(ofn->lpstrFile) { fodInfos.filename = MemAlloc(ofn->nMaxFile*sizeof(WCHAR)); - strncpyW(fodInfos.filename,ofn->lpstrFile,ofn->nMaxFile); + lstrcpynW(fodInfos.filename,ofn->lpstrFile,ofn->nMaxFile); } else fodInfos.filename = NULL; if(ofn->lpstrInitialDir) { - DWORD len = strlenW(ofn->lpstrInitialDir); - fodInfos.initdir = MemAlloc((len+1)*sizeof(WCHAR)); - strcpyW(fodInfos.initdir,ofn->lpstrInitialDir); + /* fodInfos.initdir = strdupW(ofn->lpstrInitialDir); */ + DWORD len = strlenW(ofn->lpstrInitialDir)+1; + fodInfos.initdir = MemAlloc(len*sizeof(WCHAR)); + memcpy(fodInfos.initdir,ofn->lpstrInitialDir,len*sizeof(WCHAR)); } else fodInfos.initdir = NULL; @@ -853,7 +854,7 @@ HRESULT FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID buffer) /* Prepend the current path */ n = strlenW(lpstrCurrentDir) + 1; - strncpyW( bufW, lpstrCurrentDir, size ); + memcpy( bufW, lpstrCurrentDir, min(n,size) * sizeof(WCHAR)); if(nofnInfos; - strncpyW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile); + lstrcpynW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile); if (ofn->Flags & OFN_ALLOWMULTISELECT) ofn->lpstrFile[lstrlenW(ofn->lpstrFile) + 1] = '\0'; } @@ -2064,7 +2065,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) if(fodInfos->unicode) { LPOPENFILENAMEW ofn = fodInfos->ofnInfos; - strncpyW(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle); + lstrcpynW(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle); } else { @@ -2406,7 +2407,7 @@ static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode) /*********************************************************************** * FILEDLG95_FILETYPE_SearchExt * - * searches for a extension in the filetype box + * searches for an extension in the filetype box */ static int FILEDLG95_FILETYPE_SearchExt(HWND hwnd,LPCWSTR lpstrExt) { @@ -2958,7 +2959,7 @@ void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd) /* allocate the buffer */ if (nFiles <= 1) nLength = MAX_PATH; - lpstrAllFile = (LPSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nLength); + lpstrAllFile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nLength); lpstrAllFile[0] = '\0'; /* Generate the string for the edit control */ diff --git a/reactos/lib/comdlg32/filedlgbrowser.c b/reactos/lib/comdlg32/filedlgbrowser.c index 787b52ac2ad..e4ae8bd2704 100644 --- a/reactos/lib/comdlg32/filedlgbrowser.c +++ b/reactos/lib/comdlg32/filedlgbrowser.c @@ -95,6 +95,49 @@ extern HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode); * Helper functions */ +#define add_flag(a) if (flags & a) {strcat(str, #a );strcat(str," ");} +static void COMDLG32_DumpSBSPFlags(UINT uflags) +{ + if (TRACE_ON(commdlg)) + { + unsigned int i; + static const struct { + DWORD mask; + const char *name; + } flags[] = { +#define FE(x) { x, #x} + /* SBSP_DEFBROWSER == 0 */ + FE(SBSP_SAMEBROWSER), + FE(SBSP_NEWBROWSER), + + /* SBSP_DEFMODE == 0 */ + FE(SBSP_OPENMODE), + FE(SBSP_EXPLOREMODE), + FE(SBSP_HELPMODE), + FE(SBSP_NOTRANSFERHIST), + + /* SBSP_ABSOLUTE == 0 */ + FE(SBSP_RELATIVE), + FE(SBSP_PARENT), + FE(SBSP_NAVIGATEBACK), + FE(SBSP_NAVIGATEFORWARD), + FE(SBSP_ALLOW_AUTONAVIGATE), + + FE(SBSP_NOAUTOSELECT), + FE(SBSP_WRITENOHISTORY), + + FE(SBSP_REDIRECT), + FE(SBSP_INITIATEDBYHLINKFRAME), + }; +#undef FE + DPRINTF("SBSP Flags: %08x =", uflags); + for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++) + if (flags[i].mask & uflags) + DPRINTF("%s ", flags[i].name); + DPRINTF("\n"); + } +} + static void COMDLG32_UpdateCurrentDir(FileOpenDlgInfos *fodInfos) { char lpstrPath[MAX_PATH]; @@ -314,10 +357,8 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, IShellBrowserImpl *This = (IShellBrowserImpl *)iface; - TRACE("(%p)(pidl=%p,flags=0x%08x(%s))\n", This, pidl, wFlags, - (wFlags & SBSP_RELATIVE) ? "SBSP_RELATIVE" : - (wFlags & SBSP_PARENT) ? "SBSP_PARENT" : - (wFlags & SBSP_ABSOLUTE) ? "SBSP_ABSOLUTE" : "SBPS_????"); + TRACE("(%p)(pidl=%p,flags=0x%08x)\n", This, pidl, wFlags); + COMDLG32_DumpSBSPFlags(wFlags); fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); @@ -720,7 +761,7 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowse fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); - /* If the selected object is not a folder, send a IDOK command to parent window */ + /* If the selected object is not a folder, send an IDOK command to parent window */ if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1))) { HRESULT hRes; diff --git a/reactos/lib/comdlg32/printdlg.c b/reactos/lib/comdlg32/printdlg.c index c9eb8ac5488..322b3d10135 100644 --- a/reactos/lib/comdlg32/printdlg.c +++ b/reactos/lib/comdlg32/printdlg.c @@ -86,14 +86,14 @@ static WCHAR wszFakeDocumentText[1024]; */ BOOL PRINTDLG_OpenDefaultPrinter(HANDLE *hprn) { - char buf[260]; - DWORD dwBufLen = sizeof(buf); + WCHAR buf[260]; + DWORD dwBufLen = sizeof(buf) / sizeof(buf[0]); BOOL res; - if(!GetDefaultPrinterA(buf, &dwBufLen)) + if(!GetDefaultPrinterW(buf, &dwBufLen)) return FALSE; - res = OpenPrinterA(buf, hprn, NULL); + res = OpenPrinterW(buf, hprn, NULL); if (!res) - FIXME("Could not open printer %s?!\n",buf); + WARN("Could not open printer %s\n", debugstr_w(buf)); return res; } @@ -459,7 +459,7 @@ static BOOL PRINTDLG_PaperSizeA( goto out; } - Names = (char*)HeapAlloc(GetProcessHeap(),0,NrOfEntries*64); + Names = HeapAlloc(GetProcessHeap(),0,NrOfEntries*64); if (NrOfEntries != (ret=DeviceCapabilitiesA(devname,portname,DC_PAPERNAMES,Names,dm))) { FIXME("Number of returned vals %d is not %d\n",NrOfEntries,ret); goto out; @@ -517,7 +517,7 @@ static BOOL PRINTDLG_PaperSizeW( goto out; } - Names = (WCHAR*)HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*NrOfEntries*64); + Names = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*NrOfEntries*64); if (NrOfEntries != (ret=DeviceCapabilitiesW(devname,portname,DC_PAPERNAMES,Names,dm))) { FIXME("Number of returned vals %d is not %d\n",NrOfEntries,ret); goto out; @@ -3026,6 +3026,7 @@ HRESULT WINAPI PrintDlgExA(LPPRINTDLGEXA lpPrintDlgExA) FIXME("stub\n"); return E_NOTIMPL; } + /*********************************************************************** * PrintDlgExW (COMDLG32.@) */ diff --git a/reactos/lib/comdlg32/printdlg16.c b/reactos/lib/comdlg32/printdlg16.c index ab84cc7a3bc..95af3ed63ae 100644 --- a/reactos/lib/comdlg32/printdlg16.c +++ b/reactos/lib/comdlg32/printdlg16.c @@ -427,7 +427,7 @@ BOOL16 WINAPI PrintDlg16( ptr16 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PRINT_PTRA16)); ptr16->lpPrintDlg16 = lppd; PrintStructures = &ptr16->print32; - PrintStructures->lpPrintDlg = (LPPRINTDLGA)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PRINTDLGA)); + PrintStructures->lpPrintDlg = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PRINTDLGA)); #define CVAL(x) PrintStructures->lpPrintDlg->x = lppd->x; #define MVAL(x) PrintStructures->lpPrintDlg->x = MapSL(lppd->x); CVAL(Flags); diff --git a/reactos/w32api/include/shlobj.h b/reactos/w32api/include/shlobj.h index 55308ffe07e..5c367ccdfc4 100644 --- a/reactos/w32api/include/shlobj.h +++ b/reactos/w32api/include/shlobj.h @@ -315,8 +315,15 @@ extern "C" { #define SBSP_OPENMODE 16 #define SBSP_EXPLOREMODE 32 #define SBSP_ABSOLUTE 0 +#define SBSP_HELPMODE 0x40 +#define SBSP_NOTRANSFERHIST 0x80 #define SBSP_RELATIVE 0x1000 #define SBSP_PARENT 0x2000 +#define SBSP_NAVIGATEBACK 0x4000 +#define SBSP_NAVIGATEFORWARD 0x8000 +#define SBSP_ALLOW_AUTONAVIGATE 0x10000 +#define SBSP_NOAUTOSELECT 0x4000000 +#define SBSP_WRITENOHISTORY 0x8000000 #define SBSP_INITIATEDBYHLINKFRAME 0x80000000 #define SBSP_REDIRECT 0x40000000 #define FCW_STATUS 1