#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "winreg.h"
#include "winternl.h"
#include "commdlg.h"
#include "shlwapi.h"
#include "cderr.h"
#include "cdlg.h"
Go to the source code of this file.
|
| WINE_DEFAULT_DEBUG_CHANNEL (commdlg) |
|
static BOOL | FD31_Init (void) |
|
static void | FD31_StripEditControl (HWND hwnd) |
|
static BOOL | FD31_CallWindowProc (const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam) |
|
static LPCWSTR | FD31_GetFileType (LPCWSTR cfptr, LPCWSTR fptr, const WORD index) |
|
static BOOL | FD31_ScanDir (const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath) |
|
static LONG | FD31_WMDrawItem (HWND hWnd, WPARAM wParam, LPARAM lParam, int savedlg, const DRAWITEMSTRUCT *lpdis) |
|
static void | FD31_UpdateResult (const FD31_DATA *lfs, const WCHAR *tmpstr) |
|
static void | FD31_UpdateFileTitle (const FD31_DATA *lfs) |
|
static LRESULT | FD31_DirListDblClick (const FD31_DATA *lfs) |
|
static LRESULT | FD31_FileListSelect (const FD31_DATA *lfs) |
|
static LRESULT | FD31_TestPath (const FD31_DATA *lfs, LPWSTR path) |
|
static LRESULT | FD31_Validate (const FD31_DATA *lfs, LPCWSTR path, UINT control, INT itemIndex, BOOL internalUse) |
|
static LRESULT | FD31_DiskChange (const FD31_DATA *lfs) |
|
static LRESULT | FD31_FileTypeChange (const FD31_DATA *lfs) |
|
static LRESULT | FD31_WMCommand (HWND hWnd, LPARAM lParam, UINT notification, UINT control, const FD31_DATA *lfs) |
|
static LPWSTR | FD31_MapStringPairsToW (LPCSTR strA, UINT size) |
|
static LPWSTR | FD31_DupToW (LPCSTR str, DWORD size) |
|
static void | FD31_MapOfnStructA (const OPENFILENAMEA *ofnA, LPOPENFILENAMEW ofnW, BOOL open) |
|
static void | FD31_FreeOfnW (OPENFILENAMEW *ofnW) |
|
static void | FD31_DestroyPrivate (PFD31_DATA lfs) |
|
static BOOL | FD31_GetTemplate (PFD31_DATA lfs) |
|
static PFD31_DATA | FD31_AllocPrivate (LPARAM lParam, UINT dlgType, BOOL IsUnicode) |
|
static LONG | FD31_WMInitDialog (HWND hWnd, WPARAM wParam, LPARAM lParam) |
|
static int | FD31_GetFldrHeight (void) |
|
static LONG | FD31_WMMeasureItem (LPARAM lParam) |
|
static INT_PTR CALLBACK | FD31_FileOpenDlgProc (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) |
|
BOOL | GetFileName31A (OPENFILENAMEA *lpofn, UINT dlgType) |
|
BOOL | GetFileName31W (OPENFILENAMEW *lpofn, UINT dlgType) |
|
◆ BUFFILE
◆ BUFFILEALLOC
◆ FD31_OFN_PROP
#define FD31_OFN_PROP "FILEDLG_OFN" |
◆ FD31_DATA
◆ PFD31_DATA
◆ FD31_AllocPrivate()
Definition at line 918 of file filedlg31.c.
919{
920 FD31_DATA *lfs = heap_alloc_zero(
sizeof(*lfs));
921
922 TRACE(
"alloc private buf %p\n", lfs);
923 if (!lfs)
return NULL;
927
928 if (IsUnicode)
929 {
935 }
936 else
937 {
945 }
946
948 {
951 }
954
955 return lfs;
956}
struct tagOFNW * LPOPENFILENAMEW
struct tagOFNA * LPOPENFILENAMEA
static void FD31_DestroyPrivate(PFD31_DATA lfs)
static BOOL FD31_GetTemplate(PFD31_DATA lfs)
static void FD31_MapOfnStructA(const OPENFILENAMEA *ofnA, LPOPENFILENAMEW ofnW, BOOL open)
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)
Referenced by GetFileName31A(), and GetFileName31W().
◆ FD31_CallWindowProc()
Definition at line 125 of file filedlg31.c.
126{
128
130 {
131 TRACE(
"Call hookA %p (%p, %04x, %08lx, %08lx)\n",
134 TRACE(
"ret hookA %p (%p, %04x, %08lx, %08lx)\n",
137 }
138
139 TRACE(
"Call hookW %p (%p, %04x, %08lx, %08lx)\n",
142 TRACE(
"Ret hookW %p (%p, %04x, %08lx, %08lx)\n",
145}
Referenced by FD31_DirListDblClick(), FD31_FileListSelect(), FD31_FileOpenDlgProc(), FD31_Validate(), and FD31_WMInitDialog().
◆ FD31_DestroyPrivate()
Definition at line 835 of file filedlg31.c.
836{
838 if (!lfs) return;
840 TRACE(
"destroying private allocation %p\n", lfs);
841
842
844 {
847 }
850}
static BOOL heap_free(void *mem)
static void FD31_FreeOfnW(OPENFILENAMEW *ofnW)
HANDLE WINAPI RemovePropA(_In_ HWND, _In_ LPCSTR)
Referenced by FD31_AllocPrivate(), GetFileName31A(), and GetFileName31W().
◆ FD31_DirListDblClick()
Definition at line 411 of file filedlg31.c.
412{
417
418
426
427 if (tmpstr[0] == '[')
428 {
431 }
433
435
437 {
441 }
443}
static void * heap_alloc(size_t len)
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
static const WCHAR FILE_bslash[]
static BOOL FD31_ScanDir(const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath)
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Referenced by FD31_WMCommand().
◆ FD31_DiskChange()
Definition at line 616 of file filedlg31.c.
617{
622
626 return 0;
632
634}
static void FD31_StripEditControl(HWND hwnd)
static const WCHAR FILE_specc[]
static LRESULT FD31_Validate(const FD31_DATA *lfs, LPCWSTR path, UINT control, INT itemIndex, BOOL internalUse)
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
Referenced by FD31_WMCommand().
◆ FD31_DupToW()
◆ FD31_FileListSelect()
Definition at line 449 of file filedlg31.c.
450{
454
458
459
461 {
466 }
468 {
471 }
472
473
475}
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
Referenced by FD31_WMCommand().
◆ FD31_FileOpenDlgProc()
Definition at line 1100 of file filedlg31.c.
1102{
1104
1107 {
1110 if (lRet) return lRet;
1111 }
1112 switch (wMsg)
1113 {
1116
1119
1122
1125#if 0
1129 {
1132 return hGRAYBrush;
1135 return hGRAYBrush;
1136 }
1137 break;
1138#endif
1139 }
1141}
static LONG FD31_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
static LRESULT FD31_WMCommand(HWND hWnd, LPARAM lParam, UINT notification, UINT control, const FD31_DATA *lfs)
static LONG FD31_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam, int savedlg, const DRAWITEMSTRUCT *lpdis)
static LONG FD31_WMMeasureItem(LPARAM lParam)
struct tagFD31_DATA * PFD31_DATA
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
Referenced by GetFileName31A(), and GetFileName31W().
◆ FD31_FileTypeChange()
◆ FD31_FreeOfnW()
◆ FD31_GetFileType()
Definition at line 150 of file filedlg31.c.
151{
154 if (cfptr)
156 {
159 return cfptr;
161 }
162 if (fptr)
164 {
167 return fptr;
169 }
171}
static const WCHAR FILE_star[]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Referenced by FD31_ScanDir(), and FD31_WMInitDialog().
◆ FD31_GetFldrHeight()
static int FD31_GetFldrHeight |
( |
void |
| ) |
|
|
static |
◆ FD31_GetTemplate()
Definition at line 859 of file filedlg31.c.
860{
864
866 {
868 {
871 }
872 }
874 {
875 HRSRC hResInfo;
876 if (ofnA)
878 else
880 if (!hResInfo)
881 {
884 }
887 {
890 }
891 }
892 else
893 {
894 HRSRC hResInfo;
896 {
899 }
902 {
905 }
906 }
908}
#define CDERR_LOADRESFAILURE
#define CDERR_FINDRESFAILURE
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN
#define OFN_ENABLETEMPLATEHANDLE
#define OFN_ENABLETEMPLATE
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
LPVOID WINAPI LockResource(HGLOBAL handle)
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Referenced by FD31_AllocPrivate().
◆ FD31_Init()
Definition at line 78 of file filedlg31.c.
79{
81
91 {
92 ERR(
"Error loading icons!\n");
94 }
96 }
98}
HANDLE WINAPI LoadImageA(_In_opt_ HINSTANCE hInst, _In_ LPCSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Referenced by GetFileName31A(), and GetFileName31W().
◆ FD31_MapOfnStructA()
Definition at line 757 of file filedlg31.c.
758{
760
765
775 {
778 }
782 } else {
791 }
797 {
799 {
802 }
803 else
805 }
807 {
808 ofnW->pvReserved = ofnA->pvReserved;
809 ofnW->dwReserved = ofnA->dwReserved;
810 ofnW->FlagsEx = ofnA->FlagsEx;
811 }
812}
#define OPENFILENAME_SIZE_VERSION_400W
static LPWSTR FD31_MapStringPairsToW(LPCSTR strA, UINT size)
static LPWSTR FD31_DupToW(LPCSTR str, DWORD size)
GLenum GLuint GLenum GLsizei const GLchar * buf
#define memcpy(s1, s2, n)
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
Referenced by FD31_AllocPrivate().
◆ FD31_MapStringPairsToW()
◆ FD31_ScanDir()
Definition at line 176 of file filedlg31.c.
177{
181 HCURSOR hCursorWait, oldCursor;
182
186
187
190
193
194
198
203 if (scptr) *scptr = 0;
207 if (scptr) *scptr = ';';
208 filter = (scptr) ? (scptr + 1) : 0;
209 }
210 }
211
212
214
217 }
219 return lRet;
220}
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
static LPCWSTR FD31_GetFileType(LPCWSTR cfptr, LPCWSTR fptr, const WORD index)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int WINAPI DlgDirListW(_In_ HWND, _Inout_ LPWSTR, _In_ int, _In_ int, _In_ UINT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Referenced by FD31_DirListDblClick(), FD31_TestPath(), and FD31_WMInitDialog().
◆ FD31_StripEditControl()
static void FD31_StripEditControl |
( |
HWND |
hwnd | ) |
|
|
static |
◆ FD31_TestPath()
Definition at line 482 of file filedlg31.c.
483{
485 LPWSTR pBeginFileName, pstr2;
487
489 if (pBeginFileName ==
NULL)
491
493 {
494
495 if (pBeginFileName !=
NULL)
496 {
498 *(pBeginFileName + 1) = 0;
499 }
500 else
501 {
505 }
506
511 }
512
513
514
515
517 if (pBeginFileName ==
NULL || *(pBeginFileName + 1) != 0)
519
520
523
524
525
526 *pstr2 = 0;
527
528 if (pBeginFileName !=
NULL)
529 {
530
531 *pBeginFileName = 0;
533
535
537 {
539 }
541 }
542 else
545}
Referenced by FD31_Validate().
◆ FD31_UpdateFileTitle()
Definition at line 388 of file filedlg31.c.
389{
393
395 {
399 if (ofnA)
400 {
404 }
405 }
406}
#define WideCharToMultiByte
Referenced by FD31_Validate().
◆ FD31_UpdateResult()
Definition at line 331 of file filedlg31.c.
332{
333 int lenstr2;
338
341 tmpstr2[0] = '\0';
342 else
345 if (lenstr2 > 3)
346 tmpstr2[lenstr2++]='\\';
349 return;
350
352
353
356
357
360
361 TRACE(
"file %s, file offset %d, ext offset %d\n",
363
364
365 if (ofnA)
366 {
372
373
374
377
378
381 }
382}
#define GetCurrentDirectoryW(x, y)
LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath)
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath)
Referenced by FD31_Validate().
◆ FD31_Validate()
Definition at line 551 of file filedlg31.c.
553{
560
561 memcpy( &ofnsav, ofnW, copied_size );
562
563
566 else
568
570
572 {
575 }
577
578 if (internalUse)
579 {
581 {
584 }
586 }
587
590 {
593 if (lRet)
594 {
595 memcpy( ofnW, &ofnsav, copied_size );
597 }
598 }
600 {
602 {
607 }
608 }
610}
#define OFN_ALLOWMULTISELECT
static void FD31_UpdateResult(const FD31_DATA *lfs, const WCHAR *tmpstr)
static void FD31_UpdateFileTitle(const FD31_DATA *lfs)
static LRESULT FD31_TestPath(const FD31_DATA *lfs, LPWSTR path)
Referenced by FD31_DiskChange(), FD31_FileTypeChange(), and FD31_WMCommand().
◆ FD31_WMCommand()
Definition at line 660 of file filedlg31.c.
662{
663 switch (control)
664 {
668 {
670 }
673 break;
674
679 break;
680
684 break;
685
687 break;
688
690 break;
691
695 break;
696
698 TRACE(
"OK pressed\n");
702
706
710 }
712}
static LRESULT FD31_FileListSelect(const FD31_DATA *lfs)
static LRESULT FD31_FileTypeChange(const FD31_DATA *lfs)
static LRESULT FD31_DirListDblClick(const FD31_DATA *lfs)
static LRESULT FD31_DiskChange(const FD31_DATA *lfs)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
Referenced by FD31_FileOpenDlgProc().
◆ FD31_WMDrawItem()
Definition at line 225 of file filedlg31.c.
227{
231
233 {
237
239 {
242 }
243 if (savedlg)
245
249
252
254 {
257 }
260 }
261
263 {
268
270 {
273 }
277
280
282 {
285 }
289 }
291 {
299 {
305 }
307 {
310 }
314
316 {
319 }
323 }
325}
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
static const int fldrWidth
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
#define COLOR_HIGHLIGHTTEXT
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
Referenced by FD31_FileOpenDlgProc().
◆ FD31_WMInitDialog()
Definition at line 961 of file filedlg31.c.
962{
968
969 if (!lfs)
return FALSE;
973
975
977
979 {
982 TRACE(
"lpstrCustomFilter = %p\n", pstr);
983 while(*pstr)
984 {
985 old_pstr = pstr;
990 TRACE(
"add str=%s associated to %s\n",
995 }
996 }
997
1001 while(*pstr) {
1002 old_pstr = pstr;
1007 TRACE(
"add str=%s associated to %s\n",
1012 }
1013 }
1014
1019 {
1022 }
1023 else
1024 {
1027 TRACE(
"nFilterIndex = %d, SetText of edt1 to %s\n",
1030 }
1031
1032 *tmpstr = 0;
1034
1035
1036
1037
1038
1040 {
1044 if (
len > 0 && tmpstr[
len-1] !=
'\\' && tmpstr[
len-1] !=
':') {
1047 }
1048 }
1049 else
1050 *tmpstr = 0;
1052 *tmpstr = 0;
1054 WARN(
"Couldn't read initial directory %s!\n",
debugstr_w(tmpstr));
1055 }
1056
1057 {
1059 char str[4] =
"a:\\";
1061 for(
i = 0,
n = -1;
i < 26;
i++)
1062 {
1066 }
1067 }
1076}
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
#define DRIVE_NO_ROOT_DIR
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
int WINAPI DlgDirListComboBoxW(_In_ HWND, _Inout_ LPWSTR, _In_ int, _In_ int, _In_ UINT)
Referenced by FD31_FileOpenDlgProc().
◆ FD31_WMMeasureItem()
Definition at line 1086 of file filedlg31.c.
1087{
1089
1093}
static int FD31_GetFldrHeight(void)
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
Referenced by FD31_FileOpenDlgProc().
◆ GetFileName31A()
Definition at line 1148 of file filedlg31.c.
1149{
1152
1154
1157 if (lfs)
1158 {
1162 }
1163
1165 return bRet;
1166}
static PFD31_DATA FD31_AllocPrivate(LPARAM lParam, UINT dlgType, BOOL IsUnicode)
static BOOL FD31_Init(void)
static INT_PTR CALLBACK FD31_FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
INT_PTR WINAPI DialogBoxIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
Referenced by GetOpenFileNameA(), and GetSaveFileNameA().
◆ GetFileName31W()
Definition at line 1173 of file filedlg31.c.
1174{
1177
1179
1181 if (lfs)
1182 {
1186 }
1187
1188 TRACE(
"file %s, file offset %d, ext offset %d\n",
1190 return bRet;
1191}
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
Referenced by GetOpenFileNameW(), and GetSaveFileNameW().
◆ WINE_DEFAULT_DEBUG_CHANNEL()
WINE_DEFAULT_DEBUG_CHANNEL |
( |
commdlg |
| ) |
|
◆ FILE_bslash
◆ FILE_specc
◆ FILE_star
◆ fldrHeight
◆ fldrWidth
◆ hCDRom
◆ hFloppy
◆ hFolder
◆ hFolder2
◆ hHDisk
◆ hNet