Sync to Wine-20050419:

Francois Gouget <fgouget@free.fr>
- Assorted spelling fixes.
- SBSP_ABSOLUTE is 0 so we cannot do (wFlags & SBSP_ABSOLUTE).
- Add COMDLG32_DumpSBSPFlags().
Eric Pouech <pouech-eric@wanadoo.fr>
- Added proper definition for PRINTDLGEX[AW] structures.
Jakob Eriksson <jakov@vmlinux.org>
- Get rid of HeapAlloc casts.
Juan Lang <juan_lang@yahoo.com>
- Change a fixme to a warn, and use W version of call.
Peter Berg Larsen <pebl@math.ku.dk>
- Replace strncpy with memcpy or lstrcpyn.
- Janitorial: Get rid of strncpy/strncpyW.

svn path=/trunk/; revision=14821
This commit is contained in:
Gé van Geldorp 2005-04-26 19:18:13 +00:00
parent c292d7ed88
commit 6119adfe22
7 changed files with 74 additions and 24 deletions

View file

@ -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

View file

@ -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
{

View file

@ -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(n<size)
{
/* 'n' includes trailing \0 */
@ -2034,7 +2035,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
{
LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
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 */

View file

@ -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;

View file

@ -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.@)
*/

View file

@ -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);

View file

@ -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