Ignore:
Timestamp:
Sep 5, 2001, 3:39:12 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/setupapi/setupx_main.c

    r4989 r6649  
     1/* $Id: setupx_main.c,v 1.2 2001-09-05 13:38:23 bird Exp $ */
    12/*
    23 *      SETUPX library
     
    2627 *
    2728 * SETUPX consists of several parts with the following acronyms/prefixes:
    28  * Di   device installer (devinst.c ?)
    29  * Gen  generic installer (geninst.c ?)
    30  * Ip   .INF parsing (infparse.c)
    31  * LDD  logical device descriptor (ldd.c ?)
    32  * LDID logical device ID
     29 * Di   device installer (devinst.c ?)
     30 * Gen  generic installer (geninst.c ?)
     31 * Ip   .INF parsing (infparse.c)
     32 * LDD  logical device descriptor (ldd.c ?)
     33 * LDID logical device ID
    3334 * SU   setup (setup.c ?)
    34  * Tp   text processing (textproc.c ?)
    35  * Vcp  virtual copy module (vcp.c ?)
     35 * Tp   text processing (textproc.c ?)
     36 * Vcp  virtual copy module (vcp.c ?)
    3637 * ...
    3738 *
     
    5556
    5657/***********************************************************************
    57  *              SURegOpenKey
     58 *      SURegOpenKey
    5859 */
    5960DWORD WINAPI SURegOpenKey( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey )
     
    6465
    6566/***********************************************************************
    66  *              SURegQueryValueEx
     67 *      SURegQueryValueEx
    6768 */
    6869DWORD WINAPI SURegQueryValueEx( HKEY hkey, LPSTR lpszValueName,
     
    9495    while (1)
    9596    {
    96         /* find beginning of real substring */
    97         while ( (*p == ' ') || (*p == '\t') || (*p == '"') ) p++;
    98 
    99         /* find end of real substring */
    100         q = p;
    101         while ( (*q)
    102              && (*q != ' ') && (*q != '\t') && (*q != '"')
    103              && (*q != ';') && (*q != delimiter) ) q++;
    104         if (q == p)
    105             break;
    106         len = (int)q - (int)p;
    107 
    108         /* alloc entry for new substring in steps of 32 units and copy over */
    109         if (count % 32 == 0)
    110         { /* 1 for count field + current count + 32 */
    111             res = HeapReAlloc(GetProcessHeap(), 0, res, (1+count+32)*sizeof(LPSTR));
    112         }
    113         *(res+1+count) = HeapAlloc(GetProcessHeap(), 0, len+1);
    114         strncpy(*(res+1+count), p, len);
    115         (*(res+1+count))[len] = '\0';
    116         count++;
    117 
    118         /* we are still within last substring (before delimiter),
    119         * so get out of it */
    120         while ((*q) && (*q != ';') && (*q != delimiter)) q++;
    121         if ((!*q) || (*q == ';'))
    122             break;
    123         p = q+1;
    124     }
    125    
     97    /* find beginning of real substring */
     98    while ( (*p == ' ') || (*p == '\t') || (*p == '"') ) p++;
     99
     100    /* find end of real substring */
     101    q = p;
     102    while ( (*q)
     103         && (*q != ' ') && (*q != '\t') && (*q != '"')
     104         && (*q != ';') && (*q != delimiter) ) q++;
     105    if (q == p)
     106        break;
     107    len = (int)q - (int)p;
     108
     109    /* alloc entry for new substring in steps of 32 units and copy over */
     110    if (count % 32 == 0)
     111    { /* 1 for count field + current count + 32 */
     112        res = HeapReAlloc(GetProcessHeap(), 0, res, (1+count+32)*sizeof(LPSTR));
     113    }
     114    *(res+1+count) = HeapAlloc(GetProcessHeap(), 0, len+1);
     115    strncpy(*(res+1+count), p, len);
     116    (*(res+1+count))[len] = '\0';
     117    count++;
     118
     119    /* we are still within last substring (before delimiter),
     120    * so get out of it */
     121    while ((*q) && (*q != ';') && (*q != delimiter)) q++;
     122    if ((!*q) || (*q == ';'))
     123        break;
     124    p = q+1;
     125    }
     126
    126127    /* put number of entries at beginning of list */
    127128    *(DWORD *)res = count;
     
    136137
    137138    for (n=0; n < count; n++)
    138         HeapFree(GetProcessHeap(), 0, *pStrings++);
     139    HeapFree(GetProcessHeap(), 0, *pStrings++);
    139140
    140141    HeapFree(GetProcessHeap(), 0, substr);
     
    163164 *        Hmm, but on the other hand SETUPX_GetSubStrings() will probably
    164165 *        soon be replaced by InitSubstrData() etc. anyway.
    165  * 
     166 *
    166167 */
    167168static BOOL SETUPX_LookupRegistryString(LPSTR regstr, LPSTR buffer, DWORD buflen)
     
    181182    for (n=0; n < 5; n++)
    182183    {
    183         q = strchr(p, ',');
    184         if (!q)
    185         {
    186             if (n == 4)
    187                 q = p+strlen(p);
    188             else
    189                 return FALSE;
    190         }
    191         next = q+1;
    192         if (q < regstr)
     184    q = strchr(p, ',');
     185    if (!q)
     186    {
     187        if (n == 4)
     188        q = p+strlen(p);
     189        else
     190        return FALSE;
     191    }
     192    next = q+1;
     193    if (q < regstr)
    193194            return FALSE;
    194195        SETUPX_IsolateSubString(&p, &q);
     
    197198        strncpy(items[n], p, len);
    198199        items[n][len] = '\0';
    199         p = next;
     200    p = next;
    200201    }
    201202    TRACE("got '%s','%s','%s','%s','%s'\n",
    202                         items[0], items[1], items[2], items[3], items[4]);
    203    
     203            items[0], items[1], items[2], items[3], items[4]);
     204
    204205    /* check root key */
    205206    if (!strcasecmp(items[0], "HKCR"))
    206         hkey = HKEY_CLASSES_ROOT;
     207    hkey = HKEY_CLASSES_ROOT;
    207208    else
    208209    if (!strcasecmp(items[0], "HKCU"))
    209         hkey = HKEY_CURRENT_USER;
     210    hkey = HKEY_CURRENT_USER;
    210211    else
    211212    if (!strcasecmp(items[0], "HKLM"))
    212         hkey = HKEY_LOCAL_MACHINE;
     213    hkey = HKEY_LOCAL_MACHINE;
    213214    else
    214215    if (!strcasecmp(items[0], "HKU"))
    215         hkey = HKEY_USERS;
     216    hkey = HKEY_USERS;
    216217    else
    217218    { /* HKR ? -> relative to key passed to GenInstallEx */
    218         FIXME("unsupported regkey '%s'\n", items[0]);
     219    FIXME("unsupported regkey '%s'\n", items[0]);
    219220        goto regfailed;
    220221    }
     
    224225
    225226    if (RegQueryValueExA(hsubkey, items[2], NULL, &dwType, buffer, &buflen)
    226                 != ERROR_SUCCESS)
     227        != ERROR_SUCCESS)
    227228        goto regfailed;
    228229    goto done;
     
    234235        HeapFree(heap, 0, items[n]);
    235236    if (buffer)
    236         TRACE("return '%s'\n", buffer);
     237    TRACE("return '%s'\n", buffer);
    237238    return TRUE;
    238239}
     
    244245
    245246    do {
    246         buf = HeapReAlloc(GetProcessHeap(), 0, buf, len);
    247         res = GetPrivateProfileStringA(NULL, NULL, NULL, buf, len, filename);
    248         len *= 2;
     247    buf = HeapReAlloc(GetProcessHeap(), 0, buf, len);
     248    res = GetPrivateProfileStringA(NULL, NULL, NULL, buf, len, filename);
     249    len *= 2;
    249250    } while ((!res) && (len < 1048576));
    250251    if (!res)
    251252    {
    252         HeapFree(GetProcessHeap(), 0, buf);
    253         return NULL;
     253    HeapFree(GetProcessHeap(), 0, buf);
     254    return NULL;
    254255    }
    255256    return buf;
     
    262263
    263264    do {
    264         buf = HeapReAlloc(GetProcessHeap(), 0, buf, len);
    265         res = GetPrivateProfileSectionA(section, buf, len, filename);
    266         len *= 2;
     265    buf = HeapReAlloc(GetProcessHeap(), 0, buf, len);
     266    res = GetPrivateProfileSectionA(section, buf, len, filename);
     267    len *= 2;
    267268    } while ((!res) && (len < 1048576));
    268269    if (!res)
    269270    {
    270         HeapFree(GetProcessHeap(), 0, buf);
    271         return NULL;
     271    HeapFree(GetProcessHeap(), 0, buf);
     272    return NULL;
    272273    }
    273274    return buf;
     
    276277
    277278/***********************************************************************
    278  *              InstallHinfSection
     279 *      InstallHinfSection
    279280 *
    280281 * hwnd = parent window
     
    283284 * Here "DefaultInstall" is the .inf file section to be installed (optional).
    284285 * The 132 value is made of the HOW_xxx flags and sometimes 128 (-> setupx16.h).
    285  * 
     286 *
    286287 * nCmdShow = nCmdShow of CreateProcess
    287288 */
     
    297298    HMODULE hMod;
    298299    MSGBOX_PROC pMessageBoxA;
    299    
     300
    300301    TRACE("(%04x, %04x, %s, %d);\n", hwnd, hinst, lpszCmdLine, nCmdShow);
    301    
     302
    302303    pSub = SETUPX_GetSubStrings((LPSTR)lpszCmdLine, ' ');
    303304
    304305    count = *(DWORD *)pSub;
    305306    if (count < 2) /* invalid number of arguments ? */
    306         goto end;
     307    goto end;
    307308    if (IpOpen16(*(pSub+count), &hInf) != OK)
    308309    {
    309         res = ERROR_FILE_NOT_FOUND; /* yes, correct */
    310         goto end;
     310    res = ERROR_FILE_NOT_FOUND; /* yes, correct */
     311    goto end;
    311312    }
    312313    if (GenInstall16(hInf, *(pSub+count-2), GENINSTALL_DO_ALL) != OK)
    313         goto end;
     314    goto end;
    314315    wFlags = atoi(*(pSub+count-1)) & ~128;
    315316    switch (wFlags)
    316317    {
    317         case HOW_ALWAYS_SILENT_REBOOT:
    318         case HOW_SILENT_REBOOT:
    319             reboot = TRUE;
    320             break;
    321         case HOW_ALWAYS_PROMPT_REBOOT:
    322         case HOW_PROMPT_REBOOT:
    323             if ((hMod = GetModuleHandleA("user32.dll")))
    324             {
    325               if ((pMessageBoxA = (MSGBOX_PROC)GetProcAddress( hMod, "MessageBoxA" )))
    326               {
    327                  
    328                 if (pMessageBoxA(hwnd, "You must restart Wine before the new settings will take effect.\n\nDo you want to exit Wine now ?", "Systems Settings Change", MB_YESNO|MB_ICONQUESTION) == IDYES)
    329                   reboot = TRUE;
    330               }
    331             }
    332             break;
    333         default:
    334             ERR("invalid flags %d !\n", wFlags);
    335             goto end;
    336     }
    337    
     318    case HOW_ALWAYS_SILENT_REBOOT:
     319    case HOW_SILENT_REBOOT:
     320        reboot = TRUE;
     321        break;
     322    case HOW_ALWAYS_PROMPT_REBOOT:
     323    case HOW_PROMPT_REBOOT:
     324        if ((hMod = GetModuleHandleA("user32.dll")))
     325        {
     326          if ((pMessageBoxA = (MSGBOX_PROC)GetProcAddress( hMod, "MessageBoxA" )))
     327          {
     328
     329            if (pMessageBoxA(hwnd, "You must restart Wine before the new settings will take effect.\n\nDo you want to exit Wine now ?", "Systems Settings Change", MB_YESNO|MB_ICONQUESTION) == IDYES)
     330          reboot = TRUE;
     331          }
     332        }
     333        break;
     334    default:
     335        ERR("invalid flags %d !\n", wFlags);
     336        goto end;
     337    }
     338
    338339    res = OK;
    339340end:
     
    342343    if (reboot)
    343344    {
    344         /* FIXME: we should have a means of terminating all wine + wineserver */
    345         MESSAGE("Program or user told me to restart. Exiting Wine...\n");
    346         ExitProcess(1);
     345    /* FIXME: we should have a means of terminating all wine + wineserver */
     346    MESSAGE("Program or user told me to restart. Exiting Wine...\n");
     347    ExitProcess(1);
    347348    }
    348349
     
    359360{
    360361    { /* 0 (LDID_NULL) -- not defined */
    361         NULL,
    362         NULL
     362    NULL,
     363    NULL
    363364    },
    364365    { /* 1 (LDID_SRCPATH) = source of installation. hmm, what to do here ? */
    365         "SourcePath", /* hmm, does SETUPX have to care about updating it ?? */
    366         NULL
     366    "SourcePath", /* hmm, does SETUPX have to care about updating it ?? */
     367    NULL
    367368    },
    368369    { /* 2 (LDID_SETUPTEMP) = setup temp dir */
    369         "SetupTempDir",
    370         NULL
     370    "SetupTempDir",
     371    NULL
    371372    },
    372373    { /* 3 (LDID_UNINSTALL) = uninstall backup dir */
    373         "UninstallDir",
    374         NULL
     374    "UninstallDir",
     375    NULL
    375376    },
    376377    { /* 4 (LDID_BACKUP) = backup dir */
    377         "BackupDir",
    378         NULL
     378    "BackupDir",
     379    NULL
    379380    },
    380381    { /* 5 (LDID_SETUPSCRATCH) = setup scratch dir */
    381         "SetupScratchDir",
    382         NULL
     382    "SetupScratchDir",
     383    NULL
    383384    },
    384385    { /* 6 -- not defined */
    385         NULL,
    386         NULL
     386    NULL,
     387    NULL
    387388    },
    388389    { /* 7 -- not defined */
    389         NULL,
    390         NULL
     390    NULL,
     391    NULL
    391392    },
    392393    { /* 8 -- not defined */
    393         NULL,
    394         NULL
     394    NULL,
     395    NULL
    395396    },
    396397    { /* 9 -- not defined */
    397         NULL,
    398         NULL
     398    NULL,
     399    NULL
    399400    },
    400401    { /* 10 (LDID_WIN) = windows dir */
    401         "WinDir",
     402    "WinDir",
    402403        ""
    403404    },
    404405    { /* 11 (LDID_SYS) = system dir */
    405         "SysDir",
    406         NULL /* call GetSystemDirectory() instead */
     406    "SysDir",
     407    NULL /* call GetSystemDirectory() instead */
    407408    },
    408409    { /* 12 (LDID_IOS) = IOSubSys dir */
    409410        NULL, /* FIXME: registry string ? */
    410         "SYSTEM\\IOSUBSYS"
     411    "SYSTEM\\IOSUBSYS"
    411412    },
    412413    { /* 13 (LDID_CMD) = COMMAND dir */
    413         NULL, /* FIXME: registry string ? */
    414         "COMMAND"
     414    NULL, /* FIXME: registry string ? */
     415    "COMMAND"
    415416    },
    416417    { /* 14 (LDID_CPL) = control panel dir */
    417         NULL,
    418         ""
     418    NULL,
     419    ""
    419420    },
    420421    { /* 15 (LDID_PRINT) = windows printer dir */
    421         NULL,
    422         "SYSTEM" /* correct ?? */
     422    NULL,
     423    "SYSTEM" /* correct ?? */
    423424    },
    424425    { /* 16 (LDID_MAIL) = destination mail dir */
    425         NULL,
    426         ""
     426    NULL,
     427    ""
    427428    },
    428429    { /* 17 (LDID_INF) = INF dir */
    429         "SetupScratchDir", /* correct ? */
    430         "INF"
     430    "SetupScratchDir", /* correct ? */
     431    "INF"
    431432    },
    432433    { /* 18 (LDID_HELP) = HELP dir */
    433         NULL, /* ??? */
    434         "HELP"
     434    NULL, /* ??? */
     435    "HELP"
    435436    },
    436437    { /* 19 (LDID_WINADMIN) = Admin dir */
    437         "WinAdminDir",
    438         ""
     438    "WinAdminDir",
     439    ""
    439440    },
    440441    { /* 20 (LDID_FONTS) = Fonts dir */
    441         NULL, /* ??? */
    442         "FONTS"
     442    NULL, /* ??? */
     443    "FONTS"
    443444    },
    444445    { /* 21 (LDID_VIEWERS) = Viewers */
    445         NULL, /* ??? */
    446         "SYSTEM\\VIEWERS"
     446    NULL, /* ??? */
     447    "SYSTEM\\VIEWERS"
    447448    },
    448449    { /* 22 (LDID_VMM32) = VMM32 dir */
    449         NULL, /* ??? */
    450         "SYSTEM\\VMM32"
     450    NULL, /* ??? */
     451    "SYSTEM\\VMM32"
    451452    },
    452453    { /* 23 (LDID_COLOR) = ICM dir */
    453         "ICMPath",
    454         "SYSTEM\\COLOR"
     454    "ICMPath",
     455    "SYSTEM\\COLOR"
    455456    },
    456457    { /* 24 (LDID_APPS) = root of boot drive ? */
    457         "AppsDir",
    458         "C:\\"
     458    "AppsDir",
     459    "C:\\"
    459460    },
    460461    { /* 25 (LDID_SHARED) = shared dir */
    461         "SharedDir",
    462         ""
     462    "SharedDir",
     463    ""
    463464    },
    464465    { /* 26 (LDID_WINBOOT) = Windows boot dir */
    465         "WinBootDir",
    466         ""
     466    "WinBootDir",
     467    ""
    467468    },
    468469    { /* 27 (LDID_MACHINE) = machine specific files */
    469         "MachineDir",
    470         NULL
     470    "MachineDir",
     471    NULL
    471472    },
    472473    { /* 28 (LDID_HOST_WINBOOT) = Host Windows boot dir */
    473         "HostWinBootDir",
    474         NULL
     474    "HostWinBootDir",
     475    NULL
    475476    },
    476477    { /* 29 -- not defined */
    477         NULL,
    478         NULL
     478    NULL,
     479    NULL
    479480    },
    480481    { /* 30 (LDID_BOOT) = Root of boot drive */
    481         "BootDir",
    482         NULL
     482    "BootDir",
     483    NULL
    483484    },
    484485    { /* 31 (LDID_BOOT_HOST) = Root of boot drive host */
    485         "BootHost",
    486         NULL
     486    "BootHost",
     487    NULL
    487488    },
    488489    { /* 32 (LDID_OLD_WINBOOT) = subdir of root */
    489         "OldWinBootDir",
    490         NULL
     490    "OldWinBootDir",
     491    NULL
    491492    },
    492493    { /* 33 (LDID_OLD_WIN) = old win dir */
    493         "OldWinDir",
    494         NULL
     494    "OldWinDir",
     495    NULL
    495496    }
    496497    /* the rest (34-38) isn't too interesting, so I'll forget about it */
    497498};
    498499
    499 /* 
     500/*
    500501 * LDD  == Logical Device Descriptor
    501502 * LDID == Logical Device ID
     
    527528    for (n=0; n < sizeof(LDID_Data)/sizeof(LDID_DATA); n++)
    528529    {
    529         buffer[0] = '\0';
    530 
    531         len = MAX_PATH;
    532         if ( (hKey) && (LDID_Data[n].RegValName)
    533         &&   (RegQueryValueExA(hKey, LDID_Data[n].RegValName,
    534                 NULL, &type, buffer, &len) == ERROR_SUCCESS)
    535         &&   (type == REG_SZ) )
    536         {
    537             TRACE("found value '%s' for LDID %d\n", buffer, n);
    538         }
    539         else
     530    buffer[0] = '\0';
     531
     532    len = MAX_PATH;
     533    if ( (hKey) && (LDID_Data[n].RegValName)
     534    &&   (RegQueryValueExA(hKey, LDID_Data[n].RegValName,
     535        NULL, &type, buffer, &len) == ERROR_SUCCESS)
     536    &&   (type == REG_SZ) )
     537    {
     538        TRACE("found value '%s' for LDID %d\n", buffer, n);
     539    }
     540    else
    540541        switch(n)
    541         {
    542             case LDID_SRCPATH:
    543                 FIXME("LDID_SRCPATH: what exactly do we have to do here ?\n");
    544                 strcpy(buffer, "X:\\FIXME");
    545                 break;
    546             case LDID_SYS:
    547                 GetSystemDirectoryA(buffer, MAX_PATH);
    548                 break;
    549             case LDID_APPS:
    550             case LDID_MACHINE:
    551             case LDID_HOST_WINBOOT:
    552             case LDID_BOOT:
    553             case LDID_BOOT_HOST:
    554                 strcpy(buffer, "C:\\");
    555                 break;
    556             default:
    557                 if (LDID_Data[n].StdString)
    558                 {
    559                     DWORD len = GetWindowsDirectoryA(buffer, MAX_PATH);
    560                     LPSTR p;
    561                     p = buffer + len;
    562                     *p++ = '\\';
    563                     strcpy(p, LDID_Data[n].StdString);
    564                 }
    565                 break;
    566         }
    567         if (buffer[0])
    568         {
    569             INIT_LDD(ldd, n);
    570             ldd.pszPath = buffer;
    571             TRACE("LDID %d -> '%s'\n", ldd.ldid, ldd.pszPath);
    572             CtlSetLdd16(&ldd);
    573         }
     542    {
     543        case LDID_SRCPATH:
     544        FIXME("LDID_SRCPATH: what exactly do we have to do here ?\n");
     545        strcpy(buffer, "X:\\FIXME");
     546        break;
     547        case LDID_SYS:
     548            GetSystemDirectoryA(buffer, MAX_PATH);
     549        break;
     550        case LDID_APPS:
     551        case LDID_MACHINE:
     552        case LDID_HOST_WINBOOT:
     553        case LDID_BOOT:
     554        case LDID_BOOT_HOST:
     555        strcpy(buffer, "C:\\");
     556        break;
     557        default:
     558        if (LDID_Data[n].StdString)
     559        {
     560            DWORD len = GetWindowsDirectoryA(buffer, MAX_PATH);
     561            LPSTR p;
     562            p = buffer + len;
     563            *p++ = '\\';
     564            strcpy(p, LDID_Data[n].StdString);
     565        }
     566        break;
     567        }
     568    if (buffer[0])
     569    {
     570        INIT_LDD(ldd, n);
     571        ldd.pszPath = buffer;
     572        TRACE("LDID %d -> '%s'\n", ldd.ldid, ldd.pszPath);
     573        CtlSetLdd16(&ldd);
     574    }
    574575    }
    575576    if (hKey) RegCloseKey(hKey);
    576577}
    577        
    578 /***********************************************************************
    579  * CtlDelLdd            (SETUPX.37)
     578
     579/***********************************************************************
     580 * CtlDelLdd        (SETUPX.37)
    580581 *
    581582 * RETURN
     
    589590
    590591    if (!std_LDDs_done)
    591         SETUPX_CreateStandardLDDs();
     592    SETUPX_CreateStandardLDDs();
    592593
    593594    if (ldid < LDID_ASSIGN_START)
    594         return ERR_VCP_LDDINVALID;
     595    return ERR_VCP_LDDINVALID;
    595596
    596597    pCurr = pFirstLDD;
     
    598599    while ((pCurr != NULL) && (ldid > pCurr->pldd->ldid))
    599600    {
    600         pPrev = pCurr;
    601         pCurr = pCurr->next;
     601    pPrev = pCurr;
     602    pCurr = pCurr->next;
    602603    }
    603604    if ( (pCurr == NULL) /* hit end of list */
    604605      || (ldid != pCurr->pldd->ldid) )
    605         return ERR_VCP_LDDFIND; /* correct ? */
     606    return ERR_VCP_LDDFIND; /* correct ? */
    606607
    607608    /* ok, found our victim: eliminate it */
    608609
    609610    if (pPrev)
    610         pPrev->next = pCurr->next;
     611    pPrev->next = pCurr->next;
    611612
    612613    if (pCurr == pFirstLDD)
    613         pFirstLDD = NULL;
     614    pFirstLDD = NULL;
    614615    HeapFree(GetProcessHeap(), 0, pCurr);
    615    
     616
    616617    return OK;
    617618}
    618619
    619620/***********************************************************************
    620  *              CtlDelLdd (SETUPX.37)
     621 *      CtlDelLdd (SETUPX.37)
    621622 */
    622623RETERR16 WINAPI CtlDelLdd16(LOGDISKID16 ldid)
     
    627628
    628629/***********************************************************************
    629  * CtlFindLdd           (SETUPX.35)
     630 * CtlFindLdd       (SETUPX.35)
    630631 *
    631632 * doesn't check pldd ptr validity: crash (W98SE)
     
    634635 *   ERR_VCP_LDDINVALID if pldd->cbSize != structsize
    635636 *   1 in all other cases ??
    636  * 
     637 *
    637638 */
    638639RETERR16 WINAPI CtlFindLdd16(LPLOGDISKDESC pldd)
     
    641642
    642643    TRACE("(%p)\n", pldd);
    643    
     644
    644645    if (!std_LDDs_done)
    645         SETUPX_CreateStandardLDDs();
     646    SETUPX_CreateStandardLDDs();
    646647
    647648    if (pldd->cbSize != sizeof(LOGDISKDESC_S))
     
    652653    while ((pCurr != NULL) && (pldd->ldid > pCurr->pldd->ldid))
    653654    {
    654         pPrev = pCurr;
    655         pCurr = pCurr->next;
     655    pPrev = pCurr;
     656    pCurr = pCurr->next;
    656657    }
    657658    if ( (pCurr == NULL) /* hit end of list */
    658659      || (pldd->ldid != pCurr->pldd->ldid) )
    659         return ERR_VCP_LDDFIND; /* correct ? */
     660    return ERR_VCP_LDDFIND; /* correct ? */
    660661
    661662    memcpy(pldd, pCurr->pldd, pldd->cbSize);
    662663    /* hmm, we probably ought to strcpy() the string ptrs here */
    663    
     664
    664665    return 1; /* what is this ?? */
    665666}
    666667
    667668/***********************************************************************
    668  * CtlSetLdd                    (SETUPX.33)
     669 * CtlSetLdd            (SETUPX.33)
    669670 *
    670671 * Set an LDD entry.
     
    684685
    685686    if (!std_LDDs_done)
    686         SETUPX_CreateStandardLDDs();
     687    SETUPX_CreateStandardLDDs();
    687688
    688689    if (pldd->cbSize != sizeof(LOGDISKDESC_S))
    689         return ERR_VCP_LDDINVALID;
     690    return ERR_VCP_LDDINVALID;
    690691
    691692    heap = GetProcessHeap();
     
    694695    while ((pCurr != NULL) && (pldd->ldid > pCurr->pldd->ldid))
    695696    {
    696         pPrev = pCurr;
    697         pCurr = pCurr->next;
     697    pPrev = pCurr;
     698    pCurr = pCurr->next;
    698699    }
    699700    if (pCurr == NULL) /* hit end of list */
    700701    {
    701         is_new = TRUE;
     702    is_new = TRUE;
    702703        pCurr = HeapAlloc(heap, 0, sizeof(LDD_LIST));
    703704        pCurr->pldd = HeapAlloc(heap, 0, sizeof(LOGDISKDESC_S));
     
    708709    {
    709710        pCurrLDD = pCurr->pldd;
    710         if (pCurrLDD->pszPath)          HeapFree(heap, 0, pCurrLDD->pszPath);
    711         if (pCurrLDD->pszVolLabel)      HeapFree(heap, 0, pCurrLDD->pszVolLabel);
    712         if (pCurrLDD->pszDiskName)      HeapFree(heap, 0, pCurrLDD->pszDiskName);
     711    if (pCurrLDD->pszPath)      HeapFree(heap, 0, pCurrLDD->pszPath);
     712    if (pCurrLDD->pszVolLabel)  HeapFree(heap, 0, pCurrLDD->pszVolLabel);
     713    if (pCurrLDD->pszDiskName)  HeapFree(heap, 0, pCurrLDD->pszDiskName);
    713714    }
    714715
     
    716717
    717718    if (pldd->pszPath)
    718         pCurrLDD->pszPath       = HEAP_strdupA(heap, 0, pldd->pszPath);
     719        pCurrLDD->pszPath   = HEAP_strdupA(heap, 0, pldd->pszPath);
    719720    if (pldd->pszVolLabel)
    720         pCurrLDD->pszVolLabel   = HEAP_strdupA(heap, 0, pldd->pszVolLabel);
     721    pCurrLDD->pszVolLabel   = HEAP_strdupA(heap, 0, pldd->pszVolLabel);
    721722    if (pldd->pszDiskName)
    722         pCurrLDD->pszDiskName   = HEAP_strdupA(heap, 0, pldd->pszDiskName);
     723    pCurrLDD->pszDiskName   = HEAP_strdupA(heap, 0, pldd->pszDiskName);
    723724
    724725    if (is_new) /* link into list */
    725726    {
    726727        if (pPrev)
    727         {
    728             pCurr->next = pPrev->next;
     728    {
     729        pCurr->next = pPrev->next;
    729730            pPrev->next = pCurr;
    730         }
    731         if (!pFirstLDD)
    732             pFirstLDD = pCurr;
    733     }
    734    
     731    }
     732    if (!pFirstLDD)
     733        pFirstLDD = pCurr;
     734    }
     735
    735736    return OK;
    736737}
     
    738739
    739740/***********************************************************************
    740  * CtlAddLdd            (SETUPX.36)
     741 * CtlAddLdd        (SETUPX.36)
    741742 *
    742743 * doesn't check pldd ptr validity: crash (W98SE)
     
    751752
    752753/***********************************************************************
    753  * CtlGetLdd            (SETUPX.34)
     754 * CtlGetLdd        (SETUPX.34)
    754755 *
    755756 * doesn't check pldd ptr validity: crash (W98SE)
     
    758759 * RETURN
    759760 *   ERR_VCP_LDDINVALID if pldd->cbSize != structsize
    760  * 
     761 *
    761762 */
    762763static RETERR16 SETUPX_GetLdd(LPLOGDISKDESC pldd)
     
    765766
    766767    if (!std_LDDs_done)
    767         SETUPX_CreateStandardLDDs();
     768    SETUPX_CreateStandardLDDs();
    768769
    769770    if (pldd->cbSize != sizeof(LOGDISKDESC_S))
     
    774775    while ((pCurr != NULL) && (pldd->ldid > pCurr->pldd->ldid))
    775776    {
    776         pPrev = pCurr;
    777         pCurr = pCurr->next;
     777    pPrev = pCurr;
     778    pCurr = pCurr->next;
    778779    }
    779780    if (pCurr == NULL) /* hit end of list */
    780         return ERR_VCP_LDDFIND; /* correct ? */
     781    return ERR_VCP_LDDFIND; /* correct ? */
    781782
    782783    memcpy(pldd, pCurr->pldd, pldd->cbSize);
     
    795796
    796797/***********************************************************************
    797  *              CtlGetLddPath           (SETUPX.38)
     798 *      CtlGetLddPath       (SETUPX.38)
    798799 *
    799800 * Gets the path of an LDD.
     
    809810    if (szPath)
    810811    {
    811         LOGDISKDESC_S ldd;
    812         INIT_LDD(ldd, ldid);
    813         if (CtlFindLdd16(&ldd) == ERR_VCP_LDDFIND)
    814             return ERR_VCP_LDDUNINIT;
    815         SETUPX_GetLdd(&ldd);
     812    LOGDISKDESC_S ldd;
     813    INIT_LDD(ldd, ldid);
     814    if (CtlFindLdd16(&ldd) == ERR_VCP_LDDFIND)
     815        return ERR_VCP_LDDUNINIT;
     816    SETUPX_GetLdd(&ldd);
    816817        strcpy(szPath, ldd.pszPath);
    817         TRACE("ret '%s' for LDID %d\n", szPath, ldid);
     818    TRACE("ret '%s' for LDID %d\n", szPath, ldid);
    818819    }
    819820    return OK;
     
    821822
    822823/***********************************************************************
    823  *              CtlSetLddPath           (SETUPX.508)
     824 *      CtlSetLddPath       (SETUPX.508)
    824825 *
    825826 * Sets the path of an LDD.
     
    830831    LOGDISKDESC_S ldd;
    831832    TRACE("(%d, '%s');\n", ldid, szPath);
    832    
     833
    833834    INIT_LDD(ldd, ldid);
    834835    ldd.pszPath = szPath;
     
    847848 * -- registry lookup -->
    848849 * C:\Program Files (or C:\ if not found in registry)
    849  * 
     850 *
    850851 * FIXME:
    851852 * - maybe we ought to add a caching array for speed ? - I don't care :)
     
    853854 *   LDIDs for both install and removal sections.
    854855 * - probably the whole function can be removed as installers add that on their
    855  *   own 
     856 *   own
    856857 */
    857858static BOOL SETUPX_AddCustomLDID(int ldid, INT16 hInf)
     
    869870    if (!(sectionbuf = SETUPX_GetSections(filename)))
    870871    {
    871         ERR("couldn't get sections !\n");
    872         return FALSE;
     872    ERR("couldn't get sections !\n");
     873    return FALSE;
    873874    }
    874875    for (pSec=sectionbuf; *pSec; pSec += strlen(pSec)+1)
    875876    {
    876         if (!(entrybuf = SETUPX_GetSectionEntries(filename, pSec)))
    877         {
    878             ERR("couldn't get section entries !\n");
    879             goto end;
    880         }
    881         for (pEnt=entrybuf; *pEnt; pEnt += strlen(pEnt)+1)
    882         {
    883             if (strstr(pEnt, ldidstr))
    884             {
    885                 pEqual = strchr(pEnt, '=');
    886                 if (!pEqual) /* crippled entry ?? */
    887                     continue;
    888 
    889                 /* make sure we found the LDID on left side of the equation */
    890                 if (pEnt+strlen(ldidstr) <= pEqual)
    891                 { /* found */
    892 
    893                     /* but we don't want entries in the strings section */
    894                     if (!strcasecmp(pSec, "Strings"))
    895                         goto next_section;
    896                     p = pEqual+1;
    897                     goto found;
    898                 }
    899             }
    900         }
     877    if (!(entrybuf = SETUPX_GetSectionEntries(filename, pSec)))
     878    {
     879        ERR("couldn't get section entries !\n");
     880        goto end;
     881    }
     882    for (pEnt=entrybuf; *pEnt; pEnt += strlen(pEnt)+1)
     883    {
     884        if (strstr(pEnt, ldidstr))
     885        {
     886        pEqual = strchr(pEnt, '=');
     887        if (!pEqual) /* crippled entry ?? */
     888            continue;
     889
     890        /* make sure we found the LDID on left side of the equation */
     891        if (pEnt+strlen(ldidstr) <= pEqual)
     892        { /* found */
     893
     894            /* but we don't want entries in the strings section */
     895            if (!strcasecmp(pSec, "Strings"))
     896            goto next_section;
     897            p = pEqual+1;
     898            goto found;
     899        }
     900        }
     901    }
    901902next_section:
    902903    }
     
    907908    if (*(DWORD *)pSub > 2)
    908909    {
    909         ERR("malformed entry '%s' ?\n", p);
    910         goto end;
     910    ERR("malformed entry '%s' ?\n", p);
     911    goto end;
    911912    }
    912913    TRACE("found section '%s'\n", *(pSub+1));
     
    916917    if (!(regsectionbuf = SETUPX_GetSectionEntries(filename, *(pSub+1))))
    917918    {
    918         ERR("couldn't get registry section entries !\n");
    919         goto end;
     919    ERR("couldn't get registry section entries !\n");
     920    goto end;
    920921    }
    921922    /* sectionbuf is > 1024 bytes anyway, so use it */
     
    928929end:
    929930    SETUPX_FreeSubStrings(pSub);
    930     if (sectionbuf)     HeapFree(GetProcessHeap(), 0, sectionbuf);
    931     if (entrybuf)       HeapFree(GetProcessHeap(), 0, entrybuf);
    932     if (regsectionbuf)  HeapFree(GetProcessHeap(), 0, regsectionbuf);
     931    if (sectionbuf) HeapFree(GetProcessHeap(), 0, sectionbuf);
     932    if (entrybuf)   HeapFree(GetProcessHeap(), 0, entrybuf);
     933    if (regsectionbuf)  HeapFree(GetProcessHeap(), 0, regsectionbuf);
    933934    return ret;
    934935}
     
    947948    if (CtlFindLdd16(&ldd) == ERR_VCP_LDDFIND)
    948949    {
    949         /* hmm, it seems the installers already do the work for us
    950         * (by calling CtlSetLddPath) that SETUPX_AddCustomLDID
    951         * is supposed to do. Grmbl ;-)
    952         * Well, I'll leave it here anyway, but print error... */
    953         ERR("hmm, LDID %d not registered yet !?\n", ldid);
    954         handled = SETUPX_AddCustomLDID(ldid, hInf);
     950    /* hmm, it seems the installers already do the work for us
     951    * (by calling CtlSetLddPath) that SETUPX_AddCustomLDID
     952    * is supposed to do. Grmbl ;-)
     953    * Well, I'll leave it here anyway, but print error... */
     954    ERR("hmm, LDID %d not registered yet !?\n", ldid);
     955    handled = SETUPX_AddCustomLDID(ldid, hInf);
    955956    }
    956957    else
    957         handled = TRUE;
    958    
     958    handled = TRUE;
     959
    959960    SETUPX_GetLdd(&ldd);
    960    
     961
    961962    if (!handled)
    962963    {
    963964        FIXME("What is LDID %d ??\n", ldid);
    964         *p = "LDID_FIXME";
     965    *p = "LDID_FIXME";
    965966    }
    966967    else
    967         *p = ldd.pszPath;
     968    *p = ldd.pszPath;
    968969
    969970    return handled;
     
    971972
    972973/***********************************************************************
    973  *              GenFormStrWithoutPlaceHolders
     974 *      GenFormStrWithoutPlaceHolders
    974975 *
    975976 * ought to be pretty much implemented, I guess...
     
    980981    LPSTR pDst = szDst, p, pPHBegin;
    981982    int count;
    982    
     983
    983984    TRACE("(%p, '%s', %04x);\n", szDst, szSrc, hInf);
    984985    while (pSrc < pSrcEnd)
    985986    {
    986         p = strchr(pSrc, '%');
    987         if (p)
    988         {
    989             count = (int)p - (int)pSrc;
    990             strncpy(pDst, pSrc, count);
    991             pSrc += count;
    992             pDst += count;
    993             pPHBegin = p+1;
    994             p = strchr(pPHBegin, '%');
    995             if (p)
    996             {
    997                 char placeholder[80]; /* that really ought to be enough ;) */
    998                 int ldid;
    999                 BOOL done = TRUE;
    1000                 count = (int)p - (int)pPHBegin;
    1001                 strncpy(placeholder, pPHBegin, count);
    1002                 placeholder[count] = '\0';
    1003                 ldid = atoi(placeholder);
    1004                 if (ldid)
    1005                 {
    1006                     LPSTR p;
    1007                     done = SETUPX_IP_TranslateLDID(ldid, &p, hInf);
    1008                     strcpy(pDst, p);
    1009                     if (done)
    1010                         pDst += strlen(pDst);
    1011                 }
    1012                 else
    1013                 { /* hmm, string placeholder. Need to look up
    1014                      in the [strings] section of the hInf */
    1015                     DWORD ret;
    1016                     char buf[256]; /* long enough ? */
    1017                    
    1018                     ret = GetPrivateProfileStringA("strings", placeholder, "",
    1019                                         buf, 256, IP_GetFileName(hInf));
    1020                     if (ret)
    1021                     {
    1022                         strcpy(pDst, buf);
    1023                         pDst += strlen(buf);
    1024                     }
    1025                     else
    1026                     {
    1027                         ERR("placeholder string '%s' not found !\n", placeholder);
    1028                         done = FALSE;
    1029                     }
    1030                 }
    1031                 if (!done)
    1032                 { /* copy raw placeholder string over */
    1033                     count = (int)p - (int)pPHBegin + 2;
    1034                     strncpy(pDst, pPHBegin-1, count);
    1035                     pDst += count;
    1036                    
    1037                 }
    1038                 pSrc = p+1;
    1039                 continue;
    1040             }
    1041         }
    1042 
    1043         /* copy the remaining source string over */
    1044         strncpy(pDst, pSrc, (int)pSrcEnd - (int)pSrc + 1);
    1045         break;
     987    p = strchr(pSrc, '%');
     988    if (p)
     989    {
     990        count = (int)p - (int)pSrc;
     991        strncpy(pDst, pSrc, count);
     992        pSrc += count;
     993        pDst += count;
     994        pPHBegin = p+1;
     995        p = strchr(pPHBegin, '%');
     996        if (p)
     997        {
     998        char placeholder[80]; /* that really ought to be enough ;) */
     999        int ldid;
     1000        BOOL done = TRUE;
     1001        count = (int)p - (int)pPHBegin;
     1002        strncpy(placeholder, pPHBegin, count);
     1003        placeholder[count] = '\0';
     1004        ldid = atoi(placeholder);
     1005        if (ldid)
     1006        {
     1007            LPSTR p;
     1008            done = SETUPX_IP_TranslateLDID(ldid, &p, hInf);
     1009            strcpy(pDst, p);
     1010            if (done)
     1011            pDst += strlen(pDst);
     1012        }
     1013        else
     1014        { /* hmm, string placeholder. Need to look up
     1015             in the [strings] section of the hInf */
     1016            DWORD ret;
     1017            char buf[256]; /* long enough ? */
     1018
     1019            ret = GetPrivateProfileStringA("strings", placeholder, "",
     1020                        buf, 256, IP_GetFileName(hInf));
     1021            if (ret)
     1022            {
     1023            strcpy(pDst, buf);
     1024            pDst += strlen(buf);
     1025            }
     1026            else
     1027            {
     1028                ERR("placeholder string '%s' not found !\n", placeholder);
     1029            done = FALSE;
     1030            }
     1031        }
     1032        if (!done)
     1033        { /* copy raw placeholder string over */
     1034            count = (int)p - (int)pPHBegin + 2;
     1035            strncpy(pDst, pPHBegin-1, count);
     1036            pDst += count;
     1037
     1038        }
     1039        pSrc = p+1;
     1040        continue;
     1041        }
     1042    }
     1043
     1044    /* copy the remaining source string over */
     1045    strncpy(pDst, pSrc, (int)pSrcEnd - (int)pSrc + 1);
     1046    break;
    10461047    }
    10471048    TRACE("ret '%s'\n", szDst);
     
    10491050
    10501051/***********************************************************************
    1051  *              VcpOpen
     1052 *      VcpOpen
    10521053 *
    10531054 * No idea what to do here.
     
    10601061
    10611062/***********************************************************************
    1062  *              VcpClose
     1063 *      VcpClose
    10631064 *
    10641065 * Is fl related to VCPDISKINFO.fl ?
     
    10911092    for (n=0; n < *(DWORD *)pSub; n++)
    10921093    {
    1093         pCopyEntry = *(pSub+1+n);
    1094         if (*pCopyEntry == '@')
    1095         {
    1096             ERR("single file not handled yet !\n");
    1097             continue;
    1098         }
    1099 
    1100         /* get source directory for that entry */
    1101         INIT_LDD(ldd, LDID_SRCPATH);
    1102         SETUPX_GetLdd(&ldd);
    1103         pSrcDir = ldd.pszPath;
    1104        
     1094    pCopyEntry = *(pSub+1+n);
     1095    if (*pCopyEntry == '@')
     1096    {
     1097        ERR("single file not handled yet !\n");
     1098        continue;
     1099    }
     1100
     1101    /* get source directory for that entry */
     1102    INIT_LDD(ldd, LDID_SRCPATH);
     1103    SETUPX_GetLdd(&ldd);
     1104    pSrcDir = ldd.pszPath;
     1105
    11051106        /* get destination directory for that entry */
    1106         if (!(GetPrivateProfileStringA("DestinationDirs", pCopyEntry, "",
    1107                                         pDestStr, sizeof(pDestStr), filename)))
    1108             continue;
    1109 
    1110         /* translate destination dir if given as LDID */
    1111         ldid = atoi(pDestStr);
    1112         if (ldid)
    1113         {
    1114             if (!(SETUPX_IP_TranslateLDID(ldid, &pDstDir, hInf)))
    1115                 continue;
    1116         }
    1117         else
    1118             pDstDir = pDestStr;
    1119        
    1120         /* now that we have the destination dir, iterate over files to copy */
    1121         pFileEntries = SETUPX_GetSectionEntries(filename, pCopyEntry);
     1107    if (!(GetPrivateProfileStringA("DestinationDirs", pCopyEntry, "",
     1108                    pDestStr, sizeof(pDestStr), filename)))
     1109        continue;
     1110
     1111    /* translate destination dir if given as LDID */
     1112    ldid = atoi(pDestStr);
     1113    if (ldid)
     1114    {
     1115        if (!(SETUPX_IP_TranslateLDID(ldid, &pDstDir, hInf)))
     1116        continue;
     1117    }
     1118    else
     1119        pDstDir = pDestStr;
     1120
     1121    /* now that we have the destination dir, iterate over files to copy */
     1122    pFileEntries = SETUPX_GetSectionEntries(filename, pCopyEntry);
    11221123        for (p=pFileEntries; *p; p +=strlen(p)+1)
    1123         {
    1124             pSubFile = SETUPX_GetSubStrings(p, ',');
    1125             pSrcFile = *(pSubFile+1);
    1126             pDstFile = (*(DWORD *)pSubFile > 1) ? *(pSubFile+2) : pSrcFile;
    1127             TRACE("copying file '%s\\%s' to '%s\\%s'\n", pSrcDir, pSrcFile, pDstDir, pDstFile);
    1128             if (*(DWORD *)pSubFile > 2)
    1129             {
    1130                 WORD flag;
    1131                 if ((flag = atoi(*(pSubFile+3)))) /* ah, flag */
    1132                 {
    1133                     if (flag & 0x2c)
    1134                     FIXME("VNLP_xxx flag %d not handled yet.\n", flag);
    1135                 }
    1136                 else
    1137                     FIXME("temp file name '%s' given. Need to register in wininit.ini !\n", *(pSubFile+3)); /* strong guess that this is VcpQueueCopy() */
    1138             }
    1139             SETUPX_FreeSubStrings(pSubFile);
    1140             /* we don't copy ANYTHING yet ! (I'm too lazy and want to verify
    1141              * this first before destroying whole partitions ;-) */
    1142         }
    1143     }
    1144            
     1124    {
     1125        pSubFile = SETUPX_GetSubStrings(p, ',');
     1126        pSrcFile = *(pSubFile+1);
     1127        pDstFile = (*(DWORD *)pSubFile > 1) ? *(pSubFile+2) : pSrcFile;
     1128        TRACE("copying file '%s\\%s' to '%s\\%s'\n", pSrcDir, pSrcFile, pDstDir, pDstFile);
     1129        if (*(DWORD *)pSubFile > 2)
     1130        {
     1131        WORD flag;
     1132        if ((flag = atoi(*(pSubFile+3)))) /* ah, flag */
     1133        {
     1134            if (flag & 0x2c)
     1135            FIXME("VNLP_xxx flag %d not handled yet.\n", flag);
     1136        }
     1137        else
     1138            FIXME("temp file name '%s' given. Need to register in wininit.ini !\n", *(pSubFile+3)); /* strong guess that this is VcpQueueCopy() */
     1139        }
     1140        SETUPX_FreeSubStrings(pSubFile);
     1141        /* we don't copy ANYTHING yet ! (I'm too lazy and want to verify
     1142         * this first before destroying whole partitions ;-) */
     1143    }
     1144    }
     1145
    11451146    return res;
    11461147}
    11471148
    11481149/***********************************************************************
    1149  *              GenInstall
     1150 *      GenInstall
    11501151 *
    11511152 * general install function for .INF file sections
    11521153 *
    11531154 * This is not perfect - patch whenever you can !
    1154  * 
     1155 *
    11551156 * wFlags == GENINSTALL_DO_xxx
    11561157 * e.g. NetMeeting:
     
    11691170    if (!pEntries)
    11701171    {
    1171         ERR("couldn't find entries for section '%s' !\n", szInstallSection);
    1172         return ERR_IP_SECT_NOT_FOUND;
     1172    ERR("couldn't find entries for section '%s' !\n", szInstallSection);
     1173    return ERR_IP_SECT_NOT_FOUND;
    11731174    }
    11741175    for (p=pEntries; *p; p +=strlen(p)+1)
    11751176    {
    1176         pEnd = strchr(p, '=');
    1177         if (!pEnd) continue;
    1178         pSub = SETUPX_GetSubStrings(pEnd+1, ','); /* split entries after the '=' */
    1179         SETUPX_IsolateSubString(&p, &pEnd);
    1180         len = (int)pEnd - (int)p;
    1181 
    1182         if (wFlags & GENINSTALL_DO_FILES)
    1183         {
    1184             if (!strncasecmp(p, "CopyFiles", len))
    1185             {
    1186                 SETUPX_CopyFiles(pSub, hInfFile);
    1187                 continue;
    1188             }
     1177    pEnd = strchr(p, '=');
     1178    if (!pEnd) continue;
     1179    pSub = SETUPX_GetSubStrings(pEnd+1, ','); /* split entries after the '=' */
     1180    SETUPX_IsolateSubString(&p, &pEnd);
     1181    len = (int)pEnd - (int)p;
     1182
     1183    if (wFlags & GENINSTALL_DO_FILES)
     1184    {
     1185        if (!strncasecmp(p, "CopyFiles", len))
     1186        {
     1187            SETUPX_CopyFiles(pSub, hInfFile);
     1188        continue;
     1189        }
    11891190#if IMPLEMENT_THAT
    1190             else
    1191             if (!strncasecmp(p, "DelFiles", len))
    1192             {
    1193                 SETUPX_DelFiles(filename, szInstallSection, pSub);
    1194                 continue;
    1195             }
     1191        else
     1192        if (!strncasecmp(p, "DelFiles", len))
     1193        {
     1194            SETUPX_DelFiles(filename, szInstallSection, pSub);
     1195        continue;
     1196        }
    11961197#endif
    1197         }
    1198         if (wFlags & GENINSTALL_DO_INI)
    1199         {
     1198    }
     1199    if (wFlags & GENINSTALL_DO_INI)
     1200    {
    12001201#if IMPLEMENT_THAT
    1201             if (!strncasecmp(p, "UpdateInis", len))
    1202             {
    1203                 SETUPX_UpdateInis(filename, szInstallSection, pSub);
    1204                 continue;
    1205             }
     1202        if (!strncasecmp(p, "UpdateInis", len))
     1203        {
     1204            SETUPX_UpdateInis(filename, szInstallSection, pSub);
     1205        continue;
     1206        }
    12061207#endif
    1207         }
    1208         if (wFlags & GENINSTALL_DO_REG)
    1209         {
     1208    }
     1209    if (wFlags & GENINSTALL_DO_REG)
     1210    {
    12101211#if IMPLEMENT_THAT
    1211             /* probably use SUReg*() functions here */
    1212             if (!strncasecmp(p, "AddReg", len))
    1213             {
    1214                 SETUPX_AddReg(filename, szInstallSection, pSub);
    1215                 continue;
    1216             }
    1217             else
    1218             if (!strncasecmp(p, "DelReg", len))
    1219             {
    1220                 SETUPX_DelReg(filename, szInstallSection, pSub);
    1221                 continue;
    1222             }
     1212        /* probably use SUReg*() functions here */
     1213        if (!strncasecmp(p, "AddReg", len))
     1214        {
     1215            SETUPX_AddReg(filename, szInstallSection, pSub);
     1216        continue;
     1217        }
     1218        else
     1219        if (!strncasecmp(p, "DelReg", len))
     1220        {
     1221            SETUPX_DelReg(filename, szInstallSection, pSub);
     1222        continue;
     1223        }
    12231224#endif
    1224         }
    1225        
    1226         SETUPX_FreeSubStrings(pSub);
     1225    }
     1226
     1227    SETUPX_FreeSubStrings(pSub);
    12271228    }
    12281229    HeapFree(GetProcessHeap(), 0, pEntries);
Note: See TracChangeset for help on using the changeset viewer.