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
76f13deb
Commit
76f13deb
authored
Oct 16, 2003
by
Rolf Kalbermatter
Committed by
Alexandre Julliard
Oct 16, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use INVALID_FILE_ATTRIBUTES to test for failure of
GetFileAttributesA/W and not -1 or 0xFFFFFFFF.
parent
c66b7b00
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
35 additions
and
34 deletions
+35
-34
dir.c
dlls/msvcrt/dir.c
+2
-2
file.c
dlls/msvcrt/file.c
+6
-6
shellord.c
dlls/shell32/shellord.c
+2
-2
shellpath.c
dlls/shell32/shellpath.c
+1
-1
shlfileop.c
dlls/shell32/tests/shlfileop.c
+1
-1
install.c
dlls/version/install.c
+4
-4
int21.c
dlls/winedos/int21.c
+1
-1
mmio.c
dlls/winmm/mmio.c
+1
-1
file.c
files/file.c
+6
-5
registry.c
misc/registry.c
+2
-2
aviinfo.c
programs/avitools/aviinfo.c
+1
-1
aviplay.c
programs/avitools/aviplay.c
+1
-1
directory.c
programs/wcmd/directory.c
+1
-1
source.c
programs/winedbg/source.c
+5
-5
macro.c
programs/winhelp/macro.c
+1
-1
No files found.
dlls/msvcrt/dir.c
View file @
76f13deb
...
...
@@ -900,7 +900,7 @@ void _searchenv(const char* file, const char* env, char *buf)
*
buf
=
'\0'
;
/* Try CWD first */
if
(
GetFileAttributesA
(
file
)
!=
0xFFFFFFFF
)
if
(
GetFileAttributesA
(
file
)
!=
INVALID_FILE_ATTRIBUTES
)
{
GetFullPathNameA
(
file
,
MAX_PATH
,
buf
,
NULL
);
/* Sigh. This error is *always* set, regardless of success */
...
...
@@ -940,7 +940,7 @@ void _searchenv(const char* file, const char* env, char *buf)
strcat
(
curPath
,
file
);
TRACE
(
"Checking for file %s
\n
"
,
curPath
);
if
(
GetFileAttributesA
(
curPath
)
!=
0xFFFFFFFF
)
if
(
GetFileAttributesA
(
curPath
)
!=
INVALID_FILE_ATTRIBUTES
)
{
strcpy
(
buf
,
curPath
);
MSVCRT__set_errno
(
ERROR_FILE_NOT_FOUND
);
...
...
dlls/msvcrt/file.c
View file @
76f13deb
...
...
@@ -279,7 +279,7 @@ int _access(const char *filename, int mode)
TRACE
(
"(%s,%d) %ld
\n
"
,
filename
,
mode
,
attr
);
if
(
!
filename
||
attr
==
0xffffffff
)
if
(
!
filename
||
attr
==
INVALID_FILE_ATTRIBUTES
)
{
MSVCRT__set_errno
(
GetLastError
());
return
-
1
;
...
...
@@ -301,7 +301,7 @@ int _waccess(const MSVCRT_wchar_t *filename, int mode)
TRACE
(
"(%s,%d) %ld
\n
"
,
debugstr_w
(
filename
),
mode
,
attr
);
if
(
!
filename
||
attr
==
0xffffffff
)
if
(
!
filename
||
attr
==
INVALID_FILE_ATTRIBUTES
)
{
MSVCRT__set_errno
(
GetLastError
());
return
-
1
;
...
...
@@ -321,7 +321,7 @@ int _chmod(const char *path, int flags)
{
DWORD
oldFlags
=
GetFileAttributesA
(
path
);
if
(
oldFlags
!=
0x0FFFFFFFF
)
if
(
oldFlags
!=
INVALID_FILE_ATTRIBUTES
)
{
DWORD
newFlags
=
(
flags
&
_S_IWRITE
)
?
oldFlags
&
~
FILE_ATTRIBUTE_READONLY
:
oldFlags
|
FILE_ATTRIBUTE_READONLY
;
...
...
@@ -340,7 +340,7 @@ int _wchmod(const MSVCRT_wchar_t *path, int flags)
{
DWORD
oldFlags
=
GetFileAttributesW
(
path
);
if
(
oldFlags
!=
0x0FFFFFFFF
)
if
(
oldFlags
!=
INVALID_FILE_ATTRIBUTES
)
{
DWORD
newFlags
=
(
flags
&
_S_IWRITE
)
?
oldFlags
&
~
FILE_ATTRIBUTE_READONLY
:
oldFlags
|
FILE_ATTRIBUTE_READONLY
;
...
...
@@ -873,7 +873,7 @@ char *_mktemp(char *pattern)
pattern
++
;
do
{
if
(
GetFileAttributesA
(
retVal
)
==
0xFFFFFFFF
&&
if
(
GetFileAttributesA
(
retVal
)
==
INVALID_FILE_ATTRIBUTES
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
)
return
retVal
;
*
pattern
=
letter
++
;
...
...
@@ -907,7 +907,7 @@ MSVCRT_wchar_t *_wmktemp(MSVCRT_wchar_t *pattern)
pattern
++
;
do
{
if
(
GetFileAttributesW
(
retVal
)
==
0xFFFFFFFF
&&
if
(
GetFileAttributesW
(
retVal
)
==
INVALID_FILE_ATTRIBUTES
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
)
return
retVal
;
*
pattern
=
letter
++
;
...
...
dlls/shell32/shellord.c
View file @
76f13deb
...
...
@@ -806,7 +806,7 @@ DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
lstrcpyA
(
old_lnk_name
,
link_dir
);
PathAppendA
(
old_lnk_name
,
ptr
);
if
(
!
DeleteFileA
(
old_lnk_name
))
{
if
((
attr
=
GetFileAttributesA
(
old_lnk_name
))
==
-
1
)
{
if
((
attr
=
GetFileAttributesA
(
old_lnk_name
))
==
INVALID_FILE_ATTRIBUTES
)
{
if
((
err
=
GetLastError
())
!=
ERROR_FILE_NOT_FOUND
)
{
ERR
(
"Delete for %s failed, err=%d, attr=%08lx
\n
"
,
old_lnk_name
,
err
,
attr
);
...
...
@@ -835,7 +835,7 @@ DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
PathAppendA
(
new_lnk_filepath
,
new_lnk_name
);
i
=
1
;
olderrormode
=
SetErrorMode
(
SEM_FAILCRITICALERRORS
);
while
(
GetFileAttributesA
(
new_lnk_filepath
)
!=
-
1
)
{
while
(
GetFileAttributesA
(
new_lnk_filepath
)
!=
INVALID_FILE_ATTRIBUTES
)
{
i
++
;
wsprintfA
(
new_lnk_name
,
"%s (%u).lnk"
,
doc_name
,
i
);
lstrcpyA
(
new_lnk_filepath
,
link_dir
);
...
...
dlls/shell32/shellpath.c
View file @
76f13deb
...
...
@@ -446,7 +446,7 @@ BOOL WINAPI IsLFNDriveW(LPCWSTR lpszPath)
if
(
!
GetVolumeInformationW
(
lpszPath
,
NULL
,
0
,
NULL
,
&
fnlen
,
NULL
,
NULL
,
0
))
return
FALSE
;
return
fnlen
>
12
;
return
fnlen
>
12
;
}
/*************************************************************************
...
...
dlls/shell32/tests/shlfileop.c
View file @
76f13deb
...
...
@@ -48,7 +48,7 @@ void createTestFile(CHAR *name)
BOOL
file_exists
(
CHAR
*
name
)
{
return
GetFileAttributesA
(
name
)
!=
0xFFFFFFFF
;
return
GetFileAttributesA
(
name
)
!=
INVALID_FILE_ATTRIBUTES
;
}
/* initializes the tests */
...
...
dlls/version/install.c
View file @
76f13deb
...
...
@@ -382,14 +382,14 @@ DWORD WINAPI VerInstallFileA(
sprintf
(
tmpfn
,
"%s
\\
%s"
,
pdest
,
destfilename
);
tmplast
=
strlen
(
pdest
)
+
1
;
attr
=
GetFileAttributesA
(
tmpfn
);
if
(
attr
!=-
1
)
{
if
(
attr
!=
INVALID_FILE_ATTRIBUTES
)
{
if
(
attr
&
FILE_ATTRIBUTE_READONLY
)
{
LZClose
(
hfsrc
);
return
VIF_WRITEPROT
;
}
/* FIXME: check if file currently in use and return VIF_FILEINUSE */
}
attr
=
-
1
;
attr
=
INVALID_FILE_ATTRIBUTES
;
if
(
flags
&
VIFF_FORCEINSTALL
)
{
if
(
tmpfile
[
0
])
{
sprintf
(
tmpfn
,
"%s
\\
%s"
,
pdest
,
tmpfile
);
...
...
@@ -400,7 +400,7 @@ DWORD WINAPI VerInstallFileA(
*/
}
}
if
(
attr
==
-
1
)
{
if
(
attr
==
INVALID_FILE_ATTRIBUTES
)
{
char
*
s
;
GetTempFileNameA
(
pdest
,
"ver"
,
0
,
tmpfn
);
/* should not fail ... */
...
...
@@ -505,7 +505,7 @@ DWORD WINAPI VerInstallFileA(
char
curfn
[
260
];
sprintf
(
curfn
,
"%s
\\
%s"
,
curdir
,
destfilename
);
if
(
-
1
!=
GetFileAttributesA
(
curfn
))
{
if
(
INVALID_FILE_ATTRIBUTES
!=
GetFileAttributesA
(
curfn
))
{
/* FIXME: check if in use ... if it is, VIF_CANNOTDELETECUR */
if
(
!
DeleteFileA
(
curfn
))
xret
|=
_error2vif
(
GetLastError
())
|
VIF_CANNOTDELETECUR
;
...
...
dlls/winedos/int21.c
View file @
76f13deb
...
...
@@ -1606,7 +1606,7 @@ static BOOL INT21_FileAttributes( CONTEXT86 *context,
MultiByteToWideChar
(
CP_OEMCP
,
0
,
fileA
,
-
1
,
fileW
,
MAX_PATH
);
result
=
GetFileAttributesW
(
fileW
);
if
(
result
==
-
1
)
if
(
result
==
INVALID_FILE_ATTRIBUTES
)
return
FALSE
;
else
{
...
...
dlls/winmm/mmio.c
View file @
76f13deb
...
...
@@ -612,7 +612,7 @@ HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo, DWORD dwOpenFlags,
if
(
GetFullPathNameA
(
szFileName
,
sizeof
(
buffer
),
buffer
,
NULL
)
>=
sizeof
(
buffer
))
return
(
HMMIO16
)
FALSE
;
if
((
dwOpenFlags
&
MMIO_EXIST
)
&&
(
GetFileAttributesA
(
buffer
)
==
-
1
))
if
((
dwOpenFlags
&
MMIO_EXIST
)
&&
(
GetFileAttributesA
(
buffer
)
==
INVALID_FILE_ATTRIBUTES
))
return
(
HMMIO
)
FALSE
;
strcpy
(
szFileName
,
buffer
);
return
(
HMMIO
)
TRUE
;
...
...
files/file.c
View file @
76f13deb
...
...
@@ -855,11 +855,12 @@ DWORD WINAPI GetFileAttributesW( LPCWSTR name )
if
(
name
==
NULL
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
-
1
;
return
INVALID_FILE_ATTRIBUTES
;
}
if
(
!
DOSFS_GetFullName
(
name
,
TRUE
,
&
full_name
)
)
return
-
1
;
if
(
!
FILE_Stat
(
full_name
.
long_name
,
&
info
,
NULL
))
return
-
1
;
return
INVALID_FILE_ATTRIBUTES
;
if
(
!
FILE_Stat
(
full_name
.
long_name
,
&
info
,
NULL
))
return
INVALID_FILE_ATTRIBUTES
;
return
info
.
dwFileAttributes
;
}
...
...
@@ -870,12 +871,12 @@ DWORD WINAPI GetFileAttributesW( LPCWSTR name )
DWORD
WINAPI
GetFileAttributesA
(
LPCSTR
name
)
{
UNICODE_STRING
nameW
;
DWORD
ret
=
(
DWORD
)
-
1
;
DWORD
ret
=
INVALID_FILE_ATTRIBUTES
;
if
(
!
name
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
(
DWORD
)
-
1
;
return
INVALID_FILE_ATTRIBUTES
;
}
if
(
RtlCreateUnicodeStringFromAsciiz
(
&
nameW
,
name
))
...
...
misc/registry.c
View file @
76f13deb
...
...
@@ -1182,14 +1182,14 @@ static int _get_reg_type(const WCHAR* windir)
/* test %windir%/system32/config/system --> winnt */
strcpyW
(
tmp
,
windir
);
strcatW
(
tmp
,
nt_reg_pathW
);
if
(
GetFileAttributesW
(
tmp
)
!=
(
DWORD
)
-
1
)
if
(
GetFileAttributesW
(
tmp
)
!=
INVALID_FILE_ATTRIBUTES
)
ret
=
REG_WINNT
;
else
{
/* test %windir%/system.dat --> win95 */
strcpyW
(
tmp
,
windir
);
strcatW
(
tmp
,
win9x_reg_pathW
);
if
(
GetFileAttributesW
(
tmp
)
!=
(
DWORD
)
-
1
)
if
(
GetFileAttributesW
(
tmp
)
!=
INVALID_FILE_ATTRIBUTES
)
ret
=
REG_WIN95
;
}
...
...
programs/avitools/aviinfo.c
View file @
76f13deb
...
...
@@ -64,7 +64,7 @@ HRESULT (WINAPI *fnAVIStreamInfo)(PAVISTREAM iface,AVISTREAMINFO *afi,LONG size)
#undef XXT
fnAVIFileInit
();
if
(
-
1
==
GetFileAttributes
(
cmdline
)
)
{
if
(
GetFileAttributes
(
cmdline
)
==
INVALID_FILE_ATTRIBUTES
)
{
fprintf
(
stderr
,
"Usage: aviinfo <avifilename>
\n
"
);
exit
(
1
);
}
...
...
programs/avitools/aviplay.c
View file @
76f13deb
...
...
@@ -103,7 +103,7 @@ HRESULT (WINAPI *fnAVIStreamGetFrameClose)(PGETFRAME pg);
fnAVIFileInit
();
if
(
-
1
==
GetFileAttributes
(
cmdline
)
)
{
if
(
GetFileAttributes
(
cmdline
)
==
INVALID_FILE_ATTRIBUTES
)
{
fprintf
(
stderr
,
"Usage: aviplay <avifilename>
\n
"
);
exit
(
1
);
}
...
...
programs/wcmd/directory.c
View file @
76f13deb
...
...
@@ -156,7 +156,7 @@ ULARGE_INTEGER byte_count, file_size;
if
((
strchr
(
search_path
,
'*'
)
==
NULL
)
&&
(
strchr
(
search_path
,
'%'
)
==
NULL
))
{
status
=
GetFileAttributes
(
search_path
);
if
((
status
!=
-
1
)
&&
(
status
&
FILE_ATTRIBUTE_DIRECTORY
))
{
if
((
status
!=
INVALID_FILE_ATTRIBUTES
)
&&
(
status
&
FILE_ATTRIBUTE_DIRECTORY
))
{
if
(
search_path
[
strlen
(
search_path
)
-
1
]
==
'\\'
)
{
strcat
(
search_path
,
"*"
);
}
...
...
programs/winedbg/source.c
View file @
76f13deb
...
...
@@ -183,11 +183,11 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
* Crapola. We need to try and open the file.
*/
status
=
GetFileAttributes
(
sourcefile
);
if
(
status
!=
-
1
)
if
(
status
!=
INVALID_FILE_ATTRIBUTES
)
{
strcpy
(
tmppath
,
sourcefile
);
}
else
if
(
(
status
=
GetFileAttributes
(
basename
))
!=
-
1
)
else
if
(
(
status
=
GetFileAttributes
(
basename
))
!=
INVALID_FILE_ATTRIBUTES
)
{
strcpy
(
tmppath
,
basename
);
}
...
...
@@ -206,7 +206,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
strcat
(
tmppath
,
basename
);
status
=
GetFileAttributes
(
tmppath
);
if
(
status
!=
-
1
)
break
;
if
(
status
!=
INVALID_FILE_ATTRIBUTES
)
break
;
}
if
(
sl
==
NULL
)
...
...
@@ -233,11 +233,11 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
}
else
{
status
=
-
1
;
status
=
INVALID_FILE_ATTRIBUTES
;
strcpy
(
tmppath
,
sourcefile
);
}
if
(
status
==
-
1
)
if
(
status
==
INVALID_FILE_ATTRIBUTES
)
{
/*
* OK, I guess the user doesn't really want to see it
...
...
programs/winhelp/macro.c
View file @
76f13deb
...
...
@@ -506,7 +506,7 @@ void MACRO_ExtInsertMenu(LPCSTR str1, LPCSTR str2, LPCSTR str3, LONG u1, LONG u2
BOOL
MACRO_FileExist
(
LPCSTR
str
)
{
WINE_TRACE
(
"(
\"
%s
\"
)
\n
"
,
str
);
return
GetFileAttributes
(
str
)
!=
0xFFFFFFFF
;
return
GetFileAttributes
(
str
)
!=
INVALID_FILE_ATTRIBUTES
;
}
void
MACRO_FileOpen
(
void
)
...
...
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