11 |
#include <signals.h> |
#include <signals.h> |
12 |
#endif |
#endif |
13 |
|
|
|
#ifndef INVALID_SET_FILE_POINTER |
|
|
#define INVALID_SET_FILE_POINTER (-1) |
|
|
#endif |
|
|
|
|
14 |
#define UNIX_BUFFER_SIZE 16384 |
#define UNIX_BUFFER_SIZE 16384 |
15 |
|
|
16 |
extern void enter_blocking_section(); |
extern void enter_blocking_section(); |
37 |
|
|
38 |
void os_ftruncate(OS_FD fd, OFF_T size, /* bool */ int sparse) |
void os_ftruncate(OS_FD fd, OFF_T size, /* bool */ int sparse) |
39 |
{ |
{ |
40 |
uint curpos; |
DWORD curpos; |
41 |
long ofs_low = (long) size; |
long ofs_low = (long) size; |
42 |
long ofs_high = (long) (size >> 32); |
long ofs_high = (long) (size >> 32); |
43 |
|
|
93 |
win32_maperr(err); |
win32_maperr(err); |
94 |
uerror("os_getfilesize", Nothing); |
uerror("os_getfilesize", Nothing); |
95 |
} |
} |
96 |
|
return 0; |
97 |
} |
} |
98 |
} |
} |
99 |
|
|
100 |
OFF_T os_lseek(OS_FD fd, OFF_T ofs, int cmd) |
OFF_T os_lseek(OS_FD fd, OFF_T ofs, int cmd) |
101 |
{ |
{ |
102 |
long ret; |
DWORD ret; |
103 |
long ofs_low = ofs; |
long ofs_low = ofs; |
104 |
long ofs_high = (long) (ofs >> 32); |
long ofs_high = (long) (ofs >> 32); |
105 |
long err; |
long err; |
106 |
|
|
107 |
ret = SetFilePointer(fd, ofs_low, &ofs_high, cmd); |
ret = SetFilePointer(fd, ofs_low, &ofs_high, cmd); |
108 |
if (ret == INVALID_SET_FILE_POINTER) { |
if ((unsigned long)ret == INVALID_SET_FILE_POINTER) { |
109 |
err = GetLastError(); |
err = GetLastError(); |
110 |
if (err != NO_ERROR) { |
if (err != NO_ERROR) { |
111 |
win32_maperr(err); |
win32_maperr(err); |
152 |
{ |
{ |
153 |
OSVERSIONINFOEX osvi; |
OSVERSIONINFOEX osvi; |
154 |
BOOL bOsVersionInfoEx; |
BOOL bOsVersionInfoEx; |
155 |
|
char binull='\0'; |
156 |
|
|
157 |
// Try calling GetVersionEx using the OSVERSIONINFOEX structure. |
// Try calling GetVersionEx using the OSVERSIONINFOEX structure. |
158 |
// If that fails, try using the OSVERSIONINFO structure. |
// If that fails, try using the OSVERSIONINFO structure. |
255 |
strcat(buf, "Server \0" ); |
strcat(buf, "Server \0" ); |
256 |
if ( lstrcmpi( "SERVERNT", szProductType) == 0 ) |
if ( lstrcmpi( "SERVERNT", szProductType) == 0 ) |
257 |
strcat(buf, "Advanced Server \0" ); |
strcat(buf, "Advanced Server \0" ); |
258 |
printf( "%d.%d ", osvi.dwMajorVersion, osvi.dwMinorVersion ); |
printf( "%d.%d", (int)osvi.dwMajorVersion, (int)osvi.dwMinorVersion ); |
259 |
} |
} |
260 |
|
|
261 |
// Display service pack (if any) and build number. |
// Display service pack (if any) and build number. |
262 |
char tbuf[4096]; |
char tbuf[4096]; |
263 |
if( osvi.dwMajorVersion == 4 && |
if( osvi.dwMajorVersion == 4 && lstrcmpi( osvi.szCSDVersion, "Service Pack 6" ) == 0 ) |
|
lstrcmpi( osvi.szCSDVersion, "Service Pack 6" ) == 0 ) |
|
264 |
{ |
{ |
265 |
HKEY hKey; |
HKEY hKey; |
266 |
LONG lRet; |
LONG lRet; |
271 |
0, KEY_QUERY_VALUE, &hKey ); |
0, KEY_QUERY_VALUE, &hKey ); |
272 |
if( lRet == ERROR_SUCCESS ) |
if( lRet == ERROR_SUCCESS ) |
273 |
|
|
274 |
sprintf(tbuf, "Service Pack 6a (Build %d)\0", osvi.dwBuildNumber & 0xFFFF ); |
sprintf(tbuf, "Service Pack 6a (Build %lu)%c", osvi.dwBuildNumber & 0xFFFF, binull ); |
275 |
else // Windows NT 4.0 prior to SP6a |
else // Windows NT 4.0 prior to SP6a |
276 |
{ |
{ |
277 |
sprintf(tbuf, "%s (Build %d)\0", |
sprintf(tbuf, "%s (Build %lu)%c",osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF, binull); |
|
osvi.szCSDVersion, |
|
|
osvi.dwBuildNumber & 0xFFFF); |
|
278 |
} |
} |
279 |
RegCloseKey( hKey ); |
RegCloseKey( hKey ); |
280 |
} |
} |
281 |
else // not Windows NT 4.0 |
else // not Windows NT 4.0 |
282 |
{ |
{ |
283 |
sprintf(tbuf, "%s (Build %d)\0", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); |
sprintf(tbuf, "%s (Build %lu)%c", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF, binull); |
284 |
} |
} |
285 |
|
|
286 |
strcat(buf, tbuf); |
strcat(buf, tbuf); |