- Timestamp:
- Nov 29, 2000, 5:36:27 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/utils/Win32kCC.c
r4702 r4707 1 /* $Id: Win32kCC.c,v 1. 4 2000-11-26 13:36:51bird Exp $1 /* $Id: Win32kCC.c,v 1.5 2000-11-29 04:36:27 bird Exp $ 2 2 * 3 3 * Win32CC - Win32k Control Center. … … 44 44 #include <stdarg.h> 45 45 #include <stdlib.h> 46 #include <errno.h> 46 47 47 48 #include <Win32k.h> … … 333 334 char * pszConfigSys = "A:\\Config.sys"; 334 335 char szArgs[120]; 336 int cchArgs; 335 337 336 338 if (!WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)TRUE, NULL)) … … 364 366 sprintf(szArgs + strlen(szArgs), " -ResHeapMax:%d", pThis->NewOptions.cbResHeapMax); /* FIXME - to be changed */ 365 367 strcat(szArgs, "\n"); 368 cchArgs = strlen(szArgs); 366 369 367 370 /* 368 371 * Update Config.sys. 369 372 */ 370 *pszConfigSys += ulBootDrv - 1;373 *pszConfigSys = ulBootDrv - 1 + 'A'; 371 374 phConfigSys = fopen(pszConfigSys, "r+"); 372 375 if (phConfigSys) … … 380 383 char * pszConfigSys; 381 384 382 cbConfigSys += 1024; 383 pszConfigSys = (char*)calloc(1, cbConfigSys); 385 pszConfigSys = (char*)calloc(1, 2 * (cbConfigSys + 256)); /* Paranoia... */ 384 386 if (pszConfigSys) 385 387 { … … 395 397 pszWin32k = stristr(pszCurrent, "win32k.sys"); 396 398 if (pszWin32k) 397 strcpy(pszWin32k + 10, szArgs); 399 { 400 int cch; 401 pszWin32k += 10; /* skip "win32k.sys" */ 402 cch = strlen(pszWin32k); 403 strcpy(pszWin32k, szArgs); 404 if (cchArgs < cch) 405 { /* fix which stops us from shrinking the file.. */ 406 memset(pszWin32k + cchArgs - 1, ' ', cch - cchArgs); 407 pszWin32k[cch - 1] = '\n'; 408 pszWin32k[cch] = '\0'; 409 } 410 } 398 411 399 412 /* next */ 400 413 pszCurrent += strlen(pszCurrent); 401 414 } 402 403 /* Write it back */ 415 if (pszCurrent[-1] != '\n') 416 *pszCurrent++ = '\n'; 417 418 /* Write it back 419 * One big question, how do we shrink a file? 420 */ 404 421 if ( fseek(phConfigSys, 0, SEEK_SET) == 0 405 422 && fwrite(pszConfigSys, 1, pszCurrent - pszConfigSys, phConfigSys)) … … 409 426 else 410 427 Complain(hwnd, IDS_FWRITE_FAILED, pszConfigSys); 428 free(pszConfigSys); 411 429 } 412 430 else
Note:
See TracChangeset
for help on using the changeset viewer.