I am browsing the filesystem with my app and it gets to a folder named in Chinese '政治清明' findnextfile returns '????' and it fails.... how do I fix this?
???? are wildcard characters but:
a) findfirstfile returns INVALID_HANDLE_VALUE when I pass the folder name ie c:\????\* wildcards so I cant view folder contents
b) This is not very usefull if I want the folder name
forgive me for not reading the entire code, have you tried FindFirstFileW ?
ok findfirstfileW will work....
OK simpler question then.... How do I pass a unicode string? Currently I'm calling the function with chr$("c:\path\*")
EDIT: OK found it.... \masm32\macros\umacros.asm :lol who would have thought that's what the other macros file I hadnt used yet was for
Doh! This isnt as easy as I expected.... I have used WSTR to create a string 'c:\*'
Printed it in a MessageBoxW to make sure it works (and it does)
Then fed it to FindFirstFileW function which *of course* errors and curses at me....
.data
WSTR DriveX, "c:\*"
.code
invoke MessageBoxW,0,ADDR DriveX,ADDR DriveX,MB_OK
LOCAL wfd:WIN32_FIND_DATA
invoke FindFirstFileW,ADDR DriveX,ADDR wfd
If you are using the unicode apis, then make sure you are using the unicode structures where appropriate:
Requirements
Minimum supported client Windows 2000 Professional
Minimum supported server Windows 2000 Server
Header WinBase.h (include Windows.h)
Unicode and ANSI names WIN32_FIND_DATAW (Unicode) and WIN32_FIND_DATAA (ANSI)
Nice 1 ty, just did this in between posts and came back to find out if I was cheating :lol
WIN32_FIND_DATA2 STRUCT
dwFileAttributes DWORD ?
ftCreationTime FILETIME <>
ftLastAccessTime FILETIME <>
ftLastWriteTime FILETIME <>
nFileSizeHigh DWORD ?
nFileSizeLow DWORD ?
dwReserved0 DWORD ?
dwReserved1 DWORD ?
cFileName BYTE MAX_PATH*2 dup(?) <------
cAlternate BYTE 14 dup(?)
WIN32_FIND_DATA2 ENDS
Will use WIN32_FIND_DATAW instead
As one might expect these unicode symbols are all foreign to me :lol
@Hutch: WIN32_FIND_DATAW doesnt appear to be in windows.inc
I'm guessing it is:
WIN32_FIND_DATAW STRUCT
dwFileAttributes DWORD ?
ftCreationTime FILETIME <>
ftLastAccessTime FILETIME <>
ftLastWriteTime FILETIME <>
nFileSizeHigh DWORD ?
nFileSizeLow DWORD ?
dwReserved0 DWORD ?
dwReserved1 DWORD ?
cFileName WORD MAX_PATH dup(?)
cAlternate BYTE 14 dup(?) <---- Not sure what happens here?
WIN32_FIND_DATAW ENDS
Cant find the structure on the M$ website
http://www.masm32.com/board/index.php?topic=12654.msg99153#msg99153
this is from the header files:
typedef struct _WIN32_FIND_DATAA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
CHAR cFileName[ MAX_PATH ];
CHAR cAlternateFileName[ 14 ];
#ifdef _MAC
DWORD dwFileType;
DWORD dwCreatorType;
WORD wFinderFlags;
#endif
} WIN32_FIND_DATAA, *PWIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
typedef struct _WIN32_FIND_DATAW {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
WCHAR cFileName[ MAX_PATH ];
WCHAR cAlternateFileName[ 14 ];
Awesome ty :)