Changeset 21531 for trunk/tools


Ignore:
Timestamp:
Dec 23, 2010, 4:02:20 AM (15 years ago)
Author:
dmik
Message:

regapi.exe: Made it work with REGEDIT4 files generated by regedit2.exe on OS/2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/regedit/regapi.c

    r7933 r21531  
    1010#include <stdio.h>
    1111#include <stdlib.h>
     12#include <ctype.h>
     13
    1214#include <windows.h>
    1315#include <winreg.h>
     
    2830
    2931   if(ret) {
    30         *ret = (char)0;
    31         ret++;
    32         (*string) = ret;
     32    *ret = (char)0;
     33    ret++;
     34    (*string) = ret;
    3335        ret1 = strchr(ret, *token);
    3436        if(ret1) *ret1 = 0;
     
    3638   return ret;
    3739}
     40
     41typedef HRESULT (* __stdcall lpfnDLLRegProc)(void);
    3842#endif
    3943
     
    4145 * Defines and consts
    4246 */
    43 #define IDENTICAL             0 
     47#define IDENTICAL             0
    4448#define COMMAND_COUNT         7
    4549
    46 #define KEY_MAX_LEN           1024 
     50#define KEY_MAX_LEN           1024
    4751#define STDIN_MAX_LEN         2048
    4852
     
    6569
    6670/* Delimiters used to parse the "value"="data" pair for setValue*/
    67 #define SET_VALUE_MAX_ARGS    2 
     71#define SET_VALUE_MAX_ARGS    2
    6872/* Delimiters used to parse the "value" to query queryValue*/
    69 #define QUERY_VALUE_MAX_ARGS  1 
     73#define QUERY_VALUE_MAX_ARGS  1
    7074
    7175static const char *setValueDelim[SET_VALUE_MAX_ARGS]   = {"=", ""};
     
    7377
    7478
    75 /* 
    76  * Forward declaration 
     79/*
     80 * Forward declaration
    7781 */
    7882typedef void (*commandAPI)(LPSTR lpsLine);
     
    9094 */
    9195static const char* commandNames[COMMAND_COUNT] = {
    92   "setValue", 
    93   "deleteValue", 
     96  "setValue",
     97  "deleteValue",
    9498  "createKey",
    9599  "deleteKey",
     
    103107 */
    104108static const commandAPI commandAPIs[COMMAND_COUNT] = {
    105   doSetValue, 
    106   doDeleteValue, 
     109  doSetValue,
     110  doDeleteValue,
    107111  doCreateKey,
    108112  doDeleteKey,
     
    112116};
    113117
    114 /* 
    115  * This array controls the registry saving needs at the end of the process 
     118/*
     119 * This array controls the registry saving needs at the end of the process
    116120 */
    117121static const BOOL commandSaveRegistry[COMMAND_COUNT] = {
     
    125129};
    126130
    127 /* 
     131/*
    128132 * Generic prototypes
    129133 */
     
    138142static LPSTR   convertHexToDWORDStr( BYTE *buf, ULONG len);
    139143static HRESULT openKey(LPSTR stdInput);
    140 static void    closeKey();
    141 
    142 /* 
     144static void    closeKey(void);
     145
     146/*
    143147 * api setValue prototypes
    144148 */
     
    146150static HRESULT setValue(LPSTR *argv);
    147151
    148 /* 
     152/*
    149153 * api queryValue prototypes
    150154 */
     
    217221
    218222/******************************************************************************
    219  * This function returns the HKEY associated with the data type encoded in the 
    220  * value.  It modifies the input parameter (key value) in order to skip this 
     223 * This function returns the HKEY associated with the data type encoded in the
     224 * value.  It modifies the input parameter (key value) in order to skip this
    221225 * "now useless" data type information.
    222226 *
     
    268272
    269273/******************************************************************************
    270  * Extracts from a [HKEY\some\key\path] type of line the key name (what starts 
     274 * Extracts from a [HKEY\some\key\path] type of line the key name (what starts
    271275 * after the first '\' and end before the ']'
    272276 */
    273 LPSTR getRegKeyName(LPSTR lpLine) 
     277LPSTR getRegKeyName(LPSTR lpLine)
    274278{
    275279  LPSTR keyNameBeg = NULL;
     
    286290  keyNameEnd  = strstr(lpLineCopy, "]");   /* The key name end by ']' */
    287291  *keyNameEnd = '\0';                      /* Isolate the key name */
    288  
     292
    289293  currentKeyName = HeapAlloc(GetProcessHeap(), 0, strlen(keyNameBeg)+1);
    290294  if (currentKeyName != NULL)
    291295    strcpy(currentKeyName, keyNameBeg);
    292  
     296
    293297  return currentKeyName;
    294298}
    295299
    296300/******************************************************************************
    297  * Extracts from a [HKEY/some/key/path] type of line the key class (what 
     301 * Extracts from a [HKEY/some/key/path] type of line the key class (what
    298302 * starts after the '[' and ends before the first '\'
    299303 */
    300 static HKEY getRegClass(LPSTR lpClass) 
     304static HKEY getRegClass(LPSTR lpClass)
    301305{
    302306  LPSTR classNameEnd;
     
    304308
    305309  char  lpClassCopy[KEY_MAX_LEN];
    306  
     310
    307311  if (lpClass == NULL)
    308312    return (HKEY)ERROR_INVALID_PARAMETER;
     
    313317  *classNameEnd = '\0';                       /* Isolate the class name */
    314318  classNameBeg  = &lpClassCopy[1];            /* Skip the '[' */
    315  
     319
    316320  if      (strcmp( classNameBeg, "HKEY_LOCAL_MACHINE") == IDENTICAL )
    317321    return  HKEY_LOCAL_MACHINE;
     
    355359
    356360/******************************************************************************
    357  * Returns an allocated buffer with a cleaned copy (removed the surrounding 
     361 * Returns an allocated buffer with a cleaned copy (removed the surrounding
    358362 * dbl quotes) of the passed value.
    359363 */
     
    369373   * Get rid of surrounding quotes
    370374   */
    371   len = strlen(arg); 
     375  len = strlen(arg);
    372376
    373377  if( arg[len-1] == '\"' ) arg[len-1] = '\0';
     
    387391  INT count;
    388392  for (count=0; count < COMMAND_COUNT; count++)
    389     if ( strcmp(commandName, commandNames[count]) == IDENTICAL) 
     393    if ( strcmp(commandName, commandNames[count]) == IDENTICAL)
    390394      return count;
    391395
     
    409413
    410414/******************************************************************************
    411  * Converts a hex buffer into a hex comma separated values 
     415 * Converts a hex buffer into a hex comma separated values
    412416 */
    413417static char* convertHexToHexCSV(BYTE *buf, ULONG bufLen)
     
    432436    strcat(str, res);
    433437    strcat(str, ",");
    434   }                                   
     438  }
    435439
    436440  /* Get rid of the last comma */
     
    491495    strPos+=3;
    492496    byteCount++;
    493   }                                   
     497  }
    494498
    495499  return byteCount;
     
    498502
    499503/******************************************************************************
    500  * Sets the value in argv[0] to the data in argv[1] for the currently 
     504 * Sets the value in argv[0] to the data in argv[1] for the currently
    501505 * opened key.
    502506 */
     
    519523  lpsCurrentValue=HeapAlloc(GetProcessHeap(), 0,KEY_MAX_LEN);
    520524  /*
    521    * Default registry values are encoded in the input stream as '@' but as 
     525   * Default registry values are encoded in the input stream as '@' but as
    522526   * blank in the wine registry.
    523527   */
     
    530534  memset(lpsCurrentValue, 0, KEY_MAX_LEN);
    531535  hRes = RegQueryValueExA(
    532           currentKeyHandle, 
    533           keyValue, 
    534           NULL, 
    535           &dwType, 
    536           (LPBYTE)lpsCurrentValue, 
     536          currentKeyHandle,
     537          keyValue,
     538          NULL,
     539          &dwType,
     540          (LPBYTE)lpsCurrentValue,
    537541          &dwSize);
    538542
     
    544548
    545549  if( ( strlen(lpsCurrentValue) == 0 ) ||  /* The value is not existing */
    546       ( bForce ))         /* -force option */ 
    547   { 
     550      ( bForce ))         /* -force option */
     551  {
    548552    LPBYTE lpbData;
    549553    BYTE   convert[KEY_MAX_LEN];
     
    553557    {
    554558      dwLen   = strlen(keyData);
    555       if (dwLen>0 && keyData[dwLen-1]=='"')
     559      lpbData = keyData;
     560      if (dwLen>0)
    556561      {
    557         dwLen--;
    558         keyData[dwLen]='\0';
     562          if (keyData[dwLen-1]=='"')
     563          {
     564              dwLen--;
     565              keyData[dwLen]='\0';
     566          }
     567          if (keyData[0]=='"')
     568          {
     569              dwLen--;
     570              lpbData++;
     571          }
    559572      }
    560       lpbData = keyData;
    561     }
     573    }
    562574    else if (dwParseType == REG_DWORD)  /* Convert the dword types */
    563575    {
     
    572584
    573585    hRes = RegSetValueEx(
    574             currentKeyHandle, 
     586            currentKeyHandle,
    575587            keyValue,
    576588            0,                  /* Reserved */
     
    606618static HRESULT openKey( LPSTR stdInput)
    607619{
    608   DWORD   dwDisp; 
     620  DWORD   dwDisp;
    609621  HRESULT hRes;
    610622
    611623  /* Sanity checks */
    612   if (stdInput == NULL) 
     624  if (stdInput == NULL)
    613625    return ERROR_INVALID_PARAMETER;
    614626
     
    622634  if (currentKeyName == NULL)
    623635    return ERROR_INVALID_PARAMETER;
    624    
    625   hRes = RegCreateKeyEx( 
     636
     637  hRes = RegCreateKeyEx(
    626638          currentKeyClass,          /* Class     */
    627639          currentKeyName,           /* Sub Key   */
     
    642654}
    643655/******************************************************************************
    644  * This function is a wrapper for the setValue function.  It prepares the 
     656 * This function is a wrapper for the setValue function.  It prepares the
    645657 * land and clean the area once completed.
    646658 */
     
    660672    argv[counter]=NULL;
    661673
    662   while( (token = getToken(&cmdline, setValueDelim[argCounter])) != NULL ) 
     674  while( (token = getToken(&cmdline, setValueDelim[argCounter])) != NULL )
    663675  {
    664676    argv[argCounter++] = token;
     
    669681
    670682  hRes = setValue(argv);
    671   if ( hRes == ERROR_SUCCESS ) 
     683  if ( hRes == ERROR_SUCCESS )
    672684    printf(
    673       "regapi: Value \"%s\" has been set to \"%s\" in key [%s]\n", 
    674       argv[0], 
     685      "regapi: Value \"%s\" has been set to \"%s\" in key [%s]\n",
     686      argv[0],
    675687      argv[1],
    676688      currentKeyName);
    677689
    678   else if ( hRes == KEY_VALUE_ALREADY_SET ) 
     690  else if ( hRes == KEY_VALUE_ALREADY_SET )
    679691    printf(
    680       "regapi: Value \"%s\" already set to \"%s\" in key [%s]\n", 
    681       argv[0], 
    682       argv[1], 
     692      "regapi: Value \"%s\" already set to \"%s\" in key [%s]\n",
     693      argv[0],
     694      argv[1],
    683695      currentKeyName);
    684696
     
    686698    printf("regapi: ERROR Key %s not created. Value: %s, Data: %s\n",
    687699      currentKeyName,
    688       argv[0], 
     700      argv[0],
    689701      argv[1]);
    690702}
    691703
    692704/******************************************************************************
    693  * This function is a wrapper for the queryValue function.  It prepares the 
     705 * This function is a wrapper for the queryValue function.  It prepares the
    694706 * land and clean the area once completed.
    695707 */
     
    710722    argv[counter]=NULL;
    711723
    712   while( (token = getToken(&cmdline, queryValueDelim[argCounter])) != NULL ) 
     724  while( (token = getToken(&cmdline, queryValueDelim[argCounter])) != NULL )
    713725  {
    714726    argv[argCounter++] = getArg(token);
     
    722734    return; /* SHOULD NOT HAPPEN */
    723735  else
    724     keyValue = argv[0]; 
    725 
    726   if( (keyValue[0] == '@') && (strlen(keyValue) == 1) ) 
     736    keyValue = argv[0];
     737
     738  if( (keyValue[0] == '@') && (strlen(keyValue) == 1) )
    727739  {
    728740    LONG  lLen  = KEY_MAX_LEN;
    729741    CHAR*  lpsData=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,KEY_MAX_LEN);
    730     /* 
     742    /*
    731743     * We need to query the key default value
    732744     */
    733745    hRes = RegQueryValue(
    734              currentKeyHandle, 
    735              currentKeyName, 
     746             currentKeyHandle,
     747             currentKeyName,
    736748             (LPBYTE)lpsData,
    737749             &lLen);
     
    749761    }
    750762  }
    751   else 
     763  else
    752764  {
    753765    DWORD  dwLen  = KEY_MAX_LEN;
    754766    BYTE*  lpbData=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,KEY_MAX_LEN);
    755767    DWORD  dwType;
    756     /* 
     768    /*
    757769     * We need to query a specific value for the key
    758770     */
    759771    hRes = RegQueryValueEx(
    760              currentKeyHandle, 
    761              keyValue, 
    762              0, 
    763              &dwType, 
    764              (LPBYTE)lpbData, 
     772             currentKeyHandle,
     773             keyValue,
     774             0,
     775             &dwType,
     776             (LPBYTE)lpbData,
    765777             &dwLen);
    766778
     
    772784    if (hRes == ERROR_SUCCESS)
    773785    {
    774       /* 
     786      /*
    775787       * Convert the returned data to a displayable format
    776788       */
     
    795807          break;
    796808        }
    797       } 
     809      }
    798810    }
    799811
    800812    HeapFree(GetProcessHeap(), 0, lpbData);
    801813  }
    802  
    803  
    804   if ( hRes == ERROR_SUCCESS ) 
     814
     815
     816  if ( hRes == ERROR_SUCCESS )
    805817    printf(
    806       "regapi: Value \"%s\" = \"%s\" in key [%s]\n", 
    807       keyValue, 
     818      "regapi: Value \"%s\" = \"%s\" in key [%s]\n",
     819      keyValue,
    808820      lpsRes,
    809821      currentKeyName);
     
    811823  else
    812824    printf("regapi: ERROR Value \"%s\" not found. for key \"%s\"\n",
    813       keyValue, 
     825      keyValue,
    814826      currentKeyName);
    815    
     827
    816828  /*
    817829   * Do some cleanup
     
    829841 * Close the currently opened key.
    830842 */
    831 static void closeKey()
    832 {
    833   RegCloseKey(currentKeyHandle); 
     843static void closeKey(void)
     844{
     845  RegCloseKey(currentKeyHandle);
    834846
    835847  HeapFree(GetProcessHeap(), 0, currentKeyName); /* Allocated by getKeyName */
     
    843855
    844856/******************************************************************************
    845  * This funtion is the main entry point to the setValue type of action.  It 
    846  * receives the currently read line and dispatch the work depending on the 
     857 * This funtion is the main entry point to the setValue type of action.  It
     858 * receives the currently read line and dispatch the work depending on the
    847859 * context.
    848860 */
    849861static void doSetValue(LPSTR stdInput)
    850862{
    851   /* 
    852    * We encoutered the end of the file, make sure we 
     863  /*
     864   * We encoutered the end of the file, make sure we
    853865   * close the opened key and exit
    854    */ 
    855   if (stdInput == NULL)             
    856   {
    857     if (bTheKeyIsOpen != FALSE) 
    858       closeKey();                   
     866   */
     867  if (stdInput == NULL)
     868  {
     869    if (bTheKeyIsOpen != FALSE)
     870      closeKey();
    859871
    860872    return;
    861873  }
    862    
     874
    863875  if      ( stdInput[0] == '[')      /* We are reading a new key */
    864876  {
    865     if ( bTheKeyIsOpen != FALSE )     
     877    if ( bTheKeyIsOpen != FALSE )
    866878      closeKey();                    /* Close the previous key before */
    867879
     
    869881      printf ("regapi: doSetValue failed to open key %s\n", stdInput);
    870882  }
    871   else if( ( bTheKeyIsOpen ) &&
     883  else if( ( bTheKeyIsOpen ) &&
     884           (( stdInput[0] == '@') || /* reading a default @=data pair */
     885            ( stdInput[0] == '\"') ||
     886            ( isalpha(stdInput[0])))) /* reading a new value=data pair */
     887  {
     888    processSetValue(stdInput);
     889  }
     890  else                               /* since we are assuming that the */
     891  {                                  /* file format is valid we must   */
     892    if ( bTheKeyIsOpen )             /* be reading a blank line which  */
     893      closeKey();                    /* indicate end of this key processing */
     894  }
     895}
     896
     897/******************************************************************************
     898 * This funtion is the main entry point to the queryValue type of action.  It
     899 * receives the currently read line and dispatch the work depending on the
     900 * context.
     901 */
     902static void doQueryValue(LPSTR stdInput) {
     903  /*
     904   * We encoutered the end of the file, make sure we
     905   * close the opened key and exit
     906   */
     907  if (stdInput == NULL)
     908  {
     909    if (bTheKeyIsOpen != FALSE)
     910      closeKey();
     911
     912    return;
     913  }
     914
     915  if      ( stdInput[0] == '[')      /* We are reading a new key */
     916  {
     917    if ( bTheKeyIsOpen != FALSE )
     918      closeKey();                    /* Close the previous key before */
     919
     920    if ( openKey(stdInput) != ERROR_SUCCESS )
     921      printf ("regapi: doSetValue failed to open key %s\n", stdInput);
     922  }
     923  else if( ( bTheKeyIsOpen ) &&
    872924           (( stdInput[0] == '@') || /* reading a default @=data pair */
    873925            ( stdInput[0] == '\"'))) /* reading a new value=data pair */
    874926  {
    875     processSetValue(stdInput);
     927    processQueryValue(stdInput);
    876928  }
    877929  else                               /* since we are assuming that the */
    878   {                                  /* file format is valid we must   */ 
     930  {                                  /* file format is valid we must   */
    879931    if ( bTheKeyIsOpen )             /* be reading a blank line which  */
    880       closeKey();                    /* indicate end of this key processing */ 
    881   }
    882 }
    883 
    884 /******************************************************************************
    885  * This funtion is the main entry point to the queryValue type of action.  It
    886  * receives the currently read line and dispatch the work depending on the 
     932      closeKey();                    /* indicate end of this key processing */
     933  }
     934}
     935
     936/******************************************************************************
     937 * This funtion is the main entry point to the deletetValue type of action.  It
     938 * receives the currently read line and dispatch the work depending on the
    887939 * context.
    888940 */
    889 static void doQueryValue(LPSTR stdInput) {
    890   /*
    891    * We encoutered the end of the file, make sure we
    892    * close the opened key and exit
    893    */
    894   if (stdInput == NULL)             
    895   {
    896     if (bTheKeyIsOpen != FALSE)
    897       closeKey();                   
    898 
    899     return;
    900   }
    901    
    902   if      ( stdInput[0] == '[')      /* We are reading a new key */
    903   {
    904     if ( bTheKeyIsOpen != FALSE )     
    905       closeKey();                    /* Close the previous key before */
    906 
    907     if ( openKey(stdInput) != ERROR_SUCCESS )
    908       printf ("regapi: doSetValue failed to open key %s\n", stdInput);
    909   }
    910   else if( ( bTheKeyIsOpen ) &&
    911            (( stdInput[0] == '@') || /* reading a default @=data pair */
    912             ( stdInput[0] == '\"'))) /* reading a new value=data pair */
    913   {
    914     processQueryValue(stdInput);
    915   }
    916   else                               /* since we are assuming that the */
    917   {                                  /* file format is valid we must   */
    918     if ( bTheKeyIsOpen )             /* be reading a blank line which  */
    919       closeKey();                    /* indicate end of this key processing */
    920   }
    921 }
    922 
    923 /******************************************************************************
    924  * This funtion is the main entry point to the deletetValue type of action.  It
    925  * receives the currently read line and dispatch the work depending on the
     941static void doDeleteValue(LPSTR line) {
     942  printf ("regapi: deleteValue not yet implemented\n");
     943}
     944/******************************************************************************
     945 * This funtion is the main entry point to the deleteKey type of action.  It
     946 * receives the currently read line and dispatch the work depending on the
    926947 * context.
    927948 */
    928 static void doDeleteValue(LPSTR line) {
    929   printf ("regapi: deleteValue not yet implemented\n");
    930 }
    931 /******************************************************************************
    932  * This funtion is the main entry point to the deleteKey type of action.  It
    933  * receives the currently read line and dispatch the work depending on the 
     949static void doDeleteKey(LPSTR line)   {
     950  printf ("regapi: deleteKey not yet implemented\n");
     951}
     952/******************************************************************************
     953 * This funtion is the main entry point to the createKey type of action.  It
     954 * receives the currently read line and dispatch the work depending on the
    934955 * context.
    935956 */
    936 static void doDeleteKey(LPSTR line)   {
    937   printf ("regapi: deleteKey not yet implemented\n");
    938 }
    939 /******************************************************************************
    940  * This funtion is the main entry point to the createKey type of action.  It
    941  * receives the currently read line and dispatch the work depending on the
    942  * context.
    943  */
    944 static void doCreateKey(LPSTR line)   {
     957static void doCreateKey(LPSTR line)   {
    945958  printf ("regapi: createKey not yet implemented\n");
    946959}
    947960
    948961/******************************************************************************
    949  * This funtion is the main entry point to the registerDLL action.  It 
     962 * This funtion is the main entry point to the registerDLL action.  It
    950963 * receives the currently read line, then loads and registers the requested DLLs
    951964 */
    952 static void doRegisterDLL(LPSTR stdInput) { 
     965static void doRegisterDLL(LPSTR stdInput) {
    953966  HMODULE theLib = 0;
    954967  UINT retVal = 0;
    955968
    956969  /* Check for valid input */
    957   if (stdInput == NULL)             
     970  if (stdInput == NULL)
    958971    return;
    959972
     
    964977    FARPROC lpfnDLLRegProc = GetProcAddress(theLib, "DllRegisterServer");
    965978    if (lpfnDLLRegProc)
    966       retVal = (*lpfnDLLRegProc)();
     979      retVal = lpfnDLLRegProc();
    967980    else
    968981      printf("regapi: Couldn't find DllRegisterServer proc in '%s'.\n", stdInput);
    969982
    970983    if (retVal != S_OK)
    971       printf("regapi: DLLRegisterServer error 0x%x in '%s'.\n", retVal, stdInput);     
     984      printf("regapi: DLLRegisterServer error 0x%x in '%s'.\n", retVal, stdInput);
    972985
    973986    FreeLibrary(theLib);
     
    975988  else
    976989  {
    977     printf("regapi: Could not load DLL '%s'.\n", stdInput); 
    978   }
    979 }
    980 
    981 /******************************************************************************
    982  * This funtion is the main entry point to the unregisterDLL action.  It 
     990    printf("regapi: Could not load DLL '%s'.\n", stdInput);
     991  }
     992}
     993
     994/******************************************************************************
     995 * This funtion is the main entry point to the unregisterDLL action.  It
    983996 * receives the currently read line, then loads and unregisters the requested DLLs
    984997 */
    985 static void doUnregisterDLL(LPSTR stdInput) { 
     998static void doUnregisterDLL(LPSTR stdInput) {
    986999  HMODULE theLib = 0;
    9871000  UINT retVal = 0;
    9881001
    9891002  /* Check for valid input */
    990   if (stdInput == NULL)             
     1003  if (stdInput == NULL)
    9911004    return;
    9921005
     
    9971010    FARPROC lpfnDLLRegProc = GetProcAddress(theLib, "DllUnregisterServer");
    9981011    if (lpfnDLLRegProc)
    999       retVal = (*lpfnDLLRegProc)();
     1012      retVal = lpfnDLLRegProc();
    10001013    else
    10011014      printf("regapi: Couldn't find DllUnregisterServer proc in '%s'.\n", stdInput);
    10021015
    10031016    if (retVal != S_OK)
    1004       printf("regapi: DLLUnregisterServer error 0x%x in '%s'.\n", retVal, stdInput);     
     1017      printf("regapi: DLLUnregisterServer error 0x%x in '%s'.\n", retVal, stdInput);
    10051018
    10061019    FreeLibrary(theLib);
     
    10081021  else
    10091022  {
    1010     printf("regapi: Could not load DLL '%s'.\n", stdInput); 
     1023    printf("regapi: Could not load DLL '%s'.\n", stdInput);
    10111024  }
    10121025}
     
    10251038  ULONG  currentSize    = STDIN_MAX_LEN;
    10261039
    1027   stdInput = HeapAlloc(GetProcessHeap(), 0, STDIN_MAX_LEN); 
     1040  stdInput = HeapAlloc(GetProcessHeap(), 0, STDIN_MAX_LEN);
    10281041  nextLine = HeapAlloc(GetProcessHeap(), 0, STDIN_MAX_LEN);
    10291042
     
    10331046  /*
    10341047   * get the command, should be the first arg (modify cmdLine)
    1035    */ 
     1048   */
    10361049#ifdef __WIN32OS2__
    10371050  token = "setValue";
    10381051#else
    1039   token = getToken(&cmdline, " "); 
     1052  token = getToken(&cmdline, " ");
    10401053#endif
    1041   if (token != NULL) 
     1054  if (token != NULL)
    10421055  {
    10431056    cmdIndex = getCommand(token);
     
    10481061      return COMMAND_NOT_SUPPORTED;
    10491062    }
    1050   }   
     1063  }
    10511064  else
    10521065  {
     
    10571070  }
    10581071
    1059   /* 
    1060    * check to see wether we force the action 
     1072  /*
     1073   * check to see wether we force the action
    10611074   * (meaning differs depending on the command performed)
    10621075   */
     
    10691082  while ( TRUE )
    10701083  {
    1071     /* 
     1084    /*
    10721085     * read a line
    10731086     */
    10741087      ULONG curSize=STDIN_MAX_LEN;
    10751088      char* s=NULL;
    1076    
     1089
    10771090      while((NULL!=(stdInput=fgets(stdInput,curSize,stdin))) && (NULL==(s=strchr(stdInput,'\n'))) ){
    10781091          fseek(stdin,-curSize,SEEK_CUR+1);
    10791092          stdInput=HeapReAlloc(GetProcessHeap(), 0,stdInput,curSize+=STDIN_MAX_LEN);
    10801093      }
    1081     /* 
    1082      * Make some handy generic stuff here... 
     1094    /*
     1095     * Make some handy generic stuff here...
    10831096     */
    10841097    if ( stdInput != NULL )
     
    11081121    }
    11091122
    1110     /* 
    1111      * We process every lines even the NULL (last) line, to indicate the 
     1123    /*
     1124     * We process every lines even the NULL (last) line, to indicate the
    11121125     * end of the processing to the specific process.
    11131126     */
    1114     commandAPIs[cmdIndex](stdInput);       
     1127    commandAPIs[cmdIndex](stdInput);
    11151128
    11161129    if (stdInput == NULL)  /* EOF encountered */
     
    11181131  }
    11191132
    1120 #if 0 
    1121   /* 
    1122    * Save the registry only if it was modified 
     1133#if 0
     1134  /*
     1135   * Save the registry only if it was modified
    11231136   */
    11241137 if ( commandSaveRegistry[cmdIndex] != FALSE )
Note: See TracChangeset for help on using the changeset viewer.