Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3c6253bb
Commit
3c6253bb
authored
Mar 15, 1999
by
Klaas van Gend
Committed by
Alexandre Julliard
Mar 15, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Reimplementation of the CommDlg ExtendedError mechanism using TLS.
- Some header inclusion cleanup.
parent
b8742935
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
96 additions
and
78 deletions
+96
-78
colordlg.c
dlls/commdlg/colordlg.c
+3
-9
filedlg.c
dlls/commdlg/filedlg.c
+12
-16
finddlg.c
dlls/commdlg/finddlg.c
+0
-14
fontdlg.c
dlls/commdlg/fontdlg.c
+3
-7
generic.c
dlls/commdlg/generic.c
+72
-14
printdlg.c
dlls/commdlg/printdlg.c
+3
-18
commdlg.h
include/commdlg.h
+3
-0
No files found.
dlls/commdlg/colordlg.c
View file @
3c6253bb
...
...
@@ -3,7 +3,6 @@
*
* Copyright 1994 Martin Ayotte
* Copyright 1996 Albrecht Kleine
* Copyright 1999 Klaas van Gend
*/
#include <ctype.h>
...
...
@@ -14,20 +13,15 @@
#include "wine/winuser16.h"
#include "win.h"
#include "heap.h"
#include "message.h"
#include "commdlg.h"
#include "resource.h"
#include "dialog.h"
#include "dlgs.h"
#include "module.h"
#include "drive.h"
#include "debug.h"
#include "font.h"
#include "winproc.h"
#include "cderr.h"
extern
DWORD
CommDlgLastError
;
/***********************************************************************
* ChooseColor (COMMDLG.5)
*/
...
...
@@ -46,7 +40,7 @@ BOOL16 WINAPI ChooseColor16(LPCHOOSECOLOR16 lpChCol)
{
if
(
!
(
template
=
LockResource16
(
lpChCol
->
hInstance
)))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
}
...
...
@@ -57,13 +51,13 @@ BOOL16 WINAPI ChooseColor16(LPCHOOSECOLOR16 lpChCol)
lpChCol
->
lpTemplateName
,
RT_DIALOG16
)))
{
C
ommDlgLastError
=
CDERR_FINDRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
)
;
return
FALSE
;
}
if
(
!
(
hDlgTmpl
=
LoadResource16
(
lpChCol
->
hInstance
,
hResInfo
))
||
!
(
template
=
LockResource16
(
hDlgTmpl
)))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
}
...
...
dlls/commdlg/filedlg.c
View file @
3c6253bb
...
...
@@ -3,7 +3,6 @@
*
* Copyright 1994 Martin Ayotte
* Copyright 1996 Albrecht Kleine
* Copyright 1999 Klaas van Gend
*/
#include <ctype.h>
...
...
@@ -22,12 +21,9 @@
#include "module.h"
#include "drive.h"
#include "debug.h"
#include "font.h"
#include "winproc.h"
#include "cderr.h"
extern
DWORD
CommDlgLastError
;
static
HICON16
hFolder
=
0
;
static
HICON16
hFolder2
=
0
;
static
HICON16
hFloppy
=
0
;
...
...
@@ -106,7 +102,7 @@ BOOL16 WINAPI GetOpenFileName16(
{
if
(
!
(
template
=
LockResource
(
MapHModuleSL
(
lpofn
->
hInstance
))))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
}
...
...
@@ -115,14 +111,14 @@ BOOL16 WINAPI GetOpenFileName16(
if
(
!
(
hResInfo
=
FindResourceA
(
MapHModuleSL
(
lpofn
->
hInstance
),
PTR_SEG_TO_LIN
(
lpofn
->
lpTemplateName
),
RT_DIALOGA
)))
{
C
ommDlgLastError
=
CDERR_FINDRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
)
;
return
FALSE
;
}
if
(
!
(
hDlgTmpl
=
LoadResource
(
MapHModuleSL
(
lpofn
->
hInstance
),
hResInfo
))
||
!
(
template
=
LockResource
(
hDlgTmpl
)))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
}
else
{
...
...
@@ -134,7 +130,7 @@ BOOL16 WINAPI GetOpenFileName16(
{
if
(
!
(
template
=
LockResource16
(
lpofn
->
hInstance
)))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
}
...
...
@@ -144,13 +140,13 @@ BOOL16 WINAPI GetOpenFileName16(
lpofn
->
lpTemplateName
,
RT_DIALOG16
)))
{
C
ommDlgLastError
=
CDERR_FINDRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
)
;
return
FALSE
;
}
if
(
!
(
hDlgTmpl
=
LoadResource16
(
lpofn
->
hInstance
,
hResInfo
))
||
!
(
template
=
LockResource16
(
hDlgTmpl
)))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
}
else
{
...
...
@@ -243,7 +239,7 @@ BOOL16 WINAPI GetSaveFileName16(
{
if
(
!
(
template
=
LockResource
(
MapHModuleSL
(
lpofn
->
hInstance
))))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
}
...
...
@@ -254,14 +250,14 @@ BOOL16 WINAPI GetSaveFileName16(
PTR_SEG_TO_LIN
(
lpofn
->
lpTemplateName
),
RT_DIALOGA
)))
{
C
ommDlgLastError
=
CDERR_FINDRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
)
;
return
FALSE
;
}
if
(
!
(
hDlgTmpl
=
LoadResource
(
MapHModuleSL
(
lpofn
->
hInstance
),
hResInfo
))
||
!
(
template
=
LockResource
(
hDlgTmpl
)))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
win32Format
=
TRUE
;
...
...
@@ -274,7 +270,7 @@ BOOL16 WINAPI GetSaveFileName16(
{
if
(
!
(
template
=
LockResource16
(
lpofn
->
hInstance
)))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
}
...
...
@@ -285,13 +281,13 @@ BOOL16 WINAPI GetSaveFileName16(
lpofn
->
lpTemplateName
,
RT_DIALOG16
)))
{
C
ommDlgLastError
=
CDERR_FINDRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
)
;
return
FALSE
;
}
if
(
!
(
hDlgTmpl
=
LoadResource16
(
lpofn
->
hInstance
,
hResInfo
))
||
!
(
template
=
LockResource16
(
hDlgTmpl
)))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
}
else
{
...
...
dlls/commdlg/finddlg.c
View file @
3c6253bb
...
...
@@ -3,7 +3,6 @@
*
* Copyright 1994 Martin Ayotte
* Copyright 1996 Albrecht Kleine
* Copyright 1999 Klaas van Gend
*/
#include <ctype.h>
...
...
@@ -13,28 +12,15 @@
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "win.h"
#include "heap.h"
#include "message.h"
#include "commdlg.h"
#include "resource.h"
#include "dialog.h"
#include "dlgs.h"
#include "module.h"
#include "drive.h"
#include "debug.h"
#include "font.h"
#include "winproc.h"
extern
DWORD
CommDlgLastError
;
/*
extern HBITMAP16 hFolder;
extern HBITMAP16 hFolder2;
extern HBITMAP16 hFloppy;
extern HBITMAP16 hHDisk;
extern HBITMAP16 hCDRom;
extern HBITMAP16 hBitmapTT;
extern const char defaultfilter[];
*/
/***********************************************************************
* FindText16 (COMMDLG.11)
...
...
dlls/commdlg/fontdlg.c
View file @
3c6253bb
...
...
@@ -3,7 +3,6 @@
*
* Copyright 1994 Martin Ayotte
* Copyright 1996 Albrecht Kleine
* Copyright 1999 Klaas van Gend
*/
#include <ctype.h>
...
...
@@ -20,14 +19,11 @@
#include "dialog.h"
#include "dlgs.h"
#include "module.h"
#include "drive.h"
#include "debug.h"
#include "font.h"
#include "winproc.h"
#include "cderr.h"
extern
DWORD
CommDlgLastError
;
static
HBITMAP16
hBitmapTT
=
0
;
...
...
@@ -77,7 +73,7 @@ BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
{
if
(
!
(
template
=
LockResource16
(
lpChFont
->
hInstance
)))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
}
...
...
@@ -88,13 +84,13 @@ BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
lpChFont
->
lpTemplateName
,
RT_DIALOG16
)))
{
C
ommDlgLastError
=
CDERR_FINDRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
)
;
return
FALSE
;
}
if
(
!
(
hDlgTmpl
=
LoadResource16
(
lpChFont
->
hInstance
,
hResInfo
))
||
!
(
template
=
LockResource16
(
hDlgTmpl
)))
{
C
ommDlgLastError
=
CDERR_LOADRESFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
)
;
return
FALSE
;
}
}
...
...
dlls/commdlg/generic.c
View file @
3c6253bb
/*
* COMMDLG functions
* COMMDLG
/COMDLG32
functions
*
* Copyright 1994 Martin Ayotte
* Copyright 1996 Albrecht Kleine
* Copyright 1998 Bertho Stultiens
* Copyright 1999 Klaas van Gend
*/
...
...
@@ -10,31 +11,88 @@
#include <stdlib.h>
#include <string.h>
#include "winbase.h"
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "win.h"
#include "heap.h"
#include "message.h"
#include "commdlg.h"
#include "resource.h"
#include "dialog.h"
#include "dlgs.h"
#include "module.h"
#include "drive.h"
#include "debug.h"
#include "font.h"
#include "winproc.h"
static
DWORD
CommDlgLastError
=
0
;
#define COMDLG32_LAST_ERROR_NOT_ALLOCATED 0xF684F684
static
DWORD
COMDLG32_TlsIndex
=
COMDLG32_LAST_ERROR_NOT_ALLOCATED
;
/***********************************************************************
* COMDLG32_DllEntryPoint [COMDLG32.entry]
*
* Initialisation code for the COMDLG32 DLL
* This call should implement the allocation of the TLS.
*
* RETURNS:
*
* BUGS:
* Remains unimplemented until Bertho finishes his ELF-DLL code
*/
BOOL
WINAPI
COMDLG32_DllEntryPoint
(
HINSTANCE
hInstance
,
DWORD
Reason
,
LPVOID
Reserved
);
/***********************************************************************
* CommDlgExtendedError (COMMDLG.26)
* COMDLG32_AllocTlsForCommDlgExtError [internal]
*
* Allocates Thread Local Storage for the ComDlg32 local
* last extended error
*
* RETURNS:
* nothing.
*
* BUGS:
* 1) FIXME: This function is only temporary, as this code *SHOULD*
* be executed in the DLL Entrypoint. For now, it is done
* this way.
* 2) This allocated memory is NEVER freed again!
*/
DWORD
WINAPI
CommDlgExtendedError
(
void
)
void
COMDLG32_AllocTlsForCommDlgExtError
(
)
{
return
CommDlgLastError
;
FIXME
(
commdlg
,
"TLS for CommDlgExtendedError allocated on-the-fly
\n
"
);
if
(
COMDLG32_TlsIndex
==
COMDLG32_LAST_ERROR_NOT_ALLOCATED
)
COMDLG32_TlsIndex
=
TlsAlloc
();
if
(
COMDLG32_TlsIndex
==
0xFFFFFFFF
)
ERR
(
commdlg
,
"No space for COMDLG32 TLS
\n
"
);
}
/***********************************************************************
* COMDLG32_SetCommDlgExtendedError [internal]
*
* Used to set the thread's local error value if a comdlg32 function fails.
*/
void
COMDLG32_SetCommDlgExtendedError
(
DWORD
err
)
{
/*FIXME: This check and the resulting alloc should be removed
* when the DLL Entry code is finished
*/
if
(
COMDLG32_TlsIndex
==
COMDLG32_LAST_ERROR_NOT_ALLOCATED
)
COMDLG32_AllocTlsForCommDlgExtError
();
TlsSetValue
(
COMDLG32_TlsIndex
,
(
void
*
)
err
);
}
/***********************************************************************
* CommDlgExtendedError [COMDLG32.5]
* [COMMDLG.26]
* Get the thread's local error value if a comdlg32 function fails.
* RETURNS
* Current error value which might not be valid
* if a previous call succeeded.
*/
DWORD
WINAPI
CommDlgExtendedError
(
void
)
{
/*FIXME: This check and the resulting alloc should be removed
* when the DLL Entry code is finished
*/
if
(
COMDLG32_TlsIndex
==
COMDLG32_LAST_ERROR_NOT_ALLOCATED
)
COMDLG32_AllocTlsForCommDlgExtError
();
return
(
DWORD
)
TlsGetValue
(
COMDLG32_TlsIndex
);
}
dlls/commdlg/printdlg.c
View file @
3c6253bb
...
...
@@ -13,32 +13,16 @@
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "win.h"
#include "heap.h"
#include "message.h"
#include "commdlg.h"
#include "resource.h"
#include "dialog.h"
#include "dlgs.h"
#include "module.h"
#include "drive.h"
#include "debug.h"
#include "font.h"
#include "winproc.h"
#include "cderr.h"
DWORD
CommDlgLastError
=
0
;
extern
HBITMAP16
hFolder
;
extern
HBITMAP16
hFolder2
;
extern
HBITMAP16
hFloppy
;
extern
HBITMAP16
hHDisk
;
extern
HBITMAP16
hCDRom
;
extern
HBITMAP16
hBitmapTT
;
extern
const
char
defaultfilter
[];
/***********************************************************************
* PrintDlg16 (COMMDLG.20)
*/
...
...
@@ -136,14 +120,15 @@ BOOL WINAPI PrintDlgA(
{
WARN
(
commdlg
,
": PrintDlg was requested to return printer info only."
"
\n
The return value currently does NOT provide these.
\n
"
);
CommDlgLastError
=
PDERR_NODEVICES
;
/* return TRUE, thus never checked! */
COMDLG32_SetCommDlgExtendedError
(
PDERR_NODEVICES
);
/* return TRUE, thus never checked! */
return
(
TRUE
);
}
if
(
lppd
->
Flags
&
PD_PRINTSETUP
)
{
FIXME
(
commdlg
,
": PrintDlg was requested to display PrintSetup box.
\n
"
);
C
ommDlgLastError
=
PDERR_INITFAILURE
;
C
OMDLG32_SetCommDlgExtendedError
(
PDERR_INITFAILURE
)
;
return
(
FALSE
);
}
...
...
include/commdlg.h
View file @
3c6253bb
...
...
@@ -645,6 +645,9 @@ LRESULT WINAPI FormatCharDlgProc16(HWND16,UINT16,WPARAM16,LPARAM);
LRESULT
WINAPI
FormatCharDlgProcA
(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
LRESULT
WINAPI
FormatCharDlgProcW
(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
#define FormatCharDlgProc WINELIB_NAME_AW(FormatCharDlgProc)
void
COMDLG32_SetCommDlgExtendedError
(
DWORD
err
);
#ifdef __cplusplus
}
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment