Changeset 4707 for trunk/src


Ignore:
Timestamp:
Nov 29, 2000, 5:36:27 AM (25 years ago)
Author:
bird
Message:

Corrected two problems.

1) Bootdriveletter jumped for each save.
2) Shrinking of config.sys due to parameters removed.

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:51 bird Exp $
     1/* $Id: Win32kCC.c,v 1.5 2000-11-29 04:36:27 bird Exp $
    22 *
    33 * Win32CC - Win32k Control Center.
     
    4444#include <stdarg.h>
    4545#include <stdlib.h>
     46#include <errno.h>
    4647
    4748#include <Win32k.h>
     
    333334                    char *  pszConfigSys = "A:\\Config.sys";
    334335                    char    szArgs[120];
     336                    int     cchArgs;
    335337
    336338                    if (!WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)TRUE, NULL))
     
    364366                        sprintf(szArgs + strlen(szArgs), " -ResHeapMax:%d", pThis->NewOptions.cbResHeapMax); /* FIXME - to be changed */
    365367                    strcat(szArgs, "\n");
     368                    cchArgs = strlen(szArgs);
    366369
    367370                    /*
    368371                     * Update Config.sys.
    369372                     */
    370                     *pszConfigSys += ulBootDrv - 1;
     373                    *pszConfigSys = ulBootDrv - 1 + 'A';
    371374                    phConfigSys = fopen(pszConfigSys, "r+");
    372375                    if (phConfigSys)
     
    380383                            char *  pszConfigSys;
    381384
    382                             cbConfigSys += 1024;
    383                             pszConfigSys = (char*)calloc(1, cbConfigSys);
     385                            pszConfigSys = (char*)calloc(1, 2 * (cbConfigSys + 256)); /* Paranoia... */
    384386                            if (pszConfigSys)
    385387                            {
     
    395397                                    pszWin32k = stristr(pszCurrent, "win32k.sys");
    396398                                    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                                    }
    398411
    399412                                    /* next */
    400413                                    pszCurrent += strlen(pszCurrent);
    401414                                }
    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                                 */
    404421                                if (    fseek(phConfigSys, 0, SEEK_SET) == 0
    405422                                    &&  fwrite(pszConfigSys, 1, pszCurrent - pszConfigSys, phConfigSys))
     
    409426                                else
    410427                                    Complain(hwnd, IDS_FWRITE_FAILED, pszConfigSys);
     428                                free(pszConfigSys);
    411429                            }
    412430                            else
Note: See TracChangeset for help on using the changeset viewer.