#include #include #include #include #include #include "..\..\lib\i386\bootfont.h" #include "fonttable.h" int __cdecl main( IN int argc, IN char *argv[] ) { HANDLE hFile; DWORD BytesWritten; BOOL b; BOOTFONTBIN_HEADER Header; unsigned u; unsigned char SBCSBuffer[MAX_SBCS_BYTES+2]; unsigned char DBCSBuffer[MAX_DBCS_BYTES+2]; if(argc != 2) { fprintf(stderr,"Usage: %s \n",argv[0]); return(1); } // // Fill in the header. // Header.Signature = BOOTFONTBIN_SIGNATURE; Header.LanguageId = LANGUAGE_ID; Header.NumSbcsChars = MAX_SBCS_NUM; Header.NumDbcsChars = MAX_DBCS_NUM; // Add 2 bytes for each entry for our unicode appendage Header.SbcsEntriesTotalSize = (MAX_SBCS_BYTES + 2) * MAX_SBCS_NUM; Header.DbcsEntriesTotalSize = (MAX_DBCS_BYTES + 2) * MAX_DBCS_NUM; ZeroMemory(Header.DbcsLeadTable,sizeof(Header.DbcsLeadTable)); MoveMemory(Header.DbcsLeadTable,LeadByteTable,sizeof(LeadByteTable)); Header.CharacterImageHeight = 16; Header.CharacterTopPad = 1; Header.CharacterBottomPad = 2; Header.CharacterImageSbcsWidth = 8; Header.CharacterImageDbcsWidth = 16; Header.SbcsOffset = sizeof(BOOTFONTBIN_HEADER); Header.DbcsOffset = Header.SbcsOffset + Header.SbcsEntriesTotalSize; // // Create the output file. // hFile = CreateFile( argv[1], FILE_GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL ); if(hFile == INVALID_HANDLE_VALUE) { printf("Unable to create output file (%u)\n",GetLastError()); return(1); } // // Write the header. // b = WriteFile(hFile,&Header,sizeof(BOOTFONTBIN_HEADER),&BytesWritten,NULL); if(!b) { printf("Error writing output file (%u)\n",GetLastError()); CloseHandle(hFile); return(1); } // // We're about to convert SBCS and DBCS characters into // unicode, so we need to figure out what to set our // locale to, so that mbtowc will work correctly. // if( _tsetlocale(LC_ALL, LocaleString) == NULL ) { printf( "_tsetlocale failed!\n" ); return(0); } // // Write the sbcs images. // for(u=0; u