2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis, Sven Verdoolaege, and Cameron Heide
10 #ifdef HAVE_SYS_ERRNO_H
11 #include <sys/errno.h>
15 #include <sys/types.h>
17 #ifdef HAVE_SYS_MMAN_H
28 #include "debugtools.h"
30 DEFAULT_DEBUG_CHANNEL(file
);
32 /***********************************************************************
33 * ReadFileEx (KERNEL32.)
35 BOOL WINAPI
ReadFileEx(HFILE hFile
, LPVOID lpBuffer
, DWORD numtoread
,
36 LPOVERLAPPED lpOverlapped
,
37 LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
)
40 FIXME("file %d to buf %p num %ld %p func %p stub\n",
41 hFile
, lpBuffer
, numtoread
, lpOverlapped
, lpCompletionRoutine
);
42 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
46 /**************************************************************************
47 * SetFileAttributes16 (KERNEL.421)
49 BOOL16 WINAPI
SetFileAttributes16( LPCSTR lpFileName
, DWORD attributes
)
51 return SetFileAttributesA( lpFileName
, attributes
);
55 /**************************************************************************
56 * SetFileAttributesA (KERNEL32.490)
58 BOOL WINAPI
SetFileAttributesA(LPCSTR lpFileName
, DWORD attributes
)
61 DOS_FULL_NAME full_name
;
63 if (!DOSFS_GetFullName( lpFileName
, TRUE
, &full_name
))
66 TRACE("(%s,%lx)\n",lpFileName
,attributes
);
67 if (attributes
& FILE_ATTRIBUTE_NORMAL
) {
68 attributes
&= ~FILE_ATTRIBUTE_NORMAL
;
70 FIXME("(%s):%lx illegal combination with FILE_ATTRIBUTE_NORMAL.\n",
71 lpFileName
,attributes
);
73 if(stat(full_name
.long_name
,&buf
)==-1)
78 if (attributes
& FILE_ATTRIBUTE_READONLY
)
80 if(S_ISDIR(buf
.st_mode
))
82 WARN("FILE_ATTRIBUTE_READONLY ignored for directory.\n");
84 buf
.st_mode
&= ~0222; /* octal!, clear write permission bits */
85 attributes
&= ~FILE_ATTRIBUTE_READONLY
;
89 /* add write permission */
90 buf
.st_mode
|= 0600 | ((buf
.st_mode
& 044) >> 1);
92 if (attributes
& FILE_ATTRIBUTE_DIRECTORY
)
94 if (!S_ISDIR(buf
.st_mode
))
95 FIXME("SetFileAttributes expected the file '%s' to be a directory",
97 attributes
&= ~FILE_ATTRIBUTE_DIRECTORY
;
99 attributes
&= ~(FILE_ATTRIBUTE_ARCHIVE
|FILE_ATTRIBUTE_HIDDEN
|FILE_ATTRIBUTE_SYSTEM
);
101 FIXME("(%s):%lx attribute(s) not implemented.\n",
102 lpFileName
,attributes
);
103 if (-1==chmod(full_name
.long_name
,buf
.st_mode
))
106 MESSAGE("Wine ERROR: Couldn't set file attributes for existing file \"%s\". Check permissions !\n", full_name
.long_name
);
113 /**************************************************************************
114 * SetFileAttributesW (KERNEL32.491)
116 BOOL WINAPI
SetFileAttributesW(LPCWSTR lpFileName
, DWORD attributes
)
118 LPSTR afn
= HEAP_strdupWtoA( GetProcessHeap(), 0, lpFileName
);
119 BOOL res
= SetFileAttributesA( afn
, attributes
);
120 HeapFree( GetProcessHeap(), 0, afn
);
125 /**************************************************************************
126 * SetFileApisToOEM (KERNEL32.645)
128 VOID WINAPI
SetFileApisToOEM(void)
130 /*FIXME(file,"(): stub!\n");*/
134 /**************************************************************************
135 * SetFileApisToANSI (KERNEL32.644)
137 VOID WINAPI
SetFileApisToANSI(void)
139 /*FIXME(file,"(): stub\n");*/
143 /******************************************************************************
144 * AreFileApisANSI [KERNEL32.105] Determines if file functions are using ANSI
147 * TRUE: Set of file functions is using ANSI code page
148 * FALSE: Set of file functions is using OEM code page
150 BOOL WINAPI
AreFileApisANSI(void)
152 FIXME("(void): stub\n");