Annotation of truecrypt/setup/setup.c, revision 1.1.1.12

1.1.1.11  root        1: /*
                      2:  Legal Notice: The source code contained in this file has been derived from
                      3:  the source code of Encryption for the Masses 2.02a, which is Copyright (c)
                      4:  Paul Le Roux and which is covered by the 'License Agreement for Encryption
                      5:  for the Masses'. Modifications and additions to that source code contained
                      6:  in this file are Copyright (c) TrueCrypt Foundation and are covered by the
1.1.1.12! root        7:  TrueCrypt License 2.3 the full text of which is contained in the file
1.1.1.11  root        8:  License.txt included in TrueCrypt binary and source code distribution
                      9:  packages. */
1.1       root       10: 
1.1.1.7   root       11: #include "Tcdefs.h"
1.1       root       12: #include <SrRestorePtApi.h>
1.1.1.7   root       13: #include <sys/types.h>
                     14: #include <sys/stat.h>
1.1       root       15: 
1.1.1.7   root       16: #include "Apidrvr.h"
                     17: #include "Combo.h"
1.1.1.11  root       18: #include "ComSetup.h"
1.1.1.7   root       19: #include "Dlgcode.h"
                     20: #include "Language.h"
                     21: #include "Registry.h"
                     22: #include "Resource.h"
1.1       root       23: 
1.1.1.7   root       24: #include "Dir.h"
                     25: #include "Setup.h"
1.1       root       26: 
1.1.1.7   root       27: #include "../Common/Resource.h"
                     28: #include "../Mount/Mount.h"
1.1       root       29: 
                     30: #pragma warning( disable : 4201 )
                     31: #pragma warning( disable : 4115 )
                     32: 
                     33: #include <shlobj.h>
                     34: 
                     35: #pragma warning( default : 4201 )
                     36: #pragma warning( default : 4115 )
                     37: 
                     38: char dlg_file_name[TC_MAX_PATH];
1.1.1.8   root       39: char SetupFilesDir[TC_MAX_PATH];
1.1.1.11  root       40: char UninstallBatch[MAX_PATH];
1.1.1.8   root       41: 
1.1       root       42: BOOL bUninstall = FALSE;
                     43: BOOL bDone = FALSE;
1.1.1.11  root       44: BOOL Rollback = FALSE;
                     45: BOOL bUpgrade = FALSE;
                     46: BOOL bFirstTimeInstall = FALSE;
1.1.1.7   root       47: char *UninstallPath;
1.1       root       48: 
                     49: HMODULE SystemRestoreDll = 0;
                     50: 
                     51: BOOL
                     52: StatDeleteFile (char *lpszFile)
                     53: {
                     54:        struct __stat64 st;
                     55: 
                     56:        if (_stat64 (lpszFile, &st) == 0)
                     57:                return DeleteFile (lpszFile);
                     58:        else
                     59:                return TRUE;
                     60: }
                     61: 
                     62: BOOL
                     63: StatRemoveDirectory (char *lpszDir)
                     64: {
                     65:        struct __stat64 st;
                     66: 
                     67:        if (_stat64 (lpszDir, &st) == 0)
                     68:                return RemoveDirectory (lpszDir);
                     69:        else
                     70:                return TRUE;
                     71: }
                     72: 
                     73: HRESULT
                     74: CreateLink (char *lpszPathObj, char *lpszArguments,
                     75:            char *lpszPathLink)
                     76: {
                     77:        HRESULT hres;
                     78:        IShellLink *psl;
                     79: 
                     80:        /* Get a pointer to the IShellLink interface.  */
                     81:        hres = CoCreateInstance (&CLSID_ShellLink, NULL,
                     82:                               CLSCTX_INPROC_SERVER, &IID_IShellLink, &psl);
                     83:        if (SUCCEEDED (hres))
                     84:        {
                     85:                IPersistFile *ppf;
                     86: 
                     87:                /* Set the path to the shortcut target, and add the
                     88:                   description.  */
                     89:                psl->lpVtbl->SetPath (psl, lpszPathObj);
                     90:                psl->lpVtbl->SetArguments (psl, lpszArguments);
                     91: 
                     92:                /* Query IShellLink for the IPersistFile interface for saving
                     93:                   the shortcut in persistent storage.  */
                     94:                hres = psl->lpVtbl->QueryInterface (psl, &IID_IPersistFile,
                     95:                                                    &ppf);
                     96: 
                     97:                if (SUCCEEDED (hres))
                     98:                {
                     99:                        WORD wsz[TC_MAX_PATH];
                    100: 
                    101:                        /* Ensure that the string is ANSI.  */
                    102:                        MultiByteToWideChar (CP_ACP, 0, lpszPathLink, -1,
                    103:                                             wsz, TC_MAX_PATH);
                    104: 
                    105:                        /* Save the link by calling IPersistFile::Save.  */
                    106:                        hres = ppf->lpVtbl->Save (ppf, wsz, TRUE);
                    107:                        ppf->lpVtbl->Release (ppf);
                    108:                }
                    109:                psl->lpVtbl->Release (psl);
                    110:        }
                    111:        return hres;
                    112: }
                    113: 
                    114: void
                    115: GetProgramPath (HWND hwndDlg, char *path)
                    116: {
                    117:        ITEMIDLIST *i;
                    118:        HRESULT res;
                    119: 
1.1.1.7   root      120:        if (IsDlgButtonChecked (hwndDlg, IDC_ALL_USERS))
1.1       root      121:         res = SHGetSpecialFolderLocation (hwndDlg, CSIDL_COMMON_PROGRAMS, &i);
                    122:        else
                    123:         res = SHGetSpecialFolderLocation (hwndDlg, CSIDL_PROGRAMS, &i);
                    124: 
                    125:        SHGetPathFromIDList (i, path);
                    126: }
                    127: 
                    128: void
1.1.1.7   root      129: StatusMessage (HWND hwndDlg , char *stringId)
1.1       root      130: {
1.1.1.11  root      131:        if (Rollback)
                    132:                return;
                    133: 
1.1.1.7   root      134:        SendMessageW (GetDlgItem (hwndDlg, IDC_FILES), LB_ADDSTRING, 0, (LPARAM) GetString (stringId));
1.1.1.11  root      135: 
1.1       root      136:        SendDlgItemMessage (hwndDlg, IDC_FILES, LB_SETTOPINDEX, 
                    137:                SendDlgItemMessage (hwndDlg, IDC_FILES, LB_GETCOUNT, 0, 0) - 1, 0);
                    138: }
                    139: 
                    140: void
1.1.1.7   root      141: StatusMessageParam (HWND hwndDlg, char *stringId, char *param)
1.1       root      142: {
1.1.1.7   root      143:        wchar_t szTmp[1024];
1.1.1.11  root      144: 
                    145:        if (Rollback)
                    146:                return;
                    147: 
1.1.1.7   root      148:        wsprintfW (szTmp, L"%s %hs", GetString (stringId), param);
                    149:        SendMessageW (GetDlgItem (hwndDlg, IDC_FILES), LB_ADDSTRING, 0, (LPARAM) szTmp);
                    150:                
                    151:        SendDlgItemMessage (hwndDlg, IDC_FILES, LB_SETTOPINDEX, 
                    152:                SendDlgItemMessage (hwndDlg, IDC_FILES, LB_GETCOUNT, 0, 0) - 1, 0);
1.1       root      153: }
                    154: 
                    155: void
1.1.1.7   root      156: RegMessage (HWND hwndDlg, char *txt)
1.1       root      157: {
1.1.1.7   root      158:        StatusMessageParam (hwndDlg, "ADDING_REG", txt);
1.1       root      159: }
                    160: 
                    161: void
1.1.1.7   root      162: CopyMessage (HWND hwndDlg, char *txt)
1.1       root      163: {
1.1.1.11  root      164:        StatusMessageParam (hwndDlg, "INSTALLING", txt);
1.1       root      165: }
                    166: 
                    167: void
1.1.1.7   root      168: RemoveMessage (HWND hwndDlg, char *txt)
1.1       root      169: {
1.1.1.11  root      170:        if (!Rollback)
                    171:                StatusMessageParam (hwndDlg, "REMOVING", txt);
1.1       root      172: }
                    173: 
                    174: void
                    175: IconMessage (HWND hwndDlg, char *txt)
                    176: {
1.1.1.7   root      177:        StatusMessageParam (hwndDlg, "ADDING_ICON", txt);
1.1       root      178: }
                    179: 
                    180: 
                    181: BOOL
1.1.1.11  root      182: DoFilesInstall (HWND hwndDlg, char *szDestDir)
1.1       root      183: {
                    184:        char *szFiles[]=
                    185:        {
1.1.1.11  root      186:                "ATrueCrypt.exe",
                    187:                "ATrueCrypt Format.exe",
                    188:                "ATrueCrypt User Guide.pdf",
                    189:                "ATrueCrypt Setup.exe",
                    190:                "Atruecrypt.sys",
                    191:                "Atruecrypt-x64.sys",
                    192:                "ALicense.txt",
                    193:                "Dtruecrypt.sys"
1.1       root      194:        };
                    195: 
                    196:        char szTmp[TC_MAX_PATH];
                    197:        BOOL bOK = TRUE;
1.1.1.11  root      198:        int i, x;
1.1       root      199: 
1.1.1.11  root      200:        x = strlen (szDestDir);
                    201:        if (x < 1)
                    202:                return FALSE;
                    203: 
                    204:        if (szDestDir[x - 1] != '\\')
                    205:                strcat (szDestDir, "\\");
1.1       root      206: 
                    207:        for (i = 0; i < sizeof (szFiles) / sizeof (szFiles[0]); i++)
                    208:        {
1.1.1.11  root      209:                BOOL bResult;
1.1       root      210:                char szDir[TC_MAX_PATH];
                    211: 
1.1.1.11  root      212:                if (bUninstall && strstr (szFiles[i], "TrueCrypt Setup") != 0)
1.1       root      213:                        continue;
                    214: 
                    215:                if (*szFiles[i] == 'A')
                    216:                        strcpy (szDir, szDestDir);
                    217:                else if (*szFiles[i] == 'D')
                    218:                {
1.1.1.10  root      219:                        GetSystemDirectory (szDir, sizeof (szDir));
1.1       root      220: 
1.1.1.11  root      221:                        x = strlen (szDir);
                    222:                        if (szDir[x - 1] != '\\')
1.1       root      223:                                strcat (szDir, "\\");
                    224: 
1.1.1.11  root      225:                        strcat (szDir, "Drivers\\");
1.1       root      226:                }
                    227:                else if (*szFiles[i] == 'W')
                    228:                        GetWindowsDirectory (szDir, sizeof (szDir));
                    229: 
1.1.1.7   root      230:                if (*szFiles[i] == 'I')
1.1       root      231:                        continue;
                    232: 
                    233:                sprintf (szTmp, "%s%s", szDir, szFiles[i] + 1);
                    234: 
                    235:                if (bUninstall == FALSE)
                    236:                        CopyMessage (hwndDlg, szTmp);
                    237:                else
                    238:                        RemoveMessage (hwndDlg, szTmp);
                    239: 
                    240:                if (bUninstall == FALSE)
                    241:                {
1.1.1.8   root      242:                        SetCurrentDirectory (SetupFilesDir);
                    243: 
1.1.1.6   root      244:                        bResult = TCCopyFile (szFiles[i] + 1, szTmp);
1.1       root      245:                        if (!bResult)
                    246:                        {
                    247:                                char s[256];
1.1.1.7   root      248: 
                    249:                                sprintf (s, "Setup Files\\%s", 
                    250:                                        (strcmp (szFiles[i], "Dtruecrypt.sys") == 0 && Is64BitOs ()) ? 
                    251:                                        "truecrypt-x64.sys" : szFiles[i] + 1);
                    252: 
1.1.1.6   root      253:                                bResult = TCCopyFile (s, szTmp);
1.1       root      254:                        }
                    255:                }
                    256:                else
                    257:                {
                    258:                        bResult = StatDeleteFile (szTmp);
                    259:                }
                    260: 
                    261:                if (bResult == FALSE)
                    262:                {
                    263:                        LPVOID lpMsgBuf;
                    264:                        DWORD dwError = GetLastError ();
1.1.1.7   root      265:                        wchar_t szTmp2[700];
1.1       root      266: 
                    267:                        FormatMessage (
                    268:                                              FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
                    269:                                              NULL,
                    270:                                              dwError,
                    271:                                 MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),    /* Default language */
                    272:                                              (char *) &lpMsgBuf,
                    273:                                              0,
                    274:                                              NULL
                    275:                                );
                    276: 
                    277: 
                    278:                        if (bUninstall == FALSE)
1.1.1.7   root      279:                                wsprintfW (szTmp2, GetString ("INSTALL_OF_FAILED"), szTmp, lpMsgBuf);
1.1       root      280:                        else
1.1.1.7   root      281:                                wsprintfW (szTmp2, GetString ("UNINSTALL_OF_FAILED"), szTmp, lpMsgBuf);
1.1       root      282: 
                    283:                        LocalFree (lpMsgBuf);
                    284: 
1.1.1.11  root      285:                        if (!Silent && MessageBoxW (hwndDlg, szTmp2, lpszTitle, MB_YESNO | MB_ICONHAND) != IDYES)
1.1       root      286:                                return FALSE;
                    287:                }
1.1.1.7   root      288:        }
1.1       root      289: 
1.1.1.7   root      290:        // Language pack
                    291:        if (bUninstall == FALSE)
                    292:        {
                    293:                WIN32_FIND_DATA f;
1.1.1.8   root      294:                HANDLE h;
                    295:                
                    296:                SetCurrentDirectory (SetupFilesDir);
                    297:                h = FindFirstFile ("Language.*.xml", &f);
                    298: 
1.1.1.7   root      299:                if (h != INVALID_HANDLE_VALUE)
                    300:                {
                    301:                        char d[MAX_PATH*2];
1.1.1.11  root      302:                        sprintf (d, "%s%s", szDestDir, f.cFileName);
1.1.1.7   root      303:                        CopyMessage (hwndDlg, d);
                    304:                        TCCopyFile (f.cFileName, d);
                    305:                        FindClose (h);
                    306:                }
1.1.1.8   root      307: 
                    308:                SetCurrentDirectory (SetupFilesDir);
                    309:                SetCurrentDirectory ("Setup files");
                    310:                h = FindFirstFile ("TrueCrypt User Guide.*.pdf", &f);
                    311:                if (h != INVALID_HANDLE_VALUE)
                    312:                {
                    313:                        char d[MAX_PATH*2];
1.1.1.11  root      314:                        sprintf (d, "%s%s", szDestDir, f.cFileName);
1.1.1.8   root      315:                        CopyMessage (hwndDlg, d);
                    316:                        TCCopyFile (f.cFileName, d);
                    317:                        FindClose (h);
                    318:                }
                    319:                SetCurrentDirectory (SetupFilesDir);
1.1       root      320:        }
                    321: 
                    322:        return bOK;
                    323: }
                    324: 
                    325: BOOL
1.1.1.11  root      326: DoRegInstall (HWND hwndDlg, char *szDestDir, BOOL bInstallType)
1.1       root      327: {
                    328:        char szDir[TC_MAX_PATH], *key;
1.1.1.11  root      329:        char szTmp[TC_MAX_PATH];
1.1       root      330:        HKEY hkey = 0;
                    331:        BOOL bSlash, bOK = FALSE;
                    332:        DWORD dw;
                    333:        int x;
                    334: 
                    335:        strcpy (szDir, szDestDir);
                    336:        x = strlen (szDestDir);
                    337:        if (szDestDir[x - 1] == '\\')
                    338:                bSlash = TRUE;
                    339:        else
                    340:                bSlash = FALSE;
                    341: 
                    342:        if (bSlash == FALSE)
                    343:                strcat (szDir, "\\");
                    344: 
1.1.1.7   root      345:        if (bInstallType)
1.1       root      346:        {
                    347: 
1.1.1.11  root      348:                key = "Software\\Classes\\TrueCryptVolume";
1.1       root      349:                RegMessage (hwndDlg, key);
                    350:                if (RegCreateKeyEx (HKEY_LOCAL_MACHINE,
                    351:                                    key,
                    352:                                    0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, &dw) != ERROR_SUCCESS)
                    353:                        goto error;
                    354: 
1.1.1.10  root      355:                strcpy (szTmp, "TrueCrypt Volume");
1.1       root      356:                if (RegSetValueEx (hkey, "", 0, REG_SZ, (BYTE *) szTmp, strlen (szTmp) + 1) != ERROR_SUCCESS)
                    357:                        goto error;
                    358: 
                    359:                RegCloseKey (hkey);
                    360:                hkey = 0;
                    361: 
1.1.1.11  root      362:                key = "Software\\Classes\\TrueCryptVolume\\DefaultIcon";
1.1       root      363:                RegMessage (hwndDlg, key);
                    364:                if (RegCreateKeyEx (HKEY_LOCAL_MACHINE,
                    365:                                    key,
                    366:                                    0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, &dw) != ERROR_SUCCESS)
                    367:                        goto error;
                    368: 
                    369:                sprintf (szTmp, "%sTrueCrypt.exe,1", szDir);
                    370:                if (RegSetValueEx (hkey, "", 0, REG_SZ, (BYTE *) szTmp, strlen (szTmp) + 1) != ERROR_SUCCESS)
                    371:                        goto error;
                    372: 
                    373:                RegCloseKey (hkey);
                    374:                hkey = 0;
                    375: 
1.1.1.11  root      376:                key = "Software\\Classes\\TrueCryptVolume\\Shell\\open\\command";
1.1       root      377:                RegMessage (hwndDlg, key);
                    378:                if (RegCreateKeyEx (HKEY_LOCAL_MACHINE,
                    379:                                    key,
                    380:                                    0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, &dw) != ERROR_SUCCESS)
                    381:                        goto error;
                    382: 
                    383:                sprintf (szTmp, "\"%sTrueCrypt.exe\" /v \"%%1\"", szDir );
                    384:                if (RegSetValueEx (hkey, "", 0, REG_SZ, (BYTE *) szTmp, strlen (szTmp) + 1) != ERROR_SUCCESS)
                    385:                        goto error;
                    386: 
                    387:                RegCloseKey (hkey);
                    388:                hkey = 0;
                    389: 
1.1.1.11  root      390:                key = "Software\\Classes\\.tc";
1.1       root      391:                RegMessage (hwndDlg, key);
                    392:                if (RegCreateKeyEx (HKEY_LOCAL_MACHINE,
                    393:                                    key,
                    394:                                    0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, &dw) != ERROR_SUCCESS)
                    395:                        goto error;
                    396: 
                    397:                strcpy (szTmp, "TrueCryptVolume");
                    398:                if (RegSetValueEx (hkey, "", 0, REG_SZ, (BYTE *) szTmp, strlen (szTmp) + 1) != ERROR_SUCCESS)
                    399:                        goto error;
1.1.1.11  root      400:                
                    401:                RegCloseKey (hkey);
                    402:                hkey = 0;
1.1       root      403:        }
                    404: 
1.1.1.11  root      405:        key = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\TrueCrypt";
                    406:        RegMessage (hwndDlg, key);
                    407:        if (RegCreateKeyEx (HKEY_LOCAL_MACHINE,
                    408:                key,
                    409:                0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, &dw) != ERROR_SUCCESS)
                    410:                goto error;
1.1       root      411: 
1.1.1.11  root      412:        sprintf (szTmp, "\"%sTrueCrypt Setup.exe\" /u %s", szDir, szDestDir);
                    413:        if (RegSetValueEx (hkey, "UninstallString", 0, REG_SZ, (BYTE *) szTmp, strlen (szTmp) + 1) != ERROR_SUCCESS)
                    414:                goto error;
1.1       root      415: 
1.1.1.11  root      416:        sprintf (szTmp, "\"%sTrueCrypt Setup.exe\"", szDir);
                    417:        if (RegSetValueEx (hkey, "DisplayIcon", 0, REG_SZ, (BYTE *) szTmp, strlen (szTmp) + 1) != ERROR_SUCCESS)
                    418:                goto error;
1.1       root      419: 
1.1.1.11  root      420:        strcpy (szTmp, "TrueCrypt");
                    421:        if (RegSetValueEx (hkey, "DisplayName", 0, REG_SZ, (BYTE *) szTmp, strlen (szTmp) + 1) != ERROR_SUCCESS)
                    422:                goto error;
1.1       root      423: 
1.1.1.11  root      424:        strcpy (szTmp, "TrueCrypt Foundation");
                    425:        if (RegSetValueEx (hkey, "Publisher", 0, REG_SZ, (BYTE *) szTmp, strlen (szTmp) + 1) != ERROR_SUCCESS)
                    426:                goto error;
1.1       root      427: 
1.1.1.11  root      428:        strcpy (szTmp, "http://www.truecrypt.org/");
                    429:        if (RegSetValueEx (hkey, "URLInfoAbout", 0, REG_SZ, (BYTE *) szTmp, strlen (szTmp) + 1) != ERROR_SUCCESS)
                    430:                goto error;
                    431:                
1.1       root      432:        bOK = TRUE;
                    433: 
1.1.1.11  root      434: error:
1.1       root      435:        if (hkey != 0)
                    436:                RegCloseKey (hkey);
                    437: 
                    438:        if (bOK == FALSE)
                    439:        {
                    440:                handleWin32Error (hwndDlg);
1.1.1.11  root      441:                Error ("REG_INSTALL_FAILED");
                    442:        }
                    443:        
                    444:        // Register COM servers for UAC
                    445:        if (nCurrentOS == WIN_VISTA_OR_LATER)
                    446:        {
                    447:                if (!RegisterComServers (szDir))
                    448:                {
                    449:                        Error ("COM_REG_FAILED");
                    450:                        return FALSE;
                    451:                }
1.1       root      452:        }
                    453: 
                    454:        return bOK;
                    455: }
                    456: 
                    457: BOOL
1.1.1.7   root      458: DoApplicationDataUninstall (HWND hwndDlg)
                    459: {
                    460:        char path[MAX_PATH];
                    461:        char path2[MAX_PATH];
                    462:        BOOL bOK = TRUE;
                    463: 
                    464:        StatusMessage (hwndDlg, "REMOVING_APPDATA");
                    465: 
                    466:        SHGetFolderPath (NULL, CSIDL_APPDATA, NULL, 0, path);
                    467:        strcat (path, "\\TrueCrypt\\");
                    468: 
                    469:        // Delete favorite volumes file
                    470:        sprintf (path2, "%s%s", path, FILE_FAVORITE_VOLUMES);
                    471:        RemoveMessage (hwndDlg, path2);
                    472:        StatDeleteFile (path2);
                    473: 
                    474:        // Delete keyfile defaults
                    475:        sprintf (path2, "%s%s", path, FILE_DEFAULT_KEYFILES);
                    476:        RemoveMessage (hwndDlg, path2);
                    477:        StatDeleteFile (path2);
                    478: 
                    479:        // Delete history file
                    480:        sprintf (path2, "%s%s", path, FILE_HISTORY);
                    481:        RemoveMessage (hwndDlg, path2);
                    482:        StatDeleteFile (path2);
                    483:        
                    484:        // Delete configuration file
                    485:        sprintf (path2, "%s%s", path, FILE_CONFIGURATION);
                    486:        RemoveMessage (hwndDlg, path2);
                    487:        StatDeleteFile (path2);
                    488: 
                    489:        SHGetFolderPath (NULL, CSIDL_APPDATA, NULL, 0, path);
                    490:        strcat (path, "\\TrueCrypt");
                    491:        RemoveMessage (hwndDlg, path);
                    492:        if (!StatRemoveDirectory (path))
                    493:        {
                    494:                handleWin32Error (hwndDlg);
                    495:                bOK = FALSE;
                    496:        }
                    497: 
                    498:        return bOK;
                    499: }
                    500: 
                    501: BOOL
                    502: DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
1.1       root      503: {
                    504:        BOOL bOK = FALSE;
1.1.1.7   root      505:        char regk [64];
1.1       root      506: 
1.1.1.11  root      507:        // Unregister COM servers
                    508:        if (!bRemoveDeprecated && nCurrentOS == WIN_VISTA_OR_LATER)
                    509:        {
                    510:                if (!UnregisterComServers (dlg_file_name))
                    511:                        StatusMessage (hwndDlg, "COM_DEREG_FAILED");
                    512:        }
                    513: 
                    514:        if (!bRemoveDeprecated)
                    515:                StatusMessage (hwndDlg, "REMOVING_REG");
1.1       root      516: 
1.1.1.11  root      517:        RegDeleteKey (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\TrueCrypt");
                    518:        RegDeleteKey (HKEY_LOCAL_MACHINE, "Software\\Classes\\TrueCryptVolume\\Shell\\open\\command");
                    519:        RegDeleteKey (HKEY_LOCAL_MACHINE, "Software\\Classes\\TrueCryptVolume\\Shell\\open");
                    520:        RegDeleteKey (HKEY_LOCAL_MACHINE, "Software\\Classes\\TrueCryptVolume\\Shell");
                    521:        RegDeleteKey (HKEY_LOCAL_MACHINE, "Software\\Classes\\TrueCryptVolume\\DefaultIcon");
                    522:        RegDeleteKey (HKEY_LOCAL_MACHINE, "Software\\Classes\\TrueCryptVolume");
                    523:        RegDeleteKey (HKEY_CURRENT_USER, "Software\\TrueCrypt");
1.1.1.7   root      524: 
                    525:        if (!bRemoveDeprecated)
                    526:        {
                    527:                // Split the string in order to prevent some antivirus packages from falsely reporting  
                    528:                // TrueCrypt.exe to contain a possible Trojan horse because of this string (heuristic scan).
                    529:                sprintf (regk, "%s%s", "Software\\Microsoft\\Windows\\Curren", "tVersion\\Run");
                    530:                DeleteRegistryValue (regk, "TrueCrypt");
                    531: 
1.1.1.11  root      532:                RegDeleteKey (HKEY_LOCAL_MACHINE, "Software\\Classes\\.tc");
1.1.1.7   root      533:        }
1.1       root      534: 
                    535:        bOK = TRUE;
                    536: 
                    537:        if (bOK == FALSE && GetLastError ()!= ERROR_NO_TOKEN && GetLastError ()!= ERROR_FILE_NOT_FOUND
                    538:            && GetLastError ()!= ERROR_PATH_NOT_FOUND)
                    539:        {
                    540:                handleWin32Error (hwndDlg);
                    541:        }
                    542:        else
                    543:                bOK = TRUE;
                    544: 
                    545:        return bOK;
                    546: }
                    547: 
1.1.1.11  root      548: 
1.1       root      549: BOOL
                    550: DoServiceUninstall (HWND hwndDlg, char *lpszService)
                    551: {
                    552:        SC_HANDLE hManager, hService = NULL;
                    553:        BOOL bOK = FALSE, bRet;
                    554:        SERVICE_STATUS status;
1.1.1.6   root      555:        BOOL firstTry = TRUE;
1.1       root      556:        int x;
                    557: 
1.1.1.6   root      558:        memset (&status, 0, sizeof (status));   /* Keep VC6 quiet */
                    559: 
                    560: retry:
1.1       root      561: 
                    562:        hManager = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS);
                    563:        if (hManager == NULL)
                    564:                goto error;
                    565: 
                    566:        hService = OpenService (hManager, lpszService, SERVICE_ALL_ACCESS);
                    567:        if (hService == NULL)
                    568:                goto error;
                    569: 
1.1.1.7   root      570:        if (strcmp ("truecrypt", lpszService) == 0)
                    571:                StatusMessage (hwndDlg, "STOPPING_DRIVER");
                    572:        else
                    573:                StatusMessageParam (hwndDlg, "STOPPING", lpszService);
1.1       root      574: 
                    575: #define WAIT_PERIOD 3
                    576: 
                    577:        for (x = 0; x < WAIT_PERIOD; x++)
                    578:        {
                    579:                bRet = QueryServiceStatus (hService, &status);
                    580:                if (bRet != TRUE)
                    581:                        goto error;
                    582: 
                    583:                if (status.dwCurrentState != SERVICE_START_PENDING &&
                    584:                    status.dwCurrentState != SERVICE_STOP_PENDING &&
                    585:                    status.dwCurrentState != SERVICE_CONTINUE_PENDING)
                    586:                        break;
                    587: 
                    588:                Sleep (1000);
                    589:        }
                    590: 
                    591:        if (status.dwCurrentState != SERVICE_STOPPED)
                    592:        {
                    593:                bRet = ControlService (hService, SERVICE_CONTROL_STOP, &status);
                    594:                if (bRet == FALSE)
                    595:                        goto try_delete;
                    596: 
                    597:                for (x = 0; x < WAIT_PERIOD; x++)
                    598:                {
                    599:                        bRet = QueryServiceStatus (hService, &status);
                    600:                        if (bRet != TRUE)
                    601:                                goto error;
                    602: 
                    603:                        if (status.dwCurrentState != SERVICE_START_PENDING &&
                    604:                            status.dwCurrentState != SERVICE_STOP_PENDING &&
                    605:                          status.dwCurrentState != SERVICE_CONTINUE_PENDING)
                    606:                                break;
                    607: 
                    608:                        Sleep (1000);
                    609:                }
                    610: 
                    611:                if (status.dwCurrentState != SERVICE_STOPPED && status.dwCurrentState != SERVICE_STOP_PENDING)
                    612:                        goto error;
                    613:        }
                    614: 
1.1.1.6   root      615: try_delete:
                    616: 
1.1.1.7   root      617:        if (strcmp ("truecrypt", lpszService) == 0)
                    618:                StatusMessage (hwndDlg, "REMOVING_DRIVER");
                    619:        else
                    620:                StatusMessageParam (hwndDlg, "REMOVING", lpszService);
1.1       root      621: 
                    622:        if (hService != NULL)
                    623:                CloseServiceHandle (hService);
                    624: 
                    625:        if (hManager != NULL)
                    626:                CloseServiceHandle (hManager);
                    627: 
                    628:        hManager = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS);
                    629:        if (hManager == NULL)
                    630:                goto error;
                    631: 
                    632:        hService = OpenService (hManager, lpszService, SERVICE_ALL_ACCESS);
                    633:        if (hService == NULL)
                    634:                goto error;
                    635: 
                    636:        bRet = DeleteService (hService);
                    637:        if (bRet == FALSE)
1.1.1.6   root      638:        {
                    639:                if (firstTry && GetLastError () == ERROR_SERVICE_MARKED_FOR_DELETE)
                    640:                {
                    641:                        // Second try for an eventual no-install driver instance
                    642:                        CloseServiceHandle (hService);
                    643:                        CloseServiceHandle (hManager);
                    644: 
                    645:                        Sleep(1000);
                    646:                        firstTry = FALSE;
                    647:                        goto retry;
                    648:                }
                    649: 
1.1       root      650:                goto error;
1.1.1.6   root      651:        }
1.1       root      652: 
                    653:        bOK = TRUE;
                    654: 
1.1.1.6   root      655: error:
                    656: 
1.1       root      657:        if (bOK == FALSE && GetLastError ()!= ERROR_SERVICE_DOES_NOT_EXIST)
                    658:        {
                    659:                handleWin32Error (hwndDlg);
1.1.1.7   root      660:                MessageBoxW (hwndDlg, GetString ("DRIVER_UINSTALL_FAILED"), lpszTitle, MB_ICONHAND);
1.1       root      661:        }
                    662:        else
                    663:                bOK = TRUE;
                    664: 
                    665:        if (hService != NULL)
                    666:                CloseServiceHandle (hService);
                    667: 
                    668:        if (hManager != NULL)
                    669:                CloseServiceHandle (hManager);
                    670: 
                    671:        return bOK;
                    672: }
                    673: 
1.1.1.7   root      674: 
1.1       root      675: BOOL
                    676: DoDriverUnload (HWND hwndDlg)
                    677: {
                    678:        BOOL bOK = TRUE;
                    679:        int status;
                    680: 
                    681:        status = DriverAttach ();
                    682:        if (status != 0)
                    683:        {
1.1.1.11  root      684:                if (status == ERR_OS_ERROR && GetLastError () != ERROR_FILE_NOT_FOUND)
1.1       root      685:                {
                    686:                        handleWin32Error (hwndDlg);
1.1.1.7   root      687:                        AbortProcess ("NODRIVER");
1.1       root      688:                }
                    689: 
                    690:                if (status != ERR_OS_ERROR)
                    691:                {
                    692:                        handleError (NULL, status);
1.1.1.7   root      693:                        AbortProcess ("NODRIVER");
1.1       root      694:                }
                    695:        }
                    696: 
                    697:        if (hDriver != INVALID_HANDLE_VALUE)
                    698:        {
1.1.1.3   root      699:                MOUNT_LIST_STRUCT driver;
1.1.1.11  root      700:                LONG driverVersion = VERSION_NUM;
1.1.1.7   root      701:                int refCount;
1.1.1.3   root      702:                DWORD dwResult;
                    703:                BOOL bResult;
1.1       root      704: 
1.1.1.11  root      705:                // Try to determine if it's upgrade (and not reinstall, downgrade, or first-time install).
                    706:                bUpgrade = (DeviceIoControl (hDriver, DRIVER_VERSION, &driverVersion, 4, &driverVersion, 4, &dwResult, NULL) 
                    707:                                        && driverVersion < VERSION_NUM);
                    708: 
1.1.1.12! root      709:                bResult = DeviceIoControl (hDriver, MOUNT_LIST_ALL, &driver, sizeof (driver), &driver,
1.1.1.3   root      710:                        sizeof (driver), &dwResult, NULL);
1.1       root      711: 
1.1.1.7   root      712:                if (bResult)
1.1       root      713:                {
1.1.1.3   root      714:                        if (driver.ulMountedDrives != 0)
1.1       root      715:                        {
                    716:                                bOK = FALSE;
1.1.1.7   root      717:                                MessageBoxW (hwndDlg, GetString ("DISMOUNT_ALL_FIRST"), lpszTitle, MB_ICONHAND);
1.1       root      718:                        }
                    719:                }
                    720:                else
                    721:                {
1.1.1.3   root      722:                        bOK = FALSE;
                    723:                        handleWin32Error (hwndDlg);
1.1       root      724:                }
1.1.1.7   root      725:                
                    726:                // Try to close all open TC windows
1.1.1.11  root      727:                if (bOK)
1.1.1.7   root      728:                {
                    729:                        BOOL TCWindowClosed = FALSE;
1.1.1.11  root      730: 
1.1.1.7   root      731:                        EnumWindows (CloseTCWindowsEnum, (LPARAM) &TCWindowClosed);
1.1.1.11  root      732: 
                    733:                        if (TCWindowClosed) 
                    734:                                Sleep (2000);
1.1.1.7   root      735:                }
                    736: 
                    737:                // Test for any applications attached to driver
                    738:                bResult = DeviceIoControl (hDriver, DEVICE_REFCOUNT, &refCount, sizeof (refCount), &refCount,
                    739:                        sizeof (refCount), &dwResult, NULL);
                    740: 
                    741:                if (bOK && bResult && refCount > 1)
                    742:                {
                    743:                        MessageBoxW (hwndDlg, GetString ("CLOSE_TC_FIRST"), lpszTitle, MB_ICONSTOP);
                    744:                        bOK = FALSE;
                    745:                }
1.1       root      746: 
                    747:                CloseHandle (hDriver);
                    748:                hDriver = INVALID_HANDLE_VALUE;
                    749:        }
1.1.1.11  root      750:        else
                    751:        {
                    752:                bFirstTimeInstall = TRUE;
                    753:        }
1.1       root      754: 
                    755:        return bOK;
                    756: }
                    757: 
                    758: 
                    759: BOOL
                    760: DoDriverInstall (HWND hwndDlg)
                    761: {
                    762:        SC_HANDLE hManager, hService = NULL;
1.1.1.11  root      763:        BOOL bOK = FALSE, bRet;
1.1       root      764: 
                    765:        hManager = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS);
                    766:        if (hManager == NULL)
                    767:                goto error;
                    768: 
1.1.1.7   root      769:        StatusMessage (hwndDlg, "INSTALLING_DRIVER");
1.1       root      770: 
                    771:        hService = CreateService (hManager, "truecrypt", "truecrypt",
1.1.1.11  root      772:                SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER, SERVICE_SYSTEM_START, SERVICE_ERROR_NORMAL,
                    773:                !Is64BitOs () ? "System32\\drivers\\truecrypt.sys" : "SysWOW64\\drivers\\truecrypt.sys",
                    774:                NULL, NULL, NULL, NULL, NULL);
                    775: 
1.1       root      776:        if (hService == NULL)
                    777:                goto error;
                    778:        else
                    779:                CloseServiceHandle (hService);
                    780: 
                    781:        hService = OpenService (hManager, "truecrypt", SERVICE_ALL_ACCESS);
                    782:        if (hService == NULL)
                    783:                goto error;
                    784: 
1.1.1.7   root      785:        StatusMessage (hwndDlg, "STARTING_DRIVER");
1.1       root      786: 
                    787:        bRet = StartService (hService, 0, NULL);
                    788:        if (bRet == FALSE)
                    789:                goto error;
                    790: 
                    791:        bOK = TRUE;
                    792: 
1.1.1.11  root      793: error:
                    794:        if (bOK == FALSE && GetLastError () != ERROR_SERVICE_ALREADY_RUNNING)
1.1       root      795:        {
                    796:                handleWin32Error (hwndDlg);
1.1.1.7   root      797:                MessageBoxW (hwndDlg, GetString ("DRIVER_INSTALL_FAILED"), lpszTitle, MB_ICONHAND);
1.1       root      798:        }
                    799:        else
                    800:                bOK = TRUE;
                    801: 
                    802:        if (hService != NULL)
                    803:                CloseServiceHandle (hService);
                    804: 
                    805:        if (hManager != NULL)
                    806:                CloseServiceHandle (hManager);
                    807: 
                    808:        return bOK;
                    809: }
                    810: 
                    811: BOOL
                    812: DoShortcutsUninstall (HWND hwndDlg, char *szDestDir)
                    813: {
1.1.1.11  root      814:        char szLinkDir[TC_MAX_PATH];
1.1.1.7   root      815:        char szTmp2[TC_MAX_PATH];
1.1       root      816:        BOOL bSlash, bOK = FALSE;
                    817:        HRESULT hOle;
                    818:        int x;
                    819:        BOOL allUsers = FALSE;
                    820: 
                    821:        hOle = OleInitialize (NULL);
                    822: 
                    823:        // User start menu
                    824:     SHGetSpecialFolderPath (hwndDlg, szLinkDir, CSIDL_PROGRAMS, 0);
                    825:        x = strlen (szLinkDir);
                    826:        if (szLinkDir[x - 1] == '\\')
                    827:                bSlash = TRUE;
                    828:        else
                    829:                bSlash = FALSE;
                    830: 
                    831:        if (bSlash == FALSE)
                    832:                strcat (szLinkDir, "\\");
                    833: 
                    834:        strcat (szLinkDir, "TrueCrypt");
                    835: 
                    836:        // Global start menu
                    837:        {
                    838:                struct _stat st;
                    839:                char path[TC_MAX_PATH];
                    840: 
                    841:                SHGetSpecialFolderPath (hwndDlg, path, CSIDL_COMMON_PROGRAMS, 0);
                    842:                strcat (path, "\\TrueCrypt");
                    843: 
                    844:                if (_stat (path, &st) == 0)
                    845:                {
                    846:                        strcpy (szLinkDir, path);
                    847:                        allUsers = TRUE;
                    848:                }
                    849:        }
                    850: 
                    851:        // Start menu entries
                    852:        sprintf (szTmp2, "%s%s", szLinkDir, "\\TrueCrypt.lnk");
                    853:        RemoveMessage (hwndDlg, szTmp2);
                    854:        if (StatDeleteFile (szTmp2) == FALSE)
                    855:                goto error;
                    856: 
1.1.1.11  root      857:        sprintf (szTmp2, "%s%s", szLinkDir, "\\TrueCrypt Website.url");
1.1       root      858:        RemoveMessage (hwndDlg, szTmp2);
                    859:        if (StatDeleteFile (szTmp2) == FALSE)
                    860:                goto error;
                    861: 
                    862:        sprintf (szTmp2, "%s%s", szLinkDir, "\\Uninstall TrueCrypt.lnk");
                    863:        RemoveMessage (hwndDlg, szTmp2);
                    864:        if (StatDeleteFile (szTmp2) == FALSE)
                    865:                goto error;
1.1.1.11  root      866:        
                    867:        sprintf (szTmp2, "%s%s", szLinkDir, "\\TrueCrypt User's Guide.lnk");
                    868:        DeleteFile (szTmp2);
1.1       root      869: 
                    870:        // Start menu group
                    871:        RemoveMessage ((HWND) hwndDlg, szLinkDir);
                    872:        if (StatRemoveDirectory (szLinkDir) == FALSE)
                    873:                handleWin32Error ((HWND) hwndDlg);
                    874: 
                    875:        // Desktop icon
                    876: 
                    877:        if (allUsers)
                    878:                SHGetSpecialFolderPath (hwndDlg, szLinkDir, CSIDL_COMMON_DESKTOPDIRECTORY, 0);
                    879:        else
                    880:                SHGetSpecialFolderPath (hwndDlg, szLinkDir, CSIDL_DESKTOPDIRECTORY, 0);
                    881: 
                    882:        sprintf (szTmp2, "%s%s", szLinkDir, "\\TrueCrypt.lnk");
                    883: 
                    884:        RemoveMessage (hwndDlg, szTmp2);
                    885:        if (StatDeleteFile (szTmp2) == FALSE)
                    886:                goto error;
                    887: 
                    888:        bOK = TRUE;
                    889: 
                    890: error:
                    891:        OleUninitialize ();
                    892: 
                    893:        return bOK;
                    894: }
                    895: 
                    896: BOOL
                    897: DoShortcutsInstall (HWND hwndDlg, char *szDestDir, BOOL bProgGroup, BOOL bDesktopIcon)
                    898: {
                    899:        char szLinkDir[TC_MAX_PATH], szDir[TC_MAX_PATH];
1.1.1.7   root      900:        char szTmp[TC_MAX_PATH], szTmp2[TC_MAX_PATH], szTmp3[TC_MAX_PATH];
1.1       root      901:        BOOL bSlash, bOK = FALSE;
                    902:        HRESULT hOle;
                    903:        int x;
                    904: 
                    905:        if (bProgGroup == FALSE && bDesktopIcon == FALSE)
                    906:                return TRUE;
                    907: 
                    908:        hOle = OleInitialize (NULL);
                    909: 
                    910:        GetProgramPath (hwndDlg, szLinkDir);
                    911: 
                    912:        x = strlen (szLinkDir);
                    913:        if (szLinkDir[x - 1] == '\\')
                    914:                bSlash = TRUE;
                    915:        else
                    916:                bSlash = FALSE;
                    917: 
                    918:        if (bSlash == FALSE)
                    919:                strcat (szLinkDir, "\\");
                    920: 
                    921:        strcat (szLinkDir, "TrueCrypt");
                    922: 
                    923:        strcpy (szDir, szDestDir);
                    924:        x = strlen (szDestDir);
                    925:        if (szDestDir[x - 1] == '\\')
                    926:                bSlash = TRUE;
                    927:        else
                    928:                bSlash = FALSE;
                    929: 
                    930:        if (bSlash == FALSE)
                    931:                strcat (szDir, "\\");
                    932: 
                    933:        if (bProgGroup)
                    934:        {
1.1.1.11  root      935:                FILE *f;
                    936: 
1.1       root      937:                if (mkfulldir (szLinkDir, TRUE) != 0)
                    938:                {
1.1.1.7   root      939:                        wchar_t szTmp[TC_MAX_PATH];
1.1       root      940: 
                    941:                        if (mkfulldir (szLinkDir, FALSE) != 0)
                    942:                        {
                    943:                                handleWin32Error (hwndDlg);
1.1.1.7   root      944:                                wsprintfW (szTmp, GetString ("CANT_CREATE_FOLDER"), szLinkDir);
                    945:                                MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_ICONHAND);
1.1       root      946:                                goto error;
                    947:                        }
                    948:                }
                    949: 
                    950:                sprintf (szTmp, "%s%s", szDir, "TrueCrypt.exe");
                    951:                sprintf (szTmp2, "%s%s", szLinkDir, "\\TrueCrypt.lnk");
                    952: 
                    953:                IconMessage (hwndDlg, szTmp2);
                    954:                if (CreateLink (szTmp, "", szTmp2) != S_OK)
                    955:                        goto error;
                    956: 
1.1.1.11  root      957:                sprintf (szTmp2, "%s%s", szLinkDir, "\\TrueCrypt Website.url");
1.1       root      958:                IconMessage (hwndDlg, szTmp2);
1.1.1.11  root      959:                f = fopen (szTmp2, "w");
                    960:                if (f)
                    961:                {
                    962:                        fprintf (f, "[InternetShortcut]\nURL=%s&dest=index\n", TC_APPLINK);
                    963:                        fclose (f);
                    964:                }
1.1       root      965:                else
1.1.1.11  root      966:                        goto error;
1.1       root      967: 
                    968:                sprintf (szTmp, "%s%s", szDir, "TrueCrypt Setup.exe");
                    969:                sprintf (szTmp2, "%s%s", szLinkDir, "\\Uninstall TrueCrypt.lnk");
1.1.1.7   root      970:                sprintf (szTmp3, "/u %s", szDestDir);
1.1       root      971: 
                    972:                IconMessage (hwndDlg, szTmp2);
1.1.1.7   root      973:                if (CreateLink (szTmp, szTmp3, szTmp2) != S_OK)
1.1       root      974:                        goto error;
                    975: 
1.1.1.11  root      976:                sprintf (szTmp2, "%s%s", szLinkDir, "\\TrueCrypt User's Guide.lnk");
                    977:                DeleteFile (szTmp2);
1.1       root      978:        }
                    979: 
                    980:        if (bDesktopIcon)
                    981:        {
                    982:                strcpy (szDir, szDestDir);
                    983:                x = strlen (szDestDir);
                    984:                if (szDestDir[x - 1] == '\\')
                    985:                        bSlash = TRUE;
                    986:                else
                    987:                        bSlash = FALSE;
                    988: 
                    989:                if (bSlash == FALSE)
                    990:                        strcat (szDir, "\\");
                    991: 
1.1.1.7   root      992:                if (IsDlgButtonChecked (hwndDlg, IDC_ALL_USERS))
1.1       root      993:                        SHGetSpecialFolderPath (hwndDlg, szLinkDir, CSIDL_COMMON_DESKTOPDIRECTORY, 0);
                    994:                else
                    995:                        SHGetSpecialFolderPath (hwndDlg, szLinkDir, CSIDL_DESKTOPDIRECTORY, 0);
                    996: 
                    997:                sprintf (szTmp, "%s%s", szDir, "TrueCrypt.exe");
                    998:                sprintf (szTmp2, "%s%s", szLinkDir, "\\TrueCrypt.lnk");
                    999: 
                   1000:                IconMessage (hwndDlg, szTmp2);
                   1001: 
                   1002:                if (CreateLink (szTmp, "", szTmp2) != S_OK)
                   1003:                        goto error;
                   1004:        }
                   1005: 
                   1006:        bOK = TRUE;
                   1007: 
                   1008: error:
                   1009:        OleUninitialize ();
                   1010: 
                   1011:        return bOK;
                   1012: }
                   1013: 
                   1014: 
                   1015: void
1.1.1.11  root     1016: OutcomePrompt (HWND hwndDlg, BOOL bOK)
1.1       root     1017: {
1.1.1.7   root     1018:        if (bOK)
1.1       root     1019:        {
                   1020:                EnableWindow (GetDlgItem ((HWND) hwndDlg, IDCANCEL), FALSE);
                   1021: 
                   1022:                bDone = TRUE;
                   1023: 
1.1.1.7   root     1024:                if (bUninstall == FALSE)
1.1.1.11  root     1025:                        Info ("INSTALL_OK");
1.1       root     1026:                else
1.1.1.11  root     1027:                {
                   1028:                        wchar_t str[4096];
                   1029: 
                   1030:                        swprintf (str, GetString ("UNINSTALL_OK"), dlg_file_name);
                   1031:                        MessageBoxW (hwndDlg, str, lpszTitle, MB_ICONASTERISK);
                   1032:                }
1.1       root     1033:        }
                   1034:        else
                   1035:        {
                   1036:                if (bUninstall == FALSE)
1.1.1.11  root     1037:                        Error ("INSTALL_FAILED");
1.1       root     1038:                else
1.1.1.11  root     1039:                        Error ("UNINSTALL_FAILED");
1.1       root     1040:        }
                   1041: }
                   1042: 
                   1043: static void SetSystemRestorePoint (void *hwndDlg, BOOL finalize)
                   1044: {
                   1045:        static RESTOREPOINTINFO RestPtInfo;
                   1046:        static STATEMGRSTATUS SMgrStatus;
                   1047:        static BOOL failed = FALSE;
                   1048:        static BOOL (__stdcall *_SRSetRestorePoint)(PRESTOREPOINTINFO, PSTATEMGRSTATUS);
                   1049:        
                   1050:        if (!SystemRestoreDll) return;
                   1051: 
                   1052:        _SRSetRestorePoint = (BOOL (__stdcall *)(PRESTOREPOINTINFO, PSTATEMGRSTATUS))GetProcAddress (SystemRestoreDll,"SRSetRestorePointA");
                   1053:        if (_SRSetRestorePoint == 0)
                   1054:        {
                   1055:                FreeLibrary (SystemRestoreDll);
                   1056:                SystemRestoreDll = 0;
                   1057:                return;
                   1058:        }
                   1059: 
                   1060:        if (!finalize)
                   1061:        {
1.1.1.7   root     1062:                StatusMessage (hwndDlg, "CREATING_SYS_RESTORE");
1.1       root     1063: 
                   1064:                RestPtInfo.dwEventType = BEGIN_SYSTEM_CHANGE;
                   1065:                RestPtInfo.dwRestorePtType = APPLICATION_INSTALL;
                   1066:                RestPtInfo.llSequenceNumber = 0;
1.1.1.7   root     1067:                strcpy (RestPtInfo.szDescription, "TrueCrypt installation");
1.1       root     1068: 
1.1.1.7   root     1069:                if(!_SRSetRestorePoint (&RestPtInfo, &SMgrStatus)) 
1.1       root     1070:                {
1.1.1.7   root     1071:                        StatusMessage (hwndDlg, "FAILED_SYS_RESTORE");
1.1       root     1072:                        failed = TRUE;
                   1073:                }
                   1074:        }
1.1.1.11  root     1075:        else if (!failed)
1.1       root     1076:        {
1.1.1.11  root     1077:                RestPtInfo.dwEventType = END_SYSTEM_CHANGE;
                   1078:                RestPtInfo.llSequenceNumber = SMgrStatus.llSequenceNumber;
                   1079:                RestPtInfo.dwRestorePtType = CANCELLED_OPERATION;
                   1080: 
                   1081:                if(!_SRSetRestorePoint(&RestPtInfo, &SMgrStatus)) 
                   1082:                {
                   1083:                        StatusMessage (hwndDlg, "FAILED_SYS_RESTORE");
                   1084:                }
                   1085:                else
                   1086:                        StatusMessage (hwndDlg, "SYS_RESTORE_CREATED");
1.1       root     1087:        }
                   1088: }
                   1089: 
                   1090: void
                   1091: DoUninstall (void *hwndDlg)
                   1092: {
                   1093:        BOOL bOK = TRUE;
                   1094: 
1.1.1.11  root     1095:        if (!Rollback)
                   1096:                EnableWindow (GetDlgItem ((HWND) hwndDlg, IDC_UNINSTALL), FALSE);
1.1       root     1097: 
                   1098:        WaitCursor ();
                   1099: 
1.1.1.11  root     1100:        if (!Rollback)
                   1101:                SendMessage (GetDlgItem ((HWND) hwndDlg, IDC_FILES), LB_RESETCONTENT, 0, 0);
1.1       root     1102: 
                   1103:        if (DoDriverUnload (hwndDlg) == FALSE)
                   1104:        {
                   1105:                bOK = FALSE;
                   1106:        }
                   1107:        else if (DoServiceUninstall (hwndDlg, "truecrypt") == FALSE)
                   1108:        {
                   1109:                bOK = FALSE;
                   1110:        }
1.1.1.11  root     1111:        else if (DoRegUninstall ((HWND) hwndDlg, FALSE) == FALSE)
1.1       root     1112:        {
                   1113:                bOK = FALSE;
                   1114:        }
1.1.1.11  root     1115:        else if (DoFilesInstall ((HWND) hwndDlg, dlg_file_name) == FALSE)
1.1       root     1116:        {
                   1117:                bOK = FALSE;
                   1118:        }
                   1119:        else if (DoShortcutsUninstall (hwndDlg, dlg_file_name) == FALSE)
                   1120:        {
                   1121:                bOK = FALSE;
                   1122:        }
1.1.1.7   root     1123:        else if (!DoApplicationDataUninstall (hwndDlg))
                   1124:        {
                   1125:                bOK = FALSE;
                   1126:        }
1.1       root     1127:        else
                   1128:        {
1.1.1.11  root     1129:                char temp[MAX_PATH];
                   1130:                FILE *f;
                   1131: 
                   1132:                // Deprecated service
                   1133:                DoServiceUninstall (hwndDlg, "TrueCryptService");
                   1134: 
                   1135:                GetTempPath (sizeof (temp), temp);
                   1136:                _snprintf (UninstallBatch, sizeof (UninstallBatch), "%s\\TrueCrypt-Uninstall.bat", temp);
                   1137: 
                   1138:                // Create uninstall batch
                   1139:                f = fopen (UninstallBatch, "w");
                   1140:                if (!f)
                   1141:                        bOK = FALSE;
                   1142:                else
1.1       root     1143:                {
1.1.1.11  root     1144:                        fprintf (f, ":loop\n"
                   1145:                                "del \"%s\\%s\"\n"
                   1146:                                "if exist \"%s\\%s\" goto loop\n"
                   1147:                                "rmdir \"%s\"\n"
                   1148:                                "del \"%s\"",
                   1149:                                dlg_file_name, "TrueCrypt Setup.exe",
                   1150:                                dlg_file_name, "TrueCrypt Setup.exe",
                   1151:                                dlg_file_name,
                   1152:                                UninstallBatch
                   1153:                                );
                   1154:                        fclose (f);
1.1       root     1155:                }
                   1156:        }
                   1157: 
                   1158:        NormalCursor ();
                   1159: 
1.1.1.11  root     1160:        if (Rollback)
                   1161:                return;
                   1162: 
1.1.1.7   root     1163:        if (bOK)
1.1.1.11  root     1164:                PostMessage (hwndDlg, WM_APP + 2, 0, 0);
1.1.1.7   root     1165:                
                   1166:        EnableWindow (GetDlgItem ((HWND) hwndDlg, IDC_UNINSTALL), TRUE);
1.1.1.11  root     1167:        OutcomePrompt (hwndDlg, bOK);
1.1       root     1168: }
                   1169: 
                   1170: void
                   1171: DoInstall (void *hwndDlg)
                   1172: {
                   1173:        BOOL bOK = TRUE;
1.1.1.11  root     1174:        char path[MAX_PATH];
1.1       root     1175: 
1.1.1.7   root     1176:        EnableWindow (GetDlgItem ((HWND) hwndDlg, IDC_INSTALL), FALSE);
1.1       root     1177:        SendMessage (GetDlgItem ((HWND) hwndDlg, IDC_FILES), LB_RESETCONTENT, 0, 0);
                   1178: 
                   1179:        if (DoDriverUnload (hwndDlg) == FALSE)
                   1180:        {
1.1.1.4   root     1181:                NormalCursor ();
1.1.1.7   root     1182:                EnableWindow (GetDlgItem ((HWND) hwndDlg, IDC_INSTALL), TRUE);
1.1.1.4   root     1183:                return;
1.1       root     1184:        }
1.1.1.4   root     1185:        
                   1186:        if (IsButtonChecked (GetDlgItem ((HWND) hwndDlg, IDC_SYSTEM_RESTORE)))
                   1187:                SetSystemRestorePoint (hwndDlg, FALSE);
                   1188: 
1.1.1.11  root     1189:        // Remove deprecated
1.1.1.7   root     1190:        DoServiceUninstall (hwndDlg, "TrueCryptService");
1.1.1.11  root     1191:        
1.1.1.7   root     1192:        DoRegUninstall ((HWND) hwndDlg, TRUE);
                   1193: 
1.1.1.11  root     1194:        GetWindowsDirectory (path, sizeof (path));
                   1195:        strcat_s (path, sizeof (path), "\\TrueCrypt Setup.exe");
                   1196:        DeleteFile (path);
                   1197: 
1.1.1.7   root     1198:        if (DoServiceUninstall (hwndDlg, "truecrypt") == FALSE)
1.1       root     1199:        {
                   1200:                bOK = FALSE;
                   1201:        }
1.1.1.11  root     1202:        else if (DoFilesInstall ((HWND) hwndDlg, dlg_file_name) == FALSE)
1.1       root     1203:        {
                   1204:                bOK = FALSE;
                   1205:        }
                   1206:        else if (DoRegInstall ((HWND) hwndDlg, dlg_file_name,
1.1.1.11  root     1207:                IsButtonChecked (GetDlgItem ((HWND) hwndDlg, IDC_FILE_TYPE))) == FALSE)
1.1       root     1208:        {
                   1209:                bOK = FALSE;
                   1210:        }
                   1211:        else if (DoDriverInstall (hwndDlg) == FALSE)
                   1212:        {
                   1213:                bOK = FALSE;
                   1214:        }
                   1215:        else if (DoShortcutsInstall (hwndDlg, dlg_file_name,
                   1216:                                     IsButtonChecked (GetDlgItem ((HWND) hwndDlg, IDC_PROG_GROUP)),
                   1217:                                         IsButtonChecked (GetDlgItem ((HWND) hwndDlg, IDC_DESKTOP_ICON))) == FALSE)
                   1218:        {
                   1219:                bOK = FALSE;
                   1220:        }
                   1221: 
                   1222:        if (IsButtonChecked (GetDlgItem ((HWND) hwndDlg, IDC_SYSTEM_RESTORE)))
                   1223:                SetSystemRestorePoint (hwndDlg, TRUE);
                   1224: 
1.1.1.7   root     1225:        if (bOK)
                   1226:        {
1.1.1.11  root     1227:                UninstallBatch[0] = 0;
1.1.1.7   root     1228:                StatusMessage (hwndDlg, "INSTALL_COMPLETED");
1.1.1.11  root     1229:                EnableWindow (GetDlgItem ((HWND) hwndDlg, IDC_INSTALL), TRUE);
                   1230:        }
                   1231:        else
                   1232:        {
                   1233:                bUninstall = TRUE;
                   1234:                Rollback = TRUE;
                   1235:                Silent = TRUE;
                   1236: 
                   1237:                DoUninstall (hwndDlg);
                   1238: 
                   1239:                bUninstall = FALSE;
                   1240:                Rollback = FALSE;
                   1241:                Silent = FALSE;
                   1242: 
                   1243:                StatusMessage (hwndDlg, "ROLLBACK");
1.1.1.7   root     1244:        }
1.1       root     1245: 
1.1.1.11  root     1246:        PostMessage (hwndDlg,  WM_APP + 1, 0, 0);
                   1247:        OutcomePrompt (hwndDlg, bOK);
                   1248: 
                   1249:        if (bOK && !bUninstall)
                   1250:        {
                   1251:                if (bUpgrade && (AskYesNo ("AFTER_UPGRADE_RELEASE_NOTES") == IDYES))
                   1252:                {
                   1253:                        Applink ("releasenotes", TRUE, "");
                   1254:                }
                   1255:                else if (bFirstTimeInstall && AskYesNo ("AFTER_INSTALL_TUTORIAL") == IDYES)
                   1256:                {
                   1257:                        Applink ("beginnerstutorial", TRUE, "");
                   1258:                }
                   1259:        }
1.1       root     1260: }
                   1261: 
                   1262: 
1.1.1.12! root     1263: BOOL CALLBACK
1.1       root     1264: InstallDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
                   1265: {
                   1266:        WORD lw = LOWORD (wParam);
                   1267:        if (lParam);            /* remove warning */
                   1268: 
                   1269:        switch (msg)
                   1270:        {
                   1271:        case WM_INITDIALOG:
1.1.1.7   root     1272:                MainDlg = hwndDlg;
1.1       root     1273:                InitDialog (hwndDlg);
1.1.1.7   root     1274:                LocalizeDialog (hwndDlg, NULL);
1.1       root     1275: 
1.1.1.7   root     1276:                if (UninstallPath == NULL)
1.1.1.3   root     1277:                {
                   1278:                        char path[MAX_PATH+20];
                   1279:                        ITEMIDLIST *i;
                   1280:                        SHGetSpecialFolderLocation (hwndDlg, CSIDL_PROGRAM_FILES, &i);
                   1281:                        SHGetPathFromIDList (i, path);
                   1282:                        strcat (path, "\\TrueCrypt");
                   1283:                        SetWindowText (GetDlgItem (hwndDlg, IDC_DESTINATION), path);
                   1284:                }
1.1.1.7   root     1285:                else
                   1286:                        SetWindowText (GetDlgItem (hwndDlg, IDC_DESTINATION), UninstallPath);
1.1       root     1287: 
                   1288:                if (bUninstall == FALSE)
                   1289:                {
1.1.1.11  root     1290:                        char *licenseText;
                   1291: 
                   1292:                        licenseText = GetLegalNotices ();
                   1293:                        if (licenseText != NULL)
                   1294:                        {
                   1295:                                SetWindowText (GetDlgItem (hwndDlg, IDC_LICENSE), licenseText);
                   1296:                                free (licenseText);
                   1297:                        }
1.1       root     1298:                }
                   1299: 
                   1300:                SendMessage (GetDlgItem (hwndDlg, IDC_ALL_USERS), BM_SETCHECK, BST_CHECKED, 0);
                   1301:                SendMessage (GetDlgItem (hwndDlg, IDC_FILE_TYPE), BM_SETCHECK, BST_CHECKED, 0);
                   1302:                SendMessage (GetDlgItem (hwndDlg, IDC_PROG_GROUP), BM_SETCHECK, BST_CHECKED, 0);
                   1303:                SendMessage (GetDlgItem (hwndDlg, IDC_DESKTOP_ICON), BM_SETCHECK, BST_CHECKED, 0);
                   1304: 
                   1305:                // System Restore
1.1.1.7   root     1306:                SystemRestoreDll = LoadLibrary ("srclient.dll");
1.1       root     1307: 
                   1308:                if (SystemRestoreDll != 0)
                   1309:                        SendMessage (GetDlgItem (hwndDlg, IDC_SYSTEM_RESTORE), BM_SETCHECK, BST_CHECKED, 0);
                   1310:                else
                   1311:                        EnableWindow (GetDlgItem ((HWND) hwndDlg, IDC_SYSTEM_RESTORE), FALSE);
                   1312: 
1.1.1.7   root     1313:                SetWindowTextW (hwndDlg, lpszTitle);
1.1.1.11  root     1314: 
1.1       root     1315:                return 1;
                   1316: 
                   1317:        case WM_SYSCOMMAND:
                   1318:                if (lw == IDC_ABOUT)
                   1319:                {
1.1.1.7   root     1320:                        DialogBoxW (hInst, MAKEINTRESOURCEW (IDD_ABOUT_DLG), hwndDlg, (DLGPROC) AboutDlgProc);
1.1       root     1321:                        return 1;
                   1322:                }
                   1323:                return 0;
                   1324: 
                   1325:        case WM_COMMAND:
1.1.1.7   root     1326:                if (lw == IDC_INSTALL || lw == IDC_UNINSTALL)
1.1       root     1327:                {
                   1328:                        char szDirname[TC_MAX_PATH];
                   1329: 
1.1.1.7   root     1330:                        if (bDone)
1.1       root     1331:                        {
1.1.1.7   root     1332:                                EndDialog (hwndDlg, IDC_INSTALL);
1.1       root     1333:                                return 1;
                   1334:                        }
                   1335: 
                   1336:                        GetWindowText (GetDlgItem (hwndDlg, IDC_DESTINATION), szDirname, sizeof (szDirname));
                   1337: 
                   1338:                        if (bUninstall == FALSE)
                   1339:                        {
                   1340:                                if (mkfulldir (szDirname, TRUE) != 0)
                   1341:                                {
1.1.1.7   root     1342:                                        wchar_t szTmp[TC_MAX_PATH];
1.1       root     1343: 
                   1344:                                        if (mkfulldir (szDirname, FALSE) != 0)
                   1345:                                        {
                   1346:                                                handleWin32Error (hwndDlg);
1.1.1.7   root     1347:                                                wsprintfW (szTmp, GetString ("CANT_CREATE_FOLDER"), szDirname);
                   1348:                                                MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_ICONHAND);
1.1       root     1349:                                                return 1;
                   1350:                                        }
                   1351:                                }
                   1352:                        }
                   1353: 
                   1354:                        strcpy (dlg_file_name, szDirname);
                   1355: 
1.1.1.11  root     1356:                        WaitCursor ();
                   1357: 
1.1       root     1358:                        if (bUninstall == FALSE)
                   1359:                                _beginthread (DoInstall, 16384, (void *) hwndDlg);
                   1360:                        else
                   1361:                                _beginthread (DoUninstall, 16384, (void *) hwndDlg);
                   1362: 
                   1363:                        return 1;
                   1364:                }
                   1365: 
                   1366:                if (lw == IDCANCEL)
                   1367:                {
                   1368:                        EndDialog (hwndDlg, IDCANCEL);
                   1369:                        return 1;
                   1370:                }
                   1371: 
                   1372:                if (lw == IDC_BROWSE)
                   1373:                {
                   1374:                        char szDirname[TC_MAX_PATH];
                   1375: 
                   1376:                        GetWindowText (GetDlgItem (hwndDlg, IDC_DESTINATION), szDirname, sizeof (szDirname));
                   1377: 
1.1.1.7   root     1378:                        if (BrowseDirectories (hwndDlg, "SELECT_INSTALL_DIR", szDirname))
1.1       root     1379:                                SetWindowText (GetDlgItem (hwndDlg, IDC_DESTINATION), szDirname);
                   1380:                        
                   1381:                        return 1;
                   1382:                }
                   1383: 
                   1384:                if (lw == IDC_DESTINATION && HIWORD (wParam) == EN_CHANGE && bDone == FALSE)
                   1385:                {
                   1386:                        if (GetWindowTextLength (GetDlgItem (hwndDlg, IDC_DESTINATION)) <= 0)
1.1.1.7   root     1387:                                EnableWindow (GetDlgItem (hwndDlg, IDC_INSTALL), FALSE);
1.1       root     1388:                        else
1.1.1.7   root     1389:                                EnableWindow (GetDlgItem (hwndDlg, IDC_INSTALL), TRUE);
1.1       root     1390:                        return 1;
                   1391:                }
                   1392: 
                   1393:                return 0;
                   1394: 
1.1.1.11  root     1395:        case WM_APP + 1:
1.1.1.7   root     1396:                SetWindowTextW (GetDlgItem ((HWND) hwndDlg, IDC_INSTALL), GetString ("EXIT"));
1.1.1.11  root     1397:                NormalCursor ();
1.1.1.7   root     1398:                break;
                   1399: 
1.1.1.11  root     1400:        case WM_APP + 2:
                   1401:                SetWindowTextW (GetDlgItem ((HWND) hwndDlg, IDC_UNINSTALL), GetString ("FINALIZE"));
                   1402:                NormalCursor ();
1.1.1.7   root     1403:                break;
                   1404: 
1.1       root     1405:        case WM_CLOSE:
                   1406:                EndDialog (hwndDlg, IDCANCEL);
                   1407:                return 1;
                   1408:        }
                   1409: 
                   1410:        return 0;
                   1411: }
                   1412: 
                   1413: 
                   1414: int WINAPI
                   1415: WINMAIN (HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpszCommandLine,
                   1416:         int nCmdShow)
                   1417: {
                   1418:        if (nCmdShow && hPrevInstance); /* Remove unused parameter warning */
                   1419: 
1.1.1.7   root     1420:        lpszTitle = L"TrueCrypt Setup";
1.1       root     1421: 
                   1422:        /* Call InitApp to initialize the common code */
1.1.1.11  root     1423:        InitApp (hInstance, NULL);
1.1       root     1424: 
1.1.1.7   root     1425:        if (IsAdmin () != TRUE)
                   1426:                if (MessageBoxW (NULL, GetString ("SETUP_ADMIN"), lpszTitle, MB_YESNO | MB_ICONQUESTION) != IDYES)
1.1.1.11  root     1427:                        exit (1);
1.1       root     1428: 
1.1.1.8   root     1429:        /* Setup directory */
                   1430:        {
                   1431:                char *s;
                   1432:                GetModuleFileName (NULL, SetupFilesDir, sizeof (SetupFilesDir));
                   1433:                s = strrchr (SetupFilesDir, '\\');
                   1434:                if (s)
                   1435:                        s[1] = 0;
                   1436:        }
                   1437: 
1.1.1.7   root     1438:        if (lpszCommandLine[0] == '/' && lpszCommandLine[1] == 'u')
1.1       root     1439:        {
                   1440:                bUninstall = TRUE;
1.1.1.7   root     1441:                if (lpszCommandLine[2] == ' ')
                   1442:                        UninstallPath = &lpszCommandLine[3];
1.1       root     1443:        }
                   1444: 
1.1.1.11  root     1445:        // Force uninstall or stop setup when files are missing
                   1446:        if (!bUninstall)
                   1447:        {
                   1448:                WIN32_FIND_DATA fd;
                   1449:                HANDLE fh;
                   1450: 
                   1451:                SetCurrentDirectory (SetupFilesDir);
                   1452: 
                   1453:                fh = FindFirstFile ("Setup Files", &fd);
                   1454:                if (fh == INVALID_HANDLE_VALUE)
                   1455:                {
1.1.1.12! root     1456:                        HKEY hkey;
        !          1457:                        if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\TrueCrypt", 0, KEY_READ, &hkey) == ERROR_SUCCESS)
1.1.1.11  root     1458:                        {
1.1.1.12! root     1459:                                char rv[MAX_PATH*4];
        !          1460:                                DWORD size = sizeof (rv);
        !          1461:                                if (RegQueryValueEx (hkey, "UninstallString", 0, 0, (LPBYTE) &rv, &size) == ERROR_SUCCESS)
        !          1462:                                {
        !          1463:                                        char mp[MAX_PATH];
        !          1464: 
        !          1465:                                        GetModuleFileName (NULL, mp, sizeof (mp));
        !          1466:                                        _strupr (mp);
        !          1467:                                        _strupr (rv);
        !          1468:                                        if (strstr (rv, mp))
        !          1469:                                        {
        !          1470:                                                bUninstall = TRUE;
        !          1471:                                                UninstallPath = SetupFilesDir;
        !          1472:                                        }
        !          1473:                                }
        !          1474:                                RegCloseKey (hkey);
1.1.1.11  root     1475:                        }
1.1.1.12! root     1476: 
        !          1477:                        if (!bUninstall)
1.1.1.11  root     1478:                        {
1.1.1.12! root     1479:                                Error ("SETUP_INCOMPLETE");
        !          1480:                                exit (1);
1.1.1.11  root     1481:                        }
                   1482:                }
                   1483:                else
                   1484:                        FindClose (fh);
                   1485:        }
                   1486: 
1.1       root     1487:        if (bUninstall == FALSE)
                   1488:        {
                   1489:                /* Create the main dialog box */
1.1.1.7   root     1490:                DialogBoxW (hInstance, MAKEINTRESOURCEW (IDD_INSTALL), NULL, (DLGPROC) InstallDlgProc);
1.1       root     1491:        }
                   1492:        else
                   1493:        {
                   1494:                /* Create the main dialog box */
1.1.1.7   root     1495:                DialogBoxW (hInstance, MAKEINTRESOURCEW (IDD_UNINSTALL), NULL, (DLGPROC) InstallDlgProc);
1.1.1.11  root     1496:                
                   1497:                if (UninstallBatch[0])
                   1498:                {
                   1499:                        STARTUPINFO si;
                   1500:                        PROCESS_INFORMATION pi;
                   1501: 
                   1502:                        ZeroMemory (&si, sizeof (si));
                   1503:                        si.cb = sizeof (si);
                   1504:                        si.dwFlags = STARTF_USESHOWWINDOW;
                   1505:                        si.wShowWindow = SW_HIDE;
                   1506: 
                   1507:                        if (!CreateProcess (UninstallBatch, NULL, NULL, NULL, FALSE, IDLE_PRIORITY_CLASS, NULL, NULL, &si, &pi))
                   1508:                                DeleteFile (UninstallBatch);
                   1509:                }
1.1       root     1510:        }
                   1511: 
                   1512:        /* Terminate */
1.1.1.10  root     1513:        cleanup ();
1.1.1.11  root     1514: 
1.1       root     1515:        return 0;
                   1516: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.