Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
55fc2b96
Kaydet (Commit)
55fc2b96
authored
12 years ago
tarafından
Andras Timar
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Revert "fix for fdo#39632 : Consolidate GetMsiProperty()"
This reverts commit
95ee7d9c
.
üst
2d70b928
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
504 additions
and
159 deletions
+504
-159
respintest.cxx
...e/source/win32/customactions/languagepacks/respintest.cxx
+46
-11
reg4allmsi.cxx
...ve/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx
+0
-0
regactivex.cxx
...tive/source/win32/customactions/regactivex/regactivex.cxx
+23
-4
regpatchactivex.cxx
...e/win32/customactions/regpatchactivex/regpatchactivex.cxx
+37
-4
sellang.cxx
setup_native/source/win32/customactions/sellang/sellang.cxx
+18
-3
checkdirectory.cxx
...ce/win32/customactions/shellextensions/checkdirectory.cxx
+32
-5
checkpatches.cxx
...urce/win32/customactions/shellextensions/checkpatches.cxx
+31
-11
completeinstallpath.cxx
...n32/customactions/shellextensions/completeinstallpath.cxx
+27
-6
copyextensiondata.cxx
...win32/customactions/shellextensions/copyextensiondata.cxx
+21
-3
dotnetcheck.cxx
...ource/win32/customactions/shellextensions/dotnetcheck.cxx
+32
-10
layerlinks.cxx
...source/win32/customactions/shellextensions/layerlinks.cxx
+36
-4
migrateinstallpath.cxx
...in32/customactions/shellextensions/migrateinstallpath.cxx
+26
-5
postuninstall.cxx
...rce/win32/customactions/shellextensions/postuninstall.cxx
+21
-2
setadmininstall.cxx
...e/win32/customactions/shellextensions/setadmininstall.cxx
+2
-2
startmenuicon.cxx
...rce/win32/customactions/shellextensions/startmenuicon.cxx
+31
-6
upgrade.cxx
...ve/source/win32/customactions/shellextensions/upgrade.cxx
+38
-6
vistaspecial.cxx
...urce/win32/customactions/shellextensions/vistaspecial.cxx
+22
-4
thesaurus.cxx
...native/source/win32/customactions/thesaurus/thesaurus.cxx
+34
-2
checkversion.cxx
..._native/source/win32/customactions/tools/checkversion.cxx
+27
-8
msiprop.hxx
setup_native/source/win32/customactions/tools/msiprop.hxx
+0
-63
No files found.
setup_native/source/win32/customactions/languagepacks/respintest.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -27,7 +27,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -44,18 +44,53 @@
using
namespace
std
;
namespace
{
string
GetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
string
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
inline
bool
IsSetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
return
(
GetMsiProperty
(
handle
,
sProperty
).
length
()
>
0
);
}
inline
void
UnsetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
NULL
);
}
inline
void
SetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
,
const
string
&
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
TEXT
(
"1"
));
}
}
// namespace
extern
"C"
UINT
__stdcall
GetUserInstallMode
(
MSIHANDLE
handle
)
{
string
sOfficeInstallPath
=
GetMsiProp
Value
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
string
sOfficeInstallPath
=
GetMsiProp
erty
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
// MessageBox(NULL, sOfficeInstallPath.c_str(), "DEBUG", MB_OK);
// unsetting all properties
MsiSetProperty
(
handle
,
TEXT
(
"INVALIDDIRECTORY"
),
NULL
);
MsiSetProperty
(
handle
,
TEXT
(
"ISWRONGPRODUCT"
),
NULL
);
MsiSetProperty
(
handle
,
TEXT
(
"PATCHISOLDER"
),
NULL
);
MsiSetProperty
(
handle
,
TEXT
(
"ALLUSERS"
),
NULL
);
UnsetMsiProperty
(
handle
,
TEXT
(
"INVALIDDIRECTORY"
)
);
UnsetMsiProperty
(
handle
,
TEXT
(
"ISWRONGPRODUCT"
)
);
UnsetMsiProperty
(
handle
,
TEXT
(
"PATCHISOLDER"
)
);
UnsetMsiProperty
(
handle
,
TEXT
(
"ALLUSERS"
)
);
// 1. Searching for "ProductCode" in setup.ini
...
...
@@ -75,7 +110,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
if
(
!
_tcsicmp
(
szValue
,
TEXT
(
"INVALIDDIRECTORY"
)
)
)
{
// No setup.ini or no "ProductCode" in setup.ini. This is an invalid directory.
MsiSet
Property
(
handle
,
TEXT
(
"INVALIDDIRECTORY"
),
TEXT
(
"YES"
)
);
SetMsi
Property
(
handle
,
TEXT
(
"INVALIDDIRECTORY"
),
TEXT
(
"YES"
)
);
// MessageBox(NULL, "INVALIDDIRECTORY set, no setup.ini or ProductCode in setup.ini.", "DEBUG", MB_OK);
SetMsiErrorCode
(
MSI_ERROR_INVALIDDIRECTORY
);
return
ERROR_SUCCESS
;
...
...
@@ -96,20 +131,20 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
if
(
!
_tcsicmp
(
szValue
,
TEXT
(
"ISWRONGPRODUCT"
)
)
)
{
MsiSet
Property
(
handle
,
TEXT
(
"ISWRONGPRODUCT"
),
TEXT
(
"YES"
)
);
SetMsi
Property
(
handle
,
TEXT
(
"ISWRONGPRODUCT"
),
TEXT
(
"YES"
)
);
// MessageBox(NULL, "ISWRONGPRODUCT 1 set after searching buildid", "DEBUG", MB_OK);
SetMsiErrorCode
(
MSI_ERROR_ISWRONGPRODUCT
);
return
ERROR_SUCCESS
;
}
string
ProductMajor
=
GetMsiProp
Value
(
handle
,
TEXT
(
"PRODUCTMAJOR"
));
string
ProductMajor
=
GetMsiProp
erty
(
handle
,
TEXT
(
"PRODUCTMAJOR"
));
// Comparing the first three characters, for example "680"
// If not equal, this version is not suited for patch or language pack
if
(
_tcsnicmp
(
ProductMajor
.
c_str
(),
szValue
,
3
))
{
MsiSet
Property
(
handle
,
TEXT
(
"ISWRONGPRODUCT"
),
TEXT
(
"YES"
)
);
SetMsi
Property
(
handle
,
TEXT
(
"ISWRONGPRODUCT"
),
TEXT
(
"YES"
)
);
// MessageBox(NULL, "ISWRONGPRODUCT 2 set after searching PRODUCTMAJOR", "DEBUG", MB_OK);
SetMsiErrorCode
(
MSI_ERROR_ISWRONGPRODUCT
);
return
ERROR_SUCCESS
;
...
...
@@ -130,7 +165,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
if
(
szValue
[
0
]
)
{
MsiSet
Property
(
handle
,
TEXT
(
"ALLUSERS"
),
szValue
);
SetMsi
Property
(
handle
,
TEXT
(
"ALLUSERS"
),
szValue
);
// MessageBox(NULL, "ALLUSERS set", "DEBUG", MB_OK);
}
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx
Dosyayı görüntüle @
55fc2b96
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/regactivex/regactivex.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -23,7 +23,7 @@
#pragma warning(push, 1)
/* disable warnings within system headers */
#endif
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -121,11 +121,30 @@ void UnregisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallF
}
}
//----------------------------------------------------------
BOOL
GetMsiProp
(
MSIHANDLE
hMSI
,
const
wchar_t
*
pPropName
,
wchar_t
**
ppValue
)
{
DWORD
sz
=
0
;
if
(
MsiGetProperty
(
hMSI
,
pPropName
,
L""
,
&
sz
)
==
ERROR_MORE_DATA
)
{
sz
++
;
DWORD
nbytes
=
sz
*
sizeof
(
wchar_t
);
wchar_t
*
buff
=
reinterpret_cast
<
wchar_t
*>
(
malloc
(
nbytes
)
);
ZeroMemory
(
buff
,
nbytes
);
MsiGetProperty
(
hMSI
,
pPropName
,
buff
,
&
sz
);
*
ppValue
=
buff
;
return
TRUE
;
}
return
FALSE
;
}
//----------------------------------------------------------
BOOL
GetActiveXControlPath
(
MSIHANDLE
hMSI
,
char
**
ppActiveXPath
)
{
wchar_t
*
pProgPath
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
L"INSTALLLOCATION"
,
&
pProgPath
)
)
if
(
GetMsiProp
(
hMSI
,
L"INSTALLLOCATION"
,
&
pProgPath
)
&&
pProgPath
)
{
char
*
pCharProgPath
=
UnicodeToAnsiString
(
pProgPath
);
...
...
@@ -252,7 +271,7 @@ BOOL MakeInstallForAllUsers( MSIHANDLE hMSI )
{
BOOL
bResult
=
FALSE
;
wchar_t
*
pVal
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
L"ALLUSERS"
,
&
pVal
)
)
if
(
GetMsiProp
(
hMSI
,
L"ALLUSERS"
,
&
pVal
)
&&
pVal
)
{
bResult
=
UnicodeEquals
(
pVal
,
L"1"
);
free
(
pVal
);
...
...
@@ -266,7 +285,7 @@ BOOL MakeInstallFor64Bit( MSIHANDLE hMSI )
{
BOOL
bResult
=
FALSE
;
wchar_t
*
pVal
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
L"VersionNT64"
,
&
pVal
)
)
if
(
GetMsiProp
(
hMSI
,
L"VersionNT64"
,
&
pVal
)
&&
pVal
)
{
bResult
=
TRUE
;
free
(
pVal
);
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/regpatchactivex/regpatchactivex.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -23,7 +23,7 @@
#pragma warning(push,1) // disable warnings within system headers
#endif
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -32,14 +32,47 @@
#include <malloc.h>
#include <stdio.h>
//----------------------------------------------------------
BOOL
UnicodeEquals
(
wchar_t
*
pStr1
,
wchar_t
*
pStr2
)
{
if
(
pStr1
==
NULL
&&
pStr2
==
NULL
)
return
TRUE
;
else
if
(
pStr1
==
NULL
||
pStr2
==
NULL
)
return
FALSE
;
while
(
*
pStr1
==
*
pStr2
&&
*
pStr1
&&
*
pStr2
)
pStr1
++
,
pStr2
++
;
return
(
*
pStr1
==
0
&&
*
pStr2
==
0
);
}
//----------------------------------------------------------
BOOL
GetMsiProp
(
MSIHANDLE
hMSI
,
const
wchar_t
*
pPropName
,
wchar_t
**
ppValue
)
{
DWORD
sz
=
0
;
if
(
MsiGetProperty
(
hMSI
,
pPropName
,
L""
,
&
sz
)
==
ERROR_MORE_DATA
)
{
sz
++
;
DWORD
nbytes
=
sz
*
sizeof
(
wchar_t
);
wchar_t
*
buff
=
reinterpret_cast
<
wchar_t
*>
(
malloc
(
nbytes
)
);
ZeroMemory
(
buff
,
nbytes
);
MsiGetProperty
(
hMSI
,
pPropName
,
buff
,
&
sz
);
*
ppValue
=
buff
;
return
TRUE
;
}
return
FALSE
;
}
//----------------------------------------------------------
BOOL
MakeInstallForAllUsers
(
MSIHANDLE
hMSI
)
{
BOOL
bResult
=
FALSE
;
LPTSTR
*
pVal
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
TEXT
(
"ALLUSERS"
),
pVal
)
)
wchar_t
*
pVal
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
L"ALLUSERS"
,
&
pVal
)
&&
pVal
)
{
bResult
=
(
int
(
pVal
)
==
1
);
bResult
=
UnicodeEquals
(
pVal
,
L"1"
);
free
(
pVal
);
}
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/sellang/sellang.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -28,7 +28,7 @@
#define WINVER 0x0500
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#include <malloc.h>
#include <stdio.h>
...
...
@@ -40,6 +40,21 @@
#include "spellchecker_selection.hxx"
BOOL
GetMsiProp
(
MSIHANDLE
hMSI
,
const
char
*
pPropName
,
char
**
ppValue
)
{
DWORD
sz
=
0
;
if
(
MsiGetProperty
(
hMSI
,
pPropName
,
""
,
&
sz
)
==
ERROR_MORE_DATA
)
{
sz
++
;
DWORD
nbytes
=
sz
*
sizeof
(
char
);
char
*
buff
=
reinterpret_cast
<
char
*>
(
malloc
(
nbytes
)
);
ZeroMemory
(
buff
,
nbytes
);
MsiGetProperty
(
hMSI
,
pPropName
,
buff
,
&
sz
);
*
ppValue
=
buff
;
return
(
strlen
(
buff
)
>
0
);
}
return
FALSE
;
}
static
const
char
*
langid_to_string
(
LANGID
langid
)
{
...
...
@@ -299,8 +314,8 @@ extern "C" UINT __stdcall SelectLanguage( MSIHANDLE handle )
/* Keep track of what UI languages are relevant, either the ones explicitly
* requested with the UI_LANGS property, or all available on the system:
*/
LPTSTR
pVal
=
NULL
;
if
(
(
GetMsiProp
(
handle
,
"UI_LANGS"
,
&
pVal
))
)
{
char
*
pVal
=
NULL
;
if
(
(
GetMsiProp
(
handle
,
"UI_LANGS"
,
&
pVal
))
&&
pVal
)
{
char
*
str_ptr
;
str_ptr
=
strtok
(
pVal
,
","
);
for
(;
str_ptr
!=
NULL
;)
{
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/checkdirectory.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -24,7 +24,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -46,17 +46,44 @@
#include <systools/win32/uwinapi.h>
#include <../tools/seterror.hxx>
static
std
::
_tstring
GetMsiProperty
(
MSIHANDLE
handle
,
const
std
::
_tstring
&
sProperty
)
{
std
::
_tstring
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
static
void
UnsetMsiProperty
(
MSIHANDLE
handle
,
const
std
::
_tstring
&
sProperty
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
NULL
);
}
static
void
SetMsiProperty
(
MSIHANDLE
handle
,
const
std
::
_tstring
&
sProperty
,
const
std
::
_tstring
&
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
TEXT
(
"1"
));
}
extern
"C"
UINT
__stdcall
CheckInstallDirectory
(
MSIHANDLE
handle
)
{
std
::
_tstring
sInstallPath
=
GetMsiProp
Value
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
std
::
_tstring
sOfficeHostnamePath
=
GetMsiProp
Value
(
handle
,
TEXT
(
"OFFICEDIRHOSTNAME"
));
std
::
_tstring
sInstallPath
=
GetMsiProp
erty
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
std
::
_tstring
sOfficeHostnamePath
=
GetMsiProp
erty
(
handle
,
TEXT
(
"OFFICEDIRHOSTNAME"
));
// MessageBox(NULL, sInstallPath.c_str(), "DEBUG", MB_OK);
// unsetting all properties
MsiSetProperty
(
handle
,
TEXT
(
"DIRECTORY_NOT_EMPTY"
),
NULL
);
UnsetMsiProperty
(
handle
,
TEXT
(
"DIRECTORY_NOT_EMPTY"
)
);
// 1. Searching for file setup.ini
...
...
@@ -71,7 +98,7 @@ extern "C" UINT __stdcall CheckInstallDirectory(MSIHANDLE handle)
if
(
IsValidHandle
(
hdl
)
)
{
// setup.ini found -> directory cannot be used for installation.
MsiSet
Property
(
handle
,
TEXT
(
"DIRECTORY_NOT_EMPTY"
),
TEXT
(
"1"
)
);
SetMsi
Property
(
handle
,
TEXT
(
"DIRECTORY_NOT_EMPTY"
),
TEXT
(
"1"
)
);
SetMsiErrorCode
(
MSI_ERROR_DIRECTORY_NOT_EMPTY
);
// std::_tstring notEmptyStr = "Directory is not empty. Please choose another installation directory.";
// std::_tstring notEmptyTitle = "Directory not empty";
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/checkpatches.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -24,7 +24,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -63,24 +63,44 @@ static inline void OutputDebugStringFormat( LPCSTR, ... )
}
#endif
static
std
::
_tstring
GetMsiProperty
(
MSIHANDLE
handle
,
const
std
::
_tstring
&
sProperty
)
{
std
::
_tstring
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
static
void
SetMsiProperty
(
MSIHANDLE
handle
,
const
std
::
_tstring
&
sProperty
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
TEXT
(
"1"
)
);
}
extern
"C"
UINT
__stdcall
CheckPatchList
(
MSIHANDLE
handle
)
{
LPTSTR
sPatchList
=
NULL
;
LPTSTR
sRequiredPatch
=
NULL
;
std
::
_tstring
sPatchList
=
GetMsiProperty
(
handle
,
TEXT
(
"PATCH"
)
)
;
std
::
_tstring
sRequiredPatch
=
GetMsiProperty
(
handle
,
TEXT
(
"PREREQUIREDPATCH"
)
)
;
if
(
GetMsiProp
(
handle
,
TEXT
(
"PATCH"
),
&
sPatchList
)
&&
GetMsiProp
(
handle
,
TEXT
(
"PREREQUIREDPATCH"
),
&
sRequiredPatch
)
)
OutputDebugStringFormat
(
"CheckPatchList called with PATCH=%s and PRQ= %s
\n
"
,
sPatchList
.
c_str
(),
sRequiredPatch
.
c_str
()
);
if
(
(
sPatchList
.
length
()
!=
0
)
&&
(
sRequiredPatch
.
length
()
!=
0
)
)
{
OutputDebugStringFormat
(
"CheckPatchList called with PATCH=%s and PRQ= %s
\n
"
,
sPatchList
,
sRequiredPatch
);
if
(
_tcsstr
(
sPatchList
,
sRequiredPatch
)
)
if
(
_tcsstr
(
sPatchList
.
c_str
(),
sRequiredPatch
.
c_str
()
)
)
{
MsiSetProperty
(
handle
,
TEXT
(
"IGNOREPREREQUIREDPATCH"
),
TEXT
(
"1
"
)
);
SetMsiProperty
(
handle
,
TEXT
(
"IGNOREPREREQUIREDPATCH
"
)
);
OutputDebugStringFormat
(
"Set Property IgnorePrerequiredPatch!
\n
"
);
}
}
else
{
OutputDebugStringFormat
(
"CheckPatchList called with PATCH=%s and PRQ= %s
\n
"
,
sPatchList
,
sRequiredPatch
);
}
return
ERROR_SUCCESS
;
}
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -23,7 +23,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -41,6 +41,27 @@
using
namespace
std
;
namespace
{
std
::
_tstring
GetMsiProperty
(
MSIHANDLE
handle
,
const
std
::
_tstring
&
sProperty
)
{
std
::
_tstring
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
}
// namespace
extern
"C"
UINT
__stdcall
CompleteInstallPath
(
MSIHANDLE
handle
)
{
// This CustomAction is necessary for updates from OOo 3.0, OOo 3.1 and OOo 3.2 to versions
...
...
@@ -55,8 +76,8 @@ extern "C" UINT __stdcall CompleteInstallPath( MSIHANDLE handle )
// Reading property OFFICEDIRHOSTNAME_, that contains the part of the path behind
// the program files folder.
std
::
_tstring
sInstallLocation
=
GetMsiProp
Value
(
handle
,
TEXT
(
"INSTALLLOCATION"
)
);
std
::
_tstring
sOfficeDirHostname
=
GetMsiProp
Value
(
handle
,
TEXT
(
"OFFICEDIRHOSTNAME_"
)
);
std
::
_tstring
sInstallLocation
=
GetMsiProp
erty
(
handle
,
TEXT
(
"INSTALLLOCATION"
)
);
std
::
_tstring
sOfficeDirHostname
=
GetMsiProp
erty
(
handle
,
TEXT
(
"OFFICEDIRHOSTNAME_"
)
);
// If sInstallLocation ends with (contains) the string sOfficeDirHostname,
// INSTALLLOCATION is good and nothing has to be done here.
...
...
@@ -73,9 +94,9 @@ extern "C" UINT __stdcall CompleteInstallPath( MSIHANDLE handle )
if
(
pathCompletionRequired
)
{
std
::
_tstring
sManufacturer
=
GetMsiProp
Value
(
handle
,
TEXT
(
"Manufacturer"
)
);
std
::
_tstring
sDefinedName
=
GetMsiProp
Value
(
handle
,
TEXT
(
"DEFINEDPRODUCT"
)
);
std
::
_tstring
sUpgradeCode
=
GetMsiProp
Value
(
handle
,
TEXT
(
"UpgradeCode"
)
);
std
::
_tstring
sManufacturer
=
GetMsiProp
erty
(
handle
,
TEXT
(
"Manufacturer"
)
);
std
::
_tstring
sDefinedName
=
GetMsiProp
erty
(
handle
,
TEXT
(
"DEFINEDPRODUCT"
)
);
std
::
_tstring
sUpgradeCode
=
GetMsiProp
erty
(
handle
,
TEXT
(
"UpgradeCode"
)
);
// sUpdateVersion can be "3.0", "3.1" or "3.2"
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -28,7 +28,7 @@
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#include <shellapi.h>
#ifdef _MSC_VER
#pragma warning(pop)
...
...
@@ -48,9 +48,27 @@
#include <string>
static
std
::
_tstring
GetMsiProperty
(
MSIHANDLE
handle
,
const
std
::
_tstring
&
sProperty
)
{
std
::
_tstring
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
extern
"C"
UINT
__stdcall
copyExtensionData
(
MSIHANDLE
handle
)
{
std
::
_tstring
sSourceDir
=
GetMsiProp
Value
(
handle
,
TEXT
(
"SourceDir"
)
);
std
::
_tstring
sSourceDir
=
GetMsiProp
erty
(
handle
,
TEXT
(
"SourceDir"
)
);
std
::
_tstring
sExtensionDir
=
sSourceDir
+
TEXT
(
"extension
\\
"
);
std
::
_tstring
sPattern
=
sExtensionDir
+
TEXT
(
"*.oxt"
);
...
...
@@ -65,7 +83,7 @@ extern "C" UINT __stdcall copyExtensionData(MSIHANDLE handle) {
bool
fNextFile
=
false
;
bool
bFailIfExist
=
true
;
std
::
_tstring
sDestDir
=
GetMsiProp
Value
(
handle
,
TEXT
(
"INSTALLLOCATION"
)
);
std
::
_tstring
sDestDir
=
GetMsiProp
erty
(
handle
,
TEXT
(
"INSTALLLOCATION"
)
);
std
::
_tstring
sShareInstallDir
=
sDestDir
+
TEXT
(
"share
\\
extension
\\
install
\\
"
);
// creating directories
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -27,7 +27,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -45,6 +45,28 @@ using namespace std;
namespace
{
string
GetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
string
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
inline
void
SetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
,
const
string
&
sValue
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
sValue
.
c_str
());
}
void
stripFinalBackslash
(
std
::
string
*
path
)
{
std
::
string
::
size_type
i
=
path
->
size
();
if
(
i
>
1
)
{
...
...
@@ -104,20 +126,20 @@ Order compareVersions(string const & version1, string const & version2) {
}
// namespace
extern
"C"
UINT
__stdcall
DotNetCheck
(
MSIHANDLE
handle
)
{
string
present
(
GetMsiProp
Value
(
handle
,
TEXT
(
"MsiNetAssemblySupport"
)));
string
required
(
GetMsiProp
Value
(
handle
,
TEXT
(
"REQUIRED_DOTNET_VERSION"
)));
string
present
(
GetMsiProp
erty
(
handle
,
TEXT
(
"MsiNetAssemblySupport"
)));
string
required
(
GetMsiProp
erty
(
handle
,
TEXT
(
"REQUIRED_DOTNET_VERSION"
)));
// string myText1 = TEXT("MsiNetAssemblySupport: ") + present;
// string myText2 = TEXT("REQUIRED_DOTNET_VERSION: ") + required;
// MessageBox(NULL, myText1.c_str(), "DEBUG", MB_OK);
// MessageBox(NULL, myText2.c_str(), "DEBUG", MB_OK);
MsiSet
Property
(
SetMsi
Property
(
handle
,
TEXT
(
"DOTNET_SUFFICIENT"
),
(
present
.
empty
()
||
compareVersions
(
present
,
required
)
==
ORDER_LESS
?
TEXT
(
"0"
)
:
TEXT
(
"1"
)));
// string result(GetMsiProp
Value
(handle, TEXT("DOTNET_SUFFICIENT")));
// string result(GetMsiProp
erty
(handle, TEXT("DOTNET_SUFFICIENT")));
// string myText3 = TEXT("DOTNET_SUFFICIENT: ") + result;
// MessageBox(NULL, myText3.c_str(), "DEBUG", MB_OK);
...
...
@@ -127,23 +149,23 @@ extern "C" UINT __stdcall DotNetCheck(MSIHANDLE handle) {
extern
"C"
UINT
__stdcall
ShowProperties
(
MSIHANDLE
handle
)
{
string
property
=
GetMsiProp
Value
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
string
property
=
GetMsiProp
erty
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
string
myText
=
TEXT
(
"INSTALLLOCATION: "
)
+
property
;
MessageBox
(
NULL
,
myText
.
c_str
(),
"INSTALLLOCATION"
,
MB_OK
);
property
=
GetMsiProp
Value
(
handle
,
TEXT
(
"Installed"
));
property
=
GetMsiProp
erty
(
handle
,
TEXT
(
"Installed"
));
myText
=
TEXT
(
"Installed: "
)
+
property
;
MessageBox
(
NULL
,
myText
.
c_str
(),
"Installed"
,
MB_OK
);
property
=
GetMsiProp
Value
(
handle
,
TEXT
(
"PATCH"
));
property
=
GetMsiProp
erty
(
handle
,
TEXT
(
"PATCH"
));
myText
=
TEXT
(
"PATCH: "
)
+
property
;
MessageBox
(
NULL
,
myText
.
c_str
(),
"PATCH"
,
MB_OK
);
property
=
GetMsiProp
Value
(
handle
,
TEXT
(
"REMOVE"
));
property
=
GetMsiProp
erty
(
handle
,
TEXT
(
"REMOVE"
));
myText
=
TEXT
(
"REMOVE: "
)
+
property
;
MessageBox
(
NULL
,
myText
.
c_str
(),
"REMOVE"
,
MB_OK
);
property
=
GetMsiProp
Value
(
handle
,
TEXT
(
"ALLUSERS"
));
property
=
GetMsiProp
erty
(
handle
,
TEXT
(
"ALLUSERS"
));
myText
=
TEXT
(
"ALLUSERS: "
)
+
property
;
MessageBox
(
NULL
,
myText
.
c_str
(),
"ALLUSERS"
,
MB_OK
);
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/layerlinks.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -27,7 +27,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -45,6 +45,38 @@ using namespace std;
namespace
{
string
GetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
string
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
inline
bool
IsSetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
return
(
GetMsiProperty
(
handle
,
sProperty
).
length
()
>
0
);
}
inline
void
UnsetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
NULL
);
}
inline
void
SetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
,
const
string
&
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
TEXT
(
"1"
));
}
void
stripFinalBackslash
(
std
::
string
*
path
)
{
std
::
string
::
size_type
i
=
path
->
size
();
if
(
i
>
1
)
{
...
...
@@ -58,13 +90,13 @@ namespace
extern
"C"
UINT
__stdcall
CreateLayerLinks
(
MSIHANDLE
handle
)
{
string
sInstallPath
=
GetMsiProp
Value
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
string
sInstallPath
=
GetMsiProp
erty
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
string
sUreInstallPath
=
sInstallPath
+
TEXT
(
"URE"
);
string
sUreLinkPath
=
sInstallPath
+
TEXT
(
"ure-link"
);
if
(
GetMsiPropValue
(
handle
,
TEXT
(
"ADMININSTALL"
)).
length
()
>
0
)
if
(
IsSetMsiProperty
(
handle
,
TEXT
(
"ADMININSTALL"
))
)
{
sUreInstallPath
=
TEXT
(
"..
\\
URE"
);
}
...
...
@@ -117,7 +149,7 @@ extern "C" UINT __stdcall CreateLayerLinks(MSIHANDLE handle)
extern
"C"
UINT
__stdcall
RemoveLayerLinks
(
MSIHANDLE
handle
)
{
string
sInstallPath
=
GetMsiProp
Value
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
string
sInstallPath
=
GetMsiProp
erty
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
string
sUreLinkPath
=
sInstallPath
+
TEXT
(
"ure-link"
);
string
sUreDirName
=
sInstallPath
+
TEXT
(
"URE
\\
bin"
);
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -23,7 +23,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -41,6 +41,27 @@
using
namespace
std
;
namespace
{
std
::
_tstring
GetMsiProperty
(
MSIHANDLE
handle
,
const
std
::
_tstring
&
sProperty
)
{
std
::
_tstring
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
}
// namespace
extern
"C"
UINT
__stdcall
MigrateInstallPath
(
MSIHANDLE
handle
)
{
TCHAR
szValue
[
8192
];
...
...
@@ -48,10 +69,10 @@ extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle )
HKEY
hKey
;
std
::
_tstring
sInstDir
;
std
::
_tstring
sManufacturer
=
GetMsiProp
Value
(
handle
,
TEXT
(
"Manufacturer"
)
);
std
::
_tstring
sDefinedName
=
GetMsiProp
Value
(
handle
,
TEXT
(
"DEFINEDPRODUCT"
)
);
std
::
_tstring
sUpdateVersion
=
GetMsiProp
Value
(
handle
,
TEXT
(
"DEFINEDVERSION"
)
);
std
::
_tstring
sUpgradeCode
=
GetMsiProp
Value
(
handle
,
TEXT
(
"UpgradeCode"
)
);
std
::
_tstring
sManufacturer
=
GetMsiProp
erty
(
handle
,
TEXT
(
"Manufacturer"
)
);
std
::
_tstring
sDefinedName
=
GetMsiProp
erty
(
handle
,
TEXT
(
"DEFINEDPRODUCT"
)
);
std
::
_tstring
sUpdateVersion
=
GetMsiProp
erty
(
handle
,
TEXT
(
"DEFINEDVERSION"
)
);
std
::
_tstring
sUpgradeCode
=
GetMsiProp
erty
(
handle
,
TEXT
(
"UpgradeCode"
)
);
std
::
_tstring
sProductKey
=
"Software
\\
"
+
sManufacturer
+
"
\\
"
+
sDefinedName
+
"
\\
"
+
sUpdateVersion
+
"
\\
"
+
sUpgradeCode
;
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/postuninstall.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -23,7 +23,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -41,6 +41,25 @@
#include <io.h>
static
std
::
_tstring
GetMsiProperty
(
MSIHANDLE
handle
,
const
std
::
_tstring
&
sProperty
)
{
std
::
_tstring
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
static
BOOL
ExecuteCommand
(
LPCTSTR
lpCommand
,
BOOL
bSync
)
{
BOOL
fSuccess
=
FALSE
;
...
...
@@ -82,7 +101,7 @@ extern "C" UINT __stdcall ExecutePostUninstallScript( MSIHANDLE handle )
HKEY
hKey
;
std
::
_tstring
sInstDir
;
std
::
_tstring
sProductKey
=
GetMsiProp
Value
(
handle
,
TEXT
(
"FINDPRODUCT"
)
);
std
::
_tstring
sProductKey
=
GetMsiProp
erty
(
handle
,
TEXT
(
"FINDPRODUCT"
)
);
// MessageBox( NULL, sProductKey.c_str(), "Titel", MB_OK );
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/setadmininstall.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -24,7 +24,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -53,7 +53,7 @@ static void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty)
extern
"C"
UINT
__stdcall
SetAdminInstallProperty
(
MSIHANDLE
handle
)
{
MsiSetProperty
(
handle
,
TEXT
(
"ADMININSTALL"
),
TEXT
(
"1
"
));
SetMsiProperty
(
handle
,
TEXT
(
"ADMININSTALL
"
));
return
ERROR_SUCCESS
;
}
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -24,25 +24,50 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include <malloc.h>
#ifdef UNICODE
#define _UNICODE
#define _tstring wstring
#else
#define _tstring string
#endif
#include <tchar.h>
#include <string>
std
::
_tstring
GetMsiProperty
(
MSIHANDLE
handle
,
const
std
::
_tstring
&
sProperty
)
{
std
::
_tstring
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
/*
Called during installation to customize the start menu folder icon.
See: http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/custom.asp
*/
extern
"C"
UINT
__stdcall
InstallStartmenuFolderIcon
(
MSIHANDLE
handle
)
{
std
::
string
sOfficeMenuFolder
=
GetMsiPropValue
(
handle
,
TEXT
(
"OfficeMenuFolder"
)
);
std
::
string
sDesktopFile
=
sOfficeMenuFolder
+
TEXT
(
"Desktop.ini"
);
std
::
string
sIconFile
=
GetMsiPropValue
(
handle
,
TEXT
(
"INSTALLLOCATION"
)
)
+
TEXT
(
"program
\\
soffice.exe"
);
std
::
_tstring
sOfficeMenuFolder
=
GetMsiProperty
(
handle
,
TEXT
(
"OfficeMenuFolder"
)
);
std
::
_tstring
sDesktopFile
=
sOfficeMenuFolder
+
TEXT
(
"Desktop.ini"
);
std
::
_tstring
sIconFile
=
GetMsiProperty
(
handle
,
TEXT
(
"INSTALLLOCATION"
)
)
+
TEXT
(
"program
\\
soffice.exe"
);
OSVERSIONINFO
osverinfo
;
osverinfo
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFO
);
...
...
@@ -84,8 +109,8 @@ extern "C" UINT __stdcall InstallStartmenuFolderIcon( MSIHANDLE handle )
extern
"C"
UINT
__stdcall
DeinstallStartmenuFolderIcon
(
MSIHANDLE
handle
)
{
std
::
string
sOfficeMenuFolder
=
GetMsiPropValue
(
handle
,
TEXT
(
"OfficeMenuFolder"
)
);
std
::
string
sDesktopFile
=
sOfficeMenuFolder
+
TEXT
(
"Desktop.ini"
);
std
::
_tstring
sOfficeMenuFolder
=
GetMsiProperty
(
handle
,
TEXT
(
"OfficeMenuFolder"
)
);
std
::
_t
string
sDesktopFile
=
sOfficeMenuFolder
+
TEXT
(
"Desktop.ini"
);
SetFileAttributes
(
sDesktopFile
.
c_str
(),
FILE_ATTRIBUTE_NORMAL
);
DeleteFile
(
sDesktopFile
.
c_str
()
);
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/upgrade.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -27,7 +27,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -111,6 +111,38 @@ namespace
return
convertedGuid
;
}
string
GetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
string
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
inline
bool
IsSetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
return
(
GetMsiProperty
(
handle
,
sProperty
).
length
()
>
0
);
}
inline
void
UnsetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
NULL
);
}
inline
void
SetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
TEXT
(
"1"
));
}
bool
RegistryKeyHasUpgradeSubKey
(
HKEY
hRootKey
,
const
string
&
regKey
,
const
string
&
upgradeKey
)
{
...
...
@@ -139,7 +171,7 @@ namespace
extern
"C"
UINT
__stdcall
SetProductInstallMode
(
MSIHANDLE
handle
)
{
string
upgradeCode
=
GetMsiProp
Value
(
handle
,
TEXT
(
"UpgradeCode"
));
string
upgradeCode
=
GetMsiProp
erty
(
handle
,
TEXT
(
"UpgradeCode"
));
upgradeCode
=
ConvertGuid
(
string
(
upgradeCode
.
c_str
()
+
1
,
upgradeCode
.
length
()
-
2
));
//MessageBox(NULL, upgradeCode.c_str(), TEXT("Debug"), MB_OK);
...
...
@@ -147,17 +179,17 @@ extern "C" UINT __stdcall SetProductInstallMode(MSIHANDLE handle)
if
(
RegistryKeyHasUpgradeSubKey
(
HKEY_CURRENT_USER
,
TEXT
(
"Software
\\
Microsoft
\\
Installer
\\
UpgradeCodes"
),
upgradeCode
))
upgradeCode
)
&&
IsSetMsiProperty
(
handle
,
TEXT
(
"ALLUSERS"
))
)
{
MsiSetProperty
(
handle
,
TEXT
(
"ALLUSERS"
),
NULL
);
UnsetMsiProperty
(
handle
,
TEXT
(
"ALLUSERS"
)
);
//MessageBox(NULL, "ALLUSERS removed", "DEBUG", MB_OK);
}
else
if
(
RegistryKeyHasUpgradeSubKey
(
HKEY_LOCAL_MACHINE
,
TEXT
(
"Software
\\
Classes
\\
Installer
\\
UpgradeCodes"
),
upgradeCode
))
upgradeCode
)
&&
!
IsSetMsiProperty
(
handle
,
TEXT
(
"ALLUSERS"
))
)
{
MsiSetProperty
(
handle
,
TEXT
(
"ALLUSERS"
),
TEXT
(
"1
"
));
SetMsiProperty
(
handle
,
TEXT
(
"ALLUSERS
"
));
//MessageBox(NULL, "ALLUSERS set", "DEBUG", MB_OK);
}
return
ERROR_SUCCESS
;
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -24,7 +24,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -65,7 +65,25 @@ static inline void OutputDebugStringFormat( LPCSTR, ... )
#endif
static
bool
RemoveCompleteDirectory
(
std
::
_tstring
sPath
)
static
std
::
_tstring
GetMsiProperty
(
MSIHANDLE
handle
,
const
std
::
_tstring
&
sProperty
)
{
std
::
_tstring
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
static
BOOL
RemoveCompleteDirectory
(
std
::
_tstring
sPath
)
{
bool
bDirectoryRemoved
=
true
;
...
...
@@ -125,7 +143,7 @@ static bool RemoveCompleteDirectory( std::_tstring sPath )
extern
"C"
UINT
__stdcall
RenamePrgFolder
(
MSIHANDLE
handle
)
{
std
::
_tstring
sOfficeInstallPath
=
GetMsiProp
Value
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
std
::
_tstring
sOfficeInstallPath
=
GetMsiProp
erty
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
std
::
_tstring
sRenameSrc
=
sOfficeInstallPath
+
TEXT
(
"program"
);
std
::
_tstring
sRenameDst
=
sOfficeInstallPath
+
TEXT
(
"program_old"
);
...
...
@@ -149,7 +167,7 @@ extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle )
extern
"C"
UINT
__stdcall
RemovePrgFolder
(
MSIHANDLE
handle
)
{
std
::
_tstring
sOfficeInstallPath
=
GetMsiProp
Value
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
std
::
_tstring
sOfficeInstallPath
=
GetMsiProp
erty
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
std
::
_tstring
sRemoveDir
=
sOfficeInstallPath
+
TEXT
(
"program_old"
);
RemoveCompleteDirectory
(
sRemoveDir
);
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/thesaurus/thesaurus.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -23,7 +23,7 @@
#define WINVER 0x0500
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#include <malloc.h>
#include <stdio.h>
...
...
@@ -43,6 +43,38 @@ using namespace std;
namespace
{
string
GetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
string
result
;
TCHAR
szDummy
[
1
]
=
TEXT
(
""
);
DWORD
nChars
=
0
;
if
(
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
szDummy
,
&
nChars
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
nChars
*
sizeof
(
TCHAR
);
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
handle
,
sProperty
.
c_str
(),
buffer
,
&
nChars
);
result
=
buffer
;
}
return
result
;
}
inline
bool
IsSetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
return
(
GetMsiProperty
(
handle
,
sProperty
).
length
()
>
0
);
}
inline
void
UnsetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
NULL
);
}
inline
void
SetMsiProperty
(
MSIHANDLE
handle
,
const
string
&
sProperty
,
const
string
&
)
{
MsiSetProperty
(
handle
,
sProperty
.
c_str
(),
TEXT
(
"1"
));
}
static
const
int
MAXLINE
=
1024
*
64
;
...
...
@@ -161,7 +193,7 @@ namespace
extern
"C"
UINT
__stdcall
CreateIndexes
(
MSIHANDLE
handle
)
{
string
sOfficeInstallPath
=
GetMsiProp
Value
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
string
sOfficeInstallPath
=
GetMsiProp
erty
(
handle
,
TEXT
(
"INSTALLLOCATION"
));
createIndexesForThesaurusFiles
(
sOfficeInstallPath
);
return
ERROR_SUCCESS
;
}
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/tools/checkversion.cxx
Dosyayı görüntüle @
55fc2b96
...
...
@@ -23,7 +23,7 @@
#pragma warning(push,1) // disable warnings within system headers
#endif
#include <windows.h>
#include <
../tools/msiprop.hxx
>
#include <
msiquery.h
>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
...
...
@@ -35,6 +35,25 @@
#include <seterror.hxx>
//----------------------------------------------------------
BOOL
GetMsiProp
(
MSIHANDLE
hMSI
,
const
wchar_t
*
pPropName
,
wchar_t
**
ppValue
)
{
DWORD
sz
=
0
;
if
(
MsiGetProperty
(
hMSI
,
pPropName
,
L""
,
&
sz
)
==
ERROR_MORE_DATA
)
{
sz
++
;
DWORD
nbytes
=
sz
*
sizeof
(
wchar_t
);
wchar_t
*
buff
=
reinterpret_cast
<
wchar_t
*>
(
malloc
(
nbytes
)
);
ZeroMemory
(
buff
,
nbytes
);
MsiGetProperty
(
hMSI
,
pPropName
,
buff
,
&
sz
);
*
ppValue
=
buff
;
return
TRUE
;
}
return
FALSE
;
}
//----------------------------------------------------------
#ifdef DEBUG
inline
void
OutputDebugStringFormat
(
LPCTSTR
pFormat
,
...
)
...
...
@@ -59,7 +78,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
wchar_t
*
pVal
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
L"NEWPRODUCTS"
,
&
pVal
)
)
if
(
GetMsiProp
(
hMSI
,
L"NEWPRODUCTS"
,
&
pVal
)
&&
pVal
)
{
OutputDebugStringFormat
(
TEXT
(
"DEBUG: NEWPRODUCTS found [%s]"
),
pVal
);
if
(
*
pVal
!=
0
)
...
...
@@ -67,7 +86,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free
(
pVal
);
}
pVal
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
L"SAMEPRODUCTS"
,
&
pVal
)
)
if
(
GetMsiProp
(
hMSI
,
L"SAMEPRODUCTS"
,
&
pVal
)
&&
pVal
)
{
OutputDebugStringFormat
(
TEXT
(
"DEBUG: SAMEPRODUCTS found [%s]"
),
pVal
);
if
(
*
pVal
!=
0
)
...
...
@@ -75,7 +94,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free
(
pVal
);
}
pVal
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
L"OLDPRODUCTS"
,
&
pVal
)
)
if
(
GetMsiProp
(
hMSI
,
L"OLDPRODUCTS"
,
&
pVal
)
&&
pVal
)
{
OutputDebugStringFormat
(
TEXT
(
"DEBUG: OLDPRODUCTS found [%s]"
),
pVal
);
if
(
*
pVal
!=
0
)
...
...
@@ -83,7 +102,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free
(
pVal
);
}
pVal
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
L"BETAPRODUCTS"
,
&
pVal
)
)
if
(
GetMsiProp
(
hMSI
,
L"BETAPRODUCTS"
,
&
pVal
)
&&
pVal
)
{
OutputDebugStringFormat
(
TEXT
(
"DEBUG: BETAPRODUCTS found [%s]"
),
pVal
);
if
(
*
pVal
!=
0
)
...
...
@@ -92,7 +111,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
}
pVal
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
L"NEWPRODUCTSPATCH"
,
&
pVal
)
)
if
(
GetMsiProp
(
hMSI
,
L"NEWPRODUCTSPATCH"
,
&
pVal
)
&&
pVal
)
{
OutputDebugStringFormat
(
TEXT
(
"DEBUG: NEWPRODUCTSPATCH found [%s]"
),
pVal
);
if
(
*
pVal
!=
0
)
...
...
@@ -100,7 +119,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free
(
pVal
);
}
pVal
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
L"SAMEPRODUCTSPATCH"
,
&
pVal
)
)
if
(
GetMsiProp
(
hMSI
,
L"SAMEPRODUCTSPATCH"
,
&
pVal
)
&&
pVal
)
{
OutputDebugStringFormat
(
TEXT
(
"DEBUG: SAMEPRODUCTSPATCH found [%s]"
),
pVal
);
if
(
*
pVal
!=
0
)
...
...
@@ -108,7 +127,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free
(
pVal
);
}
pVal
=
NULL
;
if
(
GetMsiProp
(
hMSI
,
L"OLDPRODUCTSPATCH"
,
&
pVal
)
)
if
(
GetMsiProp
(
hMSI
,
L"OLDPRODUCTSPATCH"
,
&
pVal
)
&&
pVal
)
{
OutputDebugStringFormat
(
TEXT
(
"DEBUG: OLDPRODUCTSPATCH found [%s]"
),
pVal
);
if
(
*
pVal
!=
0
)
...
...
This diff is collapsed.
Click to expand it.
setup_native/source/win32/customactions/tools/msiprop.hxx
deleted
100755 → 0
Dosyayı görüntüle @
2d70b928
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include <windows.h>
#include <string>
//#include <malloc.h>
#include <msiquery.h>
#ifdef UNICODE
#define _UNICODE
#define _tstring wstring
#else
#define _tstring string
#endif
using
namespace
std
;
namespace
{
inline
bool
GetMsiProp
(
MSIHANDLE
hMSI
,
LPCTSTR
pPropName
,
LPTSTR
*
ppValue
)
{
DWORD
sz
=
0
;
ppValue
=
NULL
;
if
(
MsiGetProperty
(
hMSI
,
pPropName
,
TEXT
(
""
),
&
sz
)
==
ERROR_MORE_DATA
)
{
DWORD
nBytes
=
++
sz
*
sizeof
(
TCHAR
);
// add 1 for null termination
LPTSTR
buffer
=
reinterpret_cast
<
LPTSTR
>
(
_alloca
(
nBytes
));
ZeroMemory
(
buffer
,
nBytes
);
MsiGetProperty
(
hMSI
,
pPropName
,
buffer
,
&
sz
);
*
ppValue
=
buffer
;
}
return
ppValue
?
true
:
false
;
}
//std::_tstring GMPV( , const std::_tstring& sProperty)
inline
string
GetMsiPropValue
(
MSIHANDLE
hMSI
,
LPCTSTR
pPropName
)
{
LPTSTR
ppValue
=
NULL
;
(
void
)
GetMsiProp
(
hMSI
,
pPropName
,
&
ppValue
);
string
toto
=
reinterpret_cast
<
const
char
*>
(
ppValue
);
return
toto
;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment