Ignore:
Timestamp:
Jul 16, 2003, 12:51:10 PM (22 years ago)
Author:
sandervl
Message:

YD: check if program files registry entry already exists and verify it's valid

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/install/odininst.cpp

    r9645 r10169  
    1 /* $Id: odininst.cpp,v 1.13 2003-01-07 20:01:47 sandervl Exp $ */
     1/* $Id: odininst.cpp,v 1.14 2003-07-16 10:51:10 sandervl Exp $ */
    22/*
    33 * Odin WarpIn installation app
     
    3434 */
    3535#include <os2win.h>
     36#include <io.h>
    3637#include <string.h>
    3738#include <stdio.h>
     
    592593    goto initreg_error;
    593594   }
    594    //Create x:\Program Files directory
    595    strcpy(shellpath, InternalGetWindowsDirectory());
    596    shellpath[2] = 0;    //get drive
    597    strcat(shellpath, "\\Program Files");
    598    CreateDirectory(shellpath, NULL);
    599    RegSetValueEx(hkey, DIR_PROGRAM, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    600 
    601    //Create x:\Program Files\Common Files directory
    602    strcat(shellpath, "\\Common Files");
    603    CreateDirectory(shellpath, NULL);
    604    RegSetValueEx(hkey, DIR_PROGRAM_COMMON, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     595   //Check if DIR_PROGRAM already created
     596   val = sizeof(shellpath);
     597   if (RegQueryValueEx(hkey, DIR_PROGRAM, 0, NULL, (LPBYTE)shellpath, &val) != ERROR_SUCCESS
     598       || GetFileAttributes( shellpath) == -1) {
     599      //Create x:\Program Files directory
     600      strcpy(shellpath, InternalGetWindowsDirectory());
     601      shellpath[2] = 0;    //get drive
     602      strcat(shellpath, "\\Program Files");
     603      CreateDirectory(shellpath, NULL);
     604      RegSetValueEx(hkey, DIR_PROGRAM, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     605
     606      //Create x:\Program Files\Common Files directory
     607      strcat(shellpath, "\\Common Files");
     608      CreateDirectory(shellpath, NULL);
     609      RegSetValueEx(hkey, DIR_PROGRAM_COMMON, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     610   }
    605611
    606612   strcpy(shellpath, InternalGetWindowsDirectory());
Note: See TracChangeset for help on using the changeset viewer.