#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 915 of file filedlg31.c.
916{
917 FD31_DATA *lfs = heap_alloc_zero(
sizeof(*lfs));
918
919 TRACE(
"alloc private buf %p\n", lfs);
920 if (!lfs)
return NULL;
924
925 if (IsUnicode)
926 {
932 }
933 else
934 {
942 }
943
945 {
948 }
951
952 return lfs;
953}
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 122 of file filedlg31.c.
123{
125
127 {
128 TRACE(
"Call hookA %p (%p, %04x, %08Ix, %08Ix)\n",
131 TRACE(
"ret hookA %p (%p, %04x, %08Ix, %08Ix)\n",
134 }
135
136 TRACE(
"Call hookW %p (%p, %04x, %08Ix, %08Ix)\n",
139 TRACE(
"Ret hookW %p (%p, %04x, %08Ix, %08Ix)\n",
142}
Referenced by FD31_DirListDblClick(), FD31_FileListSelect(), FD31_FileOpenDlgProc(), FD31_Validate(), and FD31_WMInitDialog().
◆ FD31_DestroyPrivate()
Definition at line 832 of file filedlg31.c.
833{
835 if (!lfs) return;
837 TRACE(
"destroying private allocation %p\n", lfs);
838
839
841 {
844 }
847}
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 408 of file filedlg31.c.
409{
414
415
423
424 if (tmpstr[0] == '[')
425 {
428 }
430
432
434 {
438 }
440}
static void * heap_alloc(size_t len)
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
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 613 of file filedlg31.c.
614{
619
623 return 0;
629
631}
static void FD31_StripEditControl(HWND hwnd)
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 446 of file filedlg31.c.
447{
451
455
456
458 {
463 }
465 {
468 }
469
470
472}
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
Referenced by FD31_WMCommand().
◆ FD31_FileOpenDlgProc()
Definition at line 1097 of file filedlg31.c.
1099{
1101
1104 {
1107 if (lRet) return lRet;
1108 }
1109 switch (wMsg)
1110 {
1113
1116
1119
1122#if 0
1126 {
1129 return hGRAYBrush;
1132 return hGRAYBrush;
1133 }
1134 break;
1135#endif
1136 }
1138}
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
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Referenced by GetFileName31A(), and GetFileName31W().
◆ FD31_FileTypeChange()
◆ FD31_FreeOfnW()
◆ FD31_GetFileType()
Definition at line 147 of file filedlg31.c.
148{
151 if (cfptr)
153 {
156 return cfptr;
158 }
159 if (fptr)
161 {
164 return fptr;
166 }
168}
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 856 of file filedlg31.c.
857{
861
863 {
865 {
868 }
869 }
871 {
872 HRSRC hResInfo;
873 if (ofnA)
875 else
877 if (!hResInfo)
878 {
881 }
884 {
887 }
888 }
889 else
890 {
891 HRSRC hResInfo;
893 {
896 }
899 {
902 }
903 }
905}
#define CDERR_LOADRESFAILURE
#define CDERR_FINDRESFAILURE
void COMDLG32_SetCommDlgExtendedError(DWORD err)
HINSTANCE COMDLG32_hInstance
#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 75 of file filedlg31.c.
76{
78
88 {
89 ERR(
"Error loading icons!\n");
91 }
93 }
95}
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 754 of file filedlg31.c.
755{
757
762
772 {
775 }
779 } else {
788 }
794 {
796 {
799 }
800 else
802 }
804 {
805 ofnW->pvReserved = ofnA->pvReserved;
806 ofnW->dwReserved = ofnA->dwReserved;
807 ofnW->FlagsEx = ofnA->FlagsEx;
808 }
809}
#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)
Referenced by FD31_AllocPrivate().
◆ FD31_MapStringPairsToW()
Definition at line 715 of file filedlg31.c.
716{
720
727
732}
_ACRTIMP size_t __cdecl strlen(const char *)
GLint GLint GLint GLint GLint x
Referenced by FD31_MapOfnStructA().
◆ FD31_ScanDir()
Definition at line 173 of file filedlg31.c.
174{
178 HCURSOR hCursorWait, oldCursor;
179
183
184
187
190
191
195
200 if (scptr) *scptr = 0;
204 if (scptr) *scptr = ';';
205 filter = (scptr) ? (scptr + 1) : 0;
206 }
207 }
208
209
211
214 }
216 return lRet;
217}
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
static LPCWSTR FD31_GetFileType(LPCWSTR cfptr, LPCWSTR fptr, const WORD index)
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 479 of file filedlg31.c.
480{
482 LPWSTR pBeginFileName, pstr2;
484
486 if (pBeginFileName ==
NULL)
488
490 {
491
492 if (pBeginFileName !=
NULL)
493 {
495 *(pBeginFileName + 1) = 0;
496 }
497 else
498 {
502 }
503
508 }
509
510
511
512
514 if (pBeginFileName ==
NULL || *(pBeginFileName + 1) != 0)
516
517
520
521
522
523 *pstr2 = 0;
524
525 if (pBeginFileName !=
NULL)
526 {
527
528 *pBeginFileName = 0;
530
532
534 {
536 }
538 }
539 else
542}
Referenced by FD31_Validate().
◆ FD31_UpdateFileTitle()
Definition at line 385 of file filedlg31.c.
386{
390
392 {
396 if (ofnA)
397 {
401 }
402 }
403}
#define WideCharToMultiByte
Referenced by FD31_Validate().
◆ FD31_UpdateResult()
Definition at line 328 of file filedlg31.c.
329{
330 int lenstr2;
335
338 tmpstr2[0] = '\0';
339 else
342 if (lenstr2 > 3)
343 tmpstr2[lenstr2++]='\\';
346 return;
347
349
350
353
354
357
358 TRACE(
"file %s, file offset %d, ext offset %d\n",
360
361
362 if (ofnA)
363 {
369
370
371
374
375
378 }
379}
#define GetCurrentDirectoryW(x, y)
LPSTR WINAPI PathFindExtensionA(const char *path)
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
char *WINAPI PathFindFileNameA(const char *path)
Referenced by FD31_Validate().
◆ FD31_Validate()
Definition at line 548 of file filedlg31.c.
550{
557
558 memcpy( &ofnsav, ofnW, copied_size );
559
560
563 else
565
567
569 {
572 }
574
575 if (internalUse)
576 {
578 {
581 }
583 }
584
587 {
590 if (lRet)
591 {
592 memcpy( ofnW, &ofnsav, copied_size );
594 }
595 }
597 {
599 {
604 }
605 }
607}
#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 657 of file filedlg31.c.
659{
661 {
665 {
667 }
670 break;
671
676 break;
677
681 break;
682
684 break;
685
687 break;
688
692 break;
693
695 TRACE(
"OK pressed\n");
699
703
707 }
709}
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 222 of file filedlg31.c.
224{
228
230 {
234
236 {
239 }
240 if (savedlg)
242
246
249
251 {
254 }
257 }
258
260 {
265
267 {
270 }
274
277
279 {
282 }
286 }
288 {
296 {
302 }
304 {
307 }
311
313 {
316 }
320 }
322}
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
static const int fldrWidth
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)
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)
Referenced by FD31_FileOpenDlgProc().
◆ FD31_WMInitDialog()
Definition at line 958 of file filedlg31.c.
959{
965
966 if (!lfs)
return FALSE;
970
972
974
976 {
979 TRACE(
"lpstrCustomFilter = %p\n", pstr);
980 while(*pstr)
981 {
982 old_pstr = pstr;
987 TRACE(
"add str=%s associated to %s\n",
992 }
993 }
994
998 while(*pstr) {
999 old_pstr = pstr;
1004 TRACE(
"add str=%s associated to %s\n",
1009 }
1010 }
1011
1016 {
1019 }
1020 else
1021 {
1024 TRACE(
"nFilterIndex = %ld, SetText of edt1 to %s\n",
1027 }
1028
1029 *tmpstr = 0;
1031
1032
1033
1034
1035
1037 {
1041 if (
len > 0 && tmpstr[
len-1] !=
'\\' && tmpstr[
len-1] !=
':') {
1044 }
1045 }
1046 else
1047 *tmpstr = 0;
1049 *tmpstr = 0;
1051 WARN(
"Couldn't read initial directory %s!\n",
debugstr_w(tmpstr));
1052 }
1053
1054 {
1056 char str[4] =
"a:\\";
1058 for(
i = 0,
n = -1;
i < 26;
i++)
1059 {
1063 }
1064 }
1073}
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
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)
#define DRIVE_NO_ROOT_DIR
Referenced by FD31_FileOpenDlgProc().
◆ FD31_WMMeasureItem()
Definition at line 1083 of file filedlg31.c.
1084{
1086
1090}
static int FD31_GetFldrHeight(void)
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
Referenced by FD31_FileOpenDlgProc().
◆ GetFileName31A()
Definition at line 1145 of file filedlg31.c.
1146{
1149
1151
1154 if (lfs)
1155 {
1159 }
1160
1162 return bRet;
1163}
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 1170 of file filedlg31.c.
1171{
1174
1176
1178 if (lfs)
1179 {
1183 }
1184
1185 TRACE(
"file %s, file offset %d, ext offset %d\n",
1187 return bRet;
1188}
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 |
| ) |
|
◆ fldrHeight
◆ fldrWidth
◆ hCDRom
◆ hFloppy
◆ hFolder
◆ hFolder2
◆ hHDisk
◆ hNet