/[mldonkey]/mldonkey/src/config/mingw/os_stubs_c.c
ViewVC logotype

Diff of /mldonkey/src/config/mingw/os_stubs_c.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by spiralvoice, Thu Sep 8 12:44:53 2005 UTC revision 1.13 by spiralvoice, Sun Oct 9 15:53:36 2005 UTC
# Line 11  Line 11 
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();
# Line 41  extern ssize_t os_read(OS_FD fd, char *b Line 37  extern ssize_t os_read(OS_FD fd, char *b
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    
# Line 97  int64 os_getfilesize(char *path) Line 93  int64 os_getfilesize(char *path)
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);
# Line 155  void os_uname(char buf[]) Line 152  void os_uname(char buf[])
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.
# Line 257  void os_uname(char buf[]) Line 255  void os_uname(char buf[])
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;
# Line 274  void os_uname(char buf[]) Line 271  void os_uname(char buf[])
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);

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26