Changeset 225 in xtideuniversalbios for trunk/Serial_Server
- Timestamp:
- Jan 27, 2012, 6:19:21 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/Serial_Server
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Serial_Server/library/File.h
r219 r225 18 18 { 19 19 public: 20 voidCreate( char *p_name )20 int Create( char *p_name ) 21 21 { 22 22 fp = fopen( p_name, "r" ); 23 23 24 24 if( fp ) 25 log( -1, "Create Failure: '%s' already exists", p_name ); 25 { 26 log( 0, "'%s' file already exists", p_name ); 27 fclose( fp ); 28 return( 0 ); 29 } 26 30 27 31 if( !(fp = fopen( p_name, "w" )) ) … … 29 33 30 34 name = p_name; 35 36 return( 1 ); 31 37 } 32 38 -
trunk/Serial_Server/library/FlatImage.h
r219 r225 30 30 sizef = size / 2048.0; // 512 byte sectors -> MB 31 31 32 cf.Create( name );33 34 memset( &buff[0], 0, 512 );35 while( size-- )36 cf.Write( &buff[0], 512 );37 38 if( p_cyl > 1024 )39 log( 0, "Created file '%s', size %.1lf MB", name, sizef );40 else41 log( 0, "Created file '%s', geometry %u:%u:%u, size %.1lf MB", name, p_cyl, p_sect, p_head, sizef );42 43 cf.Close();32 if( cf.Create( name ) ) 33 { 34 memset( &buff[0], 0, 512 ); 35 while( size-- ) 36 cf.Write( &buff[0], 512 ); 37 38 if( p_cyl > 1024 ) 39 log( 0, "Created file '%s', size %.1lf MB", name, sizef ); 40 else 41 log( 0, "Created file '%s', geometry %u:%u:%u, size %.1lf MB", name, p_cyl, p_sect, p_head, sizef ); 42 cf.Close(); 43 } 44 44 } 45 45 -
trunk/Serial_Server/win32/Win32.cpp
r219 r225 26 26 "", 27 27 " -g [cyl:head:sect] Geometry in cylinders, sectors per cylinder, and heads", 28 " -g without parameters uses CHSmode (default is LBA28)",28 " -g also implies CHS addressing mode (default is LBA28)", 29 29 "", 30 30 " -n [megabytes] Create new disk with given size or use -g geometry", … … 161 161 else if( imagecount < 2 ) 162 162 { 163 if( createFile && cyl == 0 ) 164 { 165 cyl = 65; 166 sect = 63; 167 head = 16; 168 } 163 169 images[imagecount] = new FlatImage( argv[t], readOnly, imagecount, createFile, cyl, head, sect, useCHS ); 164 170 imagecount++; -
trunk/Serial_Server/win32/Win32File.h
r219 r225 18 18 { 19 19 public: 20 voidCreate( char *p_name )20 int Create( char *p_name ) 21 21 { 22 22 fp = CreateFileA( p_name, GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0 ); 23 if( !fp ) 24 log( -1, "'%s', could not create file", p_name ); 23 24 if( fp == INVALID_HANDLE_VALUE ) 25 { 26 if( GetLastError() == ERROR_FILE_EXISTS ) 27 { 28 log( 0, "'%s', file already exists", p_name ); 29 return( 0 ); 30 } 31 else 32 log( -1, "'%s', could not create file", p_name ); 33 } 34 25 35 name = p_name; 36 37 return( 1 ); 26 38 } 27 39 … … 29 41 { 30 42 fp = CreateFileA( p_name, GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 ); 31 if( !fp ) 43 44 if( fp == INVALID_HANDLE_VALUE ) 32 45 log( -1, "'%s', could not open file", p_name ); 46 33 47 name = p_name; 34 48 } … … 78 92 79 93 if( !ReadFile( fp, buff, len, &out_len, NULL ) || len != out_len ) 80 log( -1, "'%s', ReadFile failed" );94 log( -1, "'%s', ReadFile failed", name ); 81 95 } 82 96 … … 86 100 87 101 if( !WriteFile( fp, buff, len, &out_len, NULL ) || len != out_len ) 88 log( -1, "'%s', WriteFile failed" );102 log( -1, "'%s', WriteFile failed", name ); 89 103 } 90 104 -
trunk/Serial_Server/win32/Win32Serial.h
r219 r225 40 40 41 41 pipe = CreateNamedPipeA( PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE|PIPE_REJECT_REMOTE_CLIENTS, 2, 1024, 1024, 0, NULL ); 42 if( !pipe)42 if( pipe == INVALID_HANDLE_VALUE ) 43 43 log( -1, "Could not CreateNamedPipe " PIPENAME ); 44 44 … … 62 62 63 63 pipe = CreateFileA( name, GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 ); 64 if( !pipe)64 if( pipe == INVALID_HANDLE_VALUE ) 65 65 log( -1, "Could not Open \"%s\"", name ); 66 66
Note:
See TracChangeset
for help on using the changeset viewer.