Back to index

lightning-sunbird  0.9+nobinonly
xpapi.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 //
00038 //  Various routines for MAPI functions.
00039 //  Written by: Rich Pizzarro (rhp@netscape.com)
00040 //  November 1997
00041 //
00042 #ifndef __XPAPI_H
00043 #define __XPAPI_H
00044 
00045 #ifdef WIN16
00046 
00047 #include <string.h>
00048 #include <direct.h>
00049 #include <shellapi.h>
00050 #include <stdlib.h>
00051 #else
00052 #include <winreg.h>
00053 #endif 
00054  
00055 #ifdef WIN16
00056 extern "C" {
00057 #ifndef MAPI_OLE     // Because MSFT doesn't do this for us :-(
00058 #include <mapi.h>
00059 #endif 
00060 }           
00061 #else
00062 //#include <mapi.h>
00063 #endif
00064 
00065 
00066 #ifdef WIN32
00067 #define MAPI_IMPLEMENT(param) param PASCAL 
00068 #define LOAD_DS
00069 #else        
00070 #define LOAD_DS      __loadds
00071 #define MAPI_IMPLEMENT(param) extern "C" param FAR PASCAL
00072  
00073 #endif   
00074 
00075 #ifdef WIN16
00076 #define _MAX_PATH                         260  /* max. length of full pathname*/
00077 #define MAPI_E_LOGON_FAILURE       3 
00078 #define MAPI_E_ACCESS_DENIED       6  
00079 #define INVALID_HANDLE_VALUE       (HANDLE)-1  
00080 #define KEY_QUERY_VALUE            0x0001  
00081 #define HKEY_LOCAL_MACHINE         ((HKEY)0x80000002)
00082 #define HKEY_ROOT                         HKEY_CLASSES_ROOT
00083 #else 
00084 #define HKEY_ROOT                         ((HKEY)0x80000002)
00085 #endif
00086 
00087 //
00088 // registry keys
00089 //
00090 #ifdef WIN32
00091 static char szNavigatorSection[] = "Software\\Netscape\\Netscape Navigator";
00092 static char szNavigatorCurVersionSection[] = "Software\\Netscape\\Netscape Navigator\\%s\\Main";
00093 static char szCurrentVersionKey[] = "CurrentVersion";
00094 static char szInstallDirKey[] = "Install Directory";
00095 static char szMapiSection[] = "Software\\Netscape\\Netscape Navigator\\MAPI";
00096 static char szTempFiles[] = "TempFiles";  
00097 static char szMapiLog[] = "NSMAPI32.LOG";
00098 #else 
00099 //32 bit key strings for trying to read the 32bit registry
00100 static char szNavigatorSection32[] = "Software\\Netscape\\Netscape Navigator";
00101 static char szNavigatorCurVersionSection32[] = "Software\\Netscape\\Netscape Navigator\\%s\\Main";
00102 static char szMapiSection32[] = "Software\\Netscape\\Netscape Navigator\\MAPI";
00103 
00104 // ini section and key strings 
00105 static char szNetscapeINI[] = "nscp.ini";
00106 static char szNavigatorSection[] = "Netscape Navigator";
00107 static char szNavigatorCurVersionSection[] = "Netscape Navigator-%s";
00108 static char szCurrentVersionKey[] = "CurrentVersion";
00109 static char szInstallDirKey[] = "Install Directory";
00110 static char szMapiSection[] = "MAPI";
00111 static char szTempFiles[] = "TempFiles";
00112 static char szExeName[] = "NAVSTART.EXE";
00113 static char szMapiLog[] = "NSMAPI16.LOG";
00114 #endif                                   
00115 
00116 //Since REGSAM is just an ACCESS_MASK which is just a DWORD and it's not 
00117 //declared in win16 we'll make one hear for the purpose of keeping parameters
00118 //the same even though the access rights don't get used for win16.
00119 
00120 typedef DWORD REGSAM;
00121 
00122 
00123 // XP declarations
00124 
00125 int    LOAD_DS Is_16_OR_32_BIT_CommunitorRunning();
00126 WORD   LOAD_DS XP_CallProcess(LPCSTR pPath, LPCSTR pCmdLine);
00127 HKEY LOAD_DS RegOpenParent(LPCSTR pSection, HKEY hRootKey, REGSAM access);
00128 HKEY LOAD_DS RegCreateParent(LPCSTR pSection, HKEY hMasterKey);
00129 BOOL LOAD_DS GetConfigInfoStr(LPCSTR pSection, LPCSTR pKey, LPSTR pBuf, int lenBuf, HKEY hMasterKey);
00130 BOOL LOAD_DS GetConfigInfoNum(LPCSTR pSection, LPCSTR pKey, DWORD* pVal, HKEY hMasterKey);
00131 BOOL LOAD_DS SetConfigInfoStr(LPCSTR pSection, LPCSTR pKey, LPSTR pStr, HKEY hMasterKey); 
00132 
00133 BOOL  LOAD_DS XP_GetInstallDirectory(LPCSTR pcurVersionSection, LPCSTR pInstallDirKey, LPSTR path, UINT nSize, HKEY hKey); 
00134 BOOL  LOAD_DS XP_GetVersionInfoString(LPCSTR pNavigatorSection, LPCSTR pCurrentVersionKey, LPSTR pcurVersionStr, UINT nSize, HKEY hKey);
00135 DWORD LOAD_DS XP_GetInstallLocation(LPSTR pPath, UINT nSize);
00136 BOOL LOAD_DS  XP_CopyFile(LPCSTR lpExistingFile, LPCSTR lpNewFile, BOOL bFailifExist);
00137 
00138 #endif    // __XPAPI_H