Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
c3ab871f
Commit
c3ab871f
authored
Mar 24, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
Mar 24, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up registry functions.
parent
6b379fb2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
88 deletions
+58
-88
registry.c
dlls/msi/registry.c
+58
-88
No files found.
dlls/msi/registry.c
View file @
c3ab871f
...
@@ -134,6 +134,8 @@ static const WCHAR szInstaller_UpgradeCodes_fmt[] = {
...
@@ -134,6 +134,8 @@ static const WCHAR szInstaller_UpgradeCodes_fmt[] = {
'U'
,
'p'
,
'g'
,
'r'
,
'a'
,
'd'
,
'e'
,
'C'
,
'o'
,
'd'
,
'e'
,
's'
,
'\\'
,
'U'
,
'p'
,
'g'
,
'r'
,
'a'
,
'd'
,
'e'
,
'C'
,
'o'
,
'd'
,
'e'
,
's'
,
'\\'
,
'%'
,
's'
,
0
};
'%'
,
's'
,
0
};
#define SQUISH_GUID_SIZE 33
BOOL
unsquash_guid
(
LPCWSTR
in
,
LPWSTR
out
)
BOOL
unsquash_guid
(
LPCWSTR
in
,
LPWSTR
out
)
{
{
DWORD
i
,
n
=
0
;
DWORD
i
,
n
=
0
;
...
@@ -496,16 +498,16 @@ UINT WINAPI MsiDecomposeDescriptorA( LPCSTR szDescriptor, LPSTR szProduct,
...
@@ -496,16 +498,16 @@ UINT WINAPI MsiDecomposeDescriptorA( LPCSTR szDescriptor, LPSTR szProduct,
WCHAR
feature
[
MAX_FEATURE_CHARS
+
1
];
WCHAR
feature
[
MAX_FEATURE_CHARS
+
1
];
WCHAR
component
[
MAX_FEATURE_CHARS
+
1
];
WCHAR
component
[
MAX_FEATURE_CHARS
+
1
];
LPWSTR
str
=
NULL
;
LPWSTR
str
=
NULL
;
UINT
r
,
len
;
UINT
r
;
TRACE
(
"%s %p %p %p %p
\n
"
,
debugstr_a
(
szDescriptor
),
szProduct
,
TRACE
(
"%s %p %p %p %p
\n
"
,
debugstr_a
(
szDescriptor
),
szProduct
,
szFeature
,
szComponent
,
pUsed
);
szFeature
,
szComponent
,
pUsed
);
if
(
szDescriptor
)
if
(
szDescriptor
)
{
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szDescriptor
,
-
1
,
NULL
,
0
);
str
=
strdupAtoW
(
szDescriptor
);
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
!
str
)
MultiByteToWideChar
(
CP_ACP
,
0
,
szDescriptor
,
-
1
,
str
,
len
)
;
return
ERROR_OUTOFMEMORY
;
}
}
r
=
MsiDecomposeDescriptorW
(
str
,
product
,
feature
,
component
,
pUsed
);
r
=
MsiDecomposeDescriptorW
(
str
,
product
,
feature
,
component
,
pUsed
);
...
@@ -542,7 +544,7 @@ UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid)
...
@@ -542,7 +544,7 @@ UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid)
{
{
HKEY
hkeyFeatures
=
0
;
HKEY
hkeyFeatures
=
0
;
DWORD
r
;
DWORD
r
;
WCHAR
szKeyName
[
33
];
WCHAR
szKeyName
[
SQUISH_GUID_SIZE
];
TRACE
(
"%ld %p
\n
"
,
index
,
lpguid
);
TRACE
(
"%ld %p
\n
"
,
index
,
lpguid
);
...
@@ -551,16 +553,12 @@ UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid)
...
@@ -551,16 +553,12 @@ UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid)
r
=
MSIREG_OpenFeatures
(
&
hkeyFeatures
);
r
=
MSIREG_OpenFeatures
(
&
hkeyFeatures
);
if
(
r
!=
ERROR_SUCCESS
)
if
(
r
!=
ERROR_SUCCESS
)
goto
end
;
return
ERROR_NO_MORE_ITEMS
;
r
=
RegEnumKeyW
(
hkeyFeatures
,
index
,
szKeyName
,
GUID_SIZE
);
unsquash_guid
(
szKeyName
,
lpguid
);
end:
r
=
RegEnumKeyW
(
hkeyFeatures
,
index
,
szKeyName
,
SQUISH_GUID_SIZE
);
if
(
r
==
ERROR_SUCCESS
)
if
(
hkeyFeatures
)
unsquash_guid
(
szKeyName
,
lpguid
);
RegCloseKey
(
hkeyFeatures
);
RegCloseKey
(
hkeyFeatures
);
return
r
;
return
r
;
}
}
...
@@ -576,12 +574,9 @@ UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index,
...
@@ -576,12 +574,9 @@ UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index,
if
(
szProduct
)
if
(
szProduct
)
{
{
UINT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szProduct
,
-
1
,
NULL
,
0
);
szwProduct
=
strdupAtoW
(
szProduct
);
szwProduct
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
!
szwProduct
)
if
(
szwProduct
)
return
ERROR_OUTOFMEMORY
;
MultiByteToWideChar
(
CP_ACP
,
0
,
szProduct
,
-
1
,
szwProduct
,
len
);
else
return
ERROR_FUNCTION_FAILED
;
}
}
r
=
MsiEnumFeaturesW
(
szwProduct
,
index
,
szwFeature
,
szwParent
);
r
=
MsiEnumFeaturesW
(
szwProduct
,
index
,
szwFeature
,
szwParent
);
...
@@ -608,14 +603,11 @@ UINT WINAPI MsiEnumFeaturesW(LPCWSTR szProduct, DWORD index,
...
@@ -608,14 +603,11 @@ UINT WINAPI MsiEnumFeaturesW(LPCWSTR szProduct, DWORD index,
r
=
MSIREG_OpenFeaturesKey
(
szProduct
,
&
hkeyProduct
,
FALSE
);
r
=
MSIREG_OpenFeaturesKey
(
szProduct
,
&
hkeyProduct
,
FALSE
);
if
(
r
!=
ERROR_SUCCESS
)
if
(
r
!=
ERROR_SUCCESS
)
goto
end
;
return
ERROR_NO_MORE_ITEMS
;
sz
=
GUID_SIZE
;
sz
=
GUID_SIZE
;
r
=
RegEnumValueW
(
hkeyProduct
,
index
,
szFeature
,
&
sz
,
NULL
,
NULL
,
NULL
,
NULL
);
r
=
RegEnumValueW
(
hkeyProduct
,
index
,
szFeature
,
&
sz
,
NULL
,
NULL
,
NULL
,
NULL
);
RegCloseKey
(
hkeyProduct
);
end:
if
(
hkeyProduct
)
RegCloseKey
(
hkeyProduct
);
return
r
;
return
r
;
}
}
...
@@ -638,22 +630,18 @@ UINT WINAPI MsiEnumComponentsW(DWORD index, LPWSTR lpguid)
...
@@ -638,22 +630,18 @@ UINT WINAPI MsiEnumComponentsW(DWORD index, LPWSTR lpguid)
{
{
HKEY
hkeyComponents
=
0
;
HKEY
hkeyComponents
=
0
;
DWORD
r
;
DWORD
r
;
WCHAR
szKeyName
[
33
];
WCHAR
szKeyName
[
SQUISH_GUID_SIZE
];
TRACE
(
"%ld %p
\n
"
,
index
,
lpguid
);
TRACE
(
"%ld %p
\n
"
,
index
,
lpguid
);
r
=
MSIREG_OpenComponents
(
&
hkeyComponents
);
r
=
MSIREG_OpenComponents
(
&
hkeyComponents
);
if
(
r
!=
ERROR_SUCCESS
)
if
(
r
!=
ERROR_SUCCESS
)
goto
end
;
return
ERROR_NO_MORE_ITEMS
;
r
=
RegEnumKeyW
(
hkeyComponents
,
index
,
szKeyName
,
GUID_SIZE
);
unsquash_guid
(
szKeyName
,
lpguid
);
r
=
RegEnumKeyW
(
hkeyComponents
,
index
,
szKeyName
,
SQUISH_GUID_SIZE
);
if
(
r
==
ERROR_SUCCESS
)
end:
unsquash_guid
(
szKeyName
,
lpguid
);
RegCloseKey
(
hkeyComponents
);
if
(
hkeyComponents
)
RegCloseKey
(
hkeyComponents
);
return
r
;
return
r
;
}
}
...
@@ -668,12 +656,9 @@ UINT WINAPI MsiEnumClientsA(LPCSTR szComponent, DWORD index, LPSTR szProduct)
...
@@ -668,12 +656,9 @@ UINT WINAPI MsiEnumClientsA(LPCSTR szComponent, DWORD index, LPSTR szProduct)
if
(
szComponent
)
if
(
szComponent
)
{
{
UINT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szComponent
,
-
1
,
NULL
,
0
);
szwComponent
=
strdupAtoW
(
szComponent
);
szwComponent
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
!
szwComponent
)
if
(
szwComponent
)
return
ERROR_OUTOFMEMORY
;
MultiByteToWideChar
(
CP_ACP
,
0
,
szComponent
,
-
1
,
szwComponent
,
len
);
else
return
ERROR_FUNCTION_FAILED
;
}
}
r
=
MsiEnumClientsW
(
szComponent
?
szwComponent
:
NULL
,
index
,
szwProduct
);
r
=
MsiEnumClientsW
(
szComponent
?
szwComponent
:
NULL
,
index
,
szwProduct
);
...
@@ -692,24 +677,20 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct)
...
@@ -692,24 +677,20 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct)
{
{
HKEY
hkeyComp
=
0
;
HKEY
hkeyComp
=
0
;
DWORD
r
,
sz
;
DWORD
r
,
sz
;
WCHAR
szValName
[
GUID_SIZE
];
WCHAR
szValName
[
SQUISH_
GUID_SIZE
];
TRACE
(
"%s %ld %p
\n
"
,
debugstr_w
(
szComponent
),
index
,
szProduct
);
TRACE
(
"%s %ld %p
\n
"
,
debugstr_w
(
szComponent
),
index
,
szProduct
);
r
=
MSIREG_OpenComponentsKey
(
szComponent
,
&
hkeyComp
,
FALSE
);
r
=
MSIREG_OpenComponentsKey
(
szComponent
,
&
hkeyComp
,
FALSE
);
if
(
r
!=
ERROR_SUCCESS
)
if
(
r
!=
ERROR_SUCCESS
)
goto
end
;
return
ERROR_NO_MORE_ITEMS
;
sz
=
GUID_SIZE
;
sz
=
SQUISH_
GUID_SIZE
;
r
=
RegEnumValueW
(
hkeyComp
,
index
,
szValName
,
&
sz
,
NULL
,
NULL
,
NULL
,
NULL
);
r
=
RegEnumValueW
(
hkeyComp
,
index
,
szValName
,
&
sz
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
r
!=
ERROR_SUCCESS
)
if
(
r
==
ERROR_SUCCESS
)
goto
end
;
unsquash_guid
(
szValName
,
szProduct
);
unsquash_guid
(
szValName
,
szProduct
);
end:
RegCloseKey
(
hkeyComp
);
if
(
hkeyComp
)
RegCloseKey
(
hkeyComp
);
return
r
;
return
r
;
}
}
...
@@ -737,9 +718,9 @@ UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex,
...
@@ -737,9 +718,9 @@ UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex,
UINT
WINAPI
MsiEnumRelatedProductsW
(
LPCWSTR
szUpgradeCode
,
DWORD
dwReserved
,
UINT
WINAPI
MsiEnumRelatedProductsW
(
LPCWSTR
szUpgradeCode
,
DWORD
dwReserved
,
DWORD
iProductIndex
,
LPWSTR
lpProductBuf
)
DWORD
iProductIndex
,
LPWSTR
lpProductBuf
)
{
{
UINT
r
c
;
UINT
r
;
HKEY
hkey
;
HKEY
hkey
;
WCHAR
szKeyName
[
33
];
WCHAR
szKeyName
[
SQUISH_GUID_SIZE
];
TRACE
(
"%s %lu %lu %p
\n
"
,
debugstr_w
(
szUpgradeCode
),
dwReserved
,
TRACE
(
"%s %lu %lu %p
\n
"
,
debugstr_w
(
szUpgradeCode
),
dwReserved
,
iProductIndex
,
lpProductBuf
);
iProductIndex
,
lpProductBuf
);
...
@@ -748,54 +729,43 @@ UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR szUpgradeCode, DWORD dwReserved,
...
@@ -748,54 +729,43 @@ UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR szUpgradeCode, DWORD dwReserved,
return
ERROR_INVALID_PARAMETER
;
return
ERROR_INVALID_PARAMETER
;
if
(
NULL
==
lpProductBuf
)
if
(
NULL
==
lpProductBuf
)
return
ERROR_INVALID_PARAMETER
;
return
ERROR_INVALID_PARAMETER
;
rc
=
MSIREG_OpenUpgradeCodesKey
(
szUpgradeCode
,
&
hkey
,
FALSE
);
if
(
rc
!=
ERROR_SUCCESS
)
{
rc
=
ERROR_NO_MORE_ITEMS
;
goto
end
;
}
rc
=
RegEnumKeyW
(
hkey
,
iProductIndex
,
szKeyName
,
r
=
MSIREG_OpenUpgradeCodesKey
(
szUpgradeCode
,
&
hkey
,
FALSE
);
sizeof
(
szKeyName
)
/
sizeof
(
szKeyName
[
0
]));
if
(
r
!=
ERROR_SUCCESS
)
return
ERROR_NO_MORE_ITEMS
;
unsquash_guid
(
szKeyName
,
lpProductBuf
);
r
=
RegEnumKeyW
(
hkey
,
iProductIndex
,
szKeyName
,
SQUISH_GUID_SIZE
);
if
(
r
==
ERROR_SUCCESS
)
unsquash_guid
(
szKeyName
,
lpProductBuf
);
RegCloseKey
(
hkey
);
RegCloseKey
(
hkey
);
end:
return
r
;
return
rc
;
}
}
UINT
WINAPI
MsiEnumRelatedProductsA
(
LPCSTR
szUpgradeCode
,
DWORD
dwReserved
,
UINT
WINAPI
MsiEnumRelatedProductsA
(
LPCSTR
szUpgradeCode
,
DWORD
dwReserved
,
DWORD
iProductIndex
,
LPSTR
lpProductBuf
)
DWORD
iProductIndex
,
LPSTR
lpProductBuf
)
{
{
UINT
rc
;
LPWSTR
szwUpgradeCode
=
NULL
;
int
len
;
WCHAR
productW
[
GUID_SIZE
]
;
LPWSTR
szUpgradeCodeW
=
NULL
;
UINT
r
;
TRACE
(
"%s %lu %lu %p
\n
"
,
debugstr_a
(
szUpgradeCode
),
dwReserved
,
TRACE
(
"%s %lu %lu %p
\n
"
,
debugstr_a
(
szUpgradeCode
),
dwReserved
,
iProductIndex
,
lpProductBuf
);
iProductIndex
,
lpProductBuf
);
if
(
!
szUpgradeCode
)
return
ERROR_INVALID_PARAMETER
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szUpgradeCode
,
-
1
,
NULL
,
0
);
szUpgradeCodeW
=
(
LPWSTR
)
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
szUpgradeCodeW
)
{
WCHAR
productW
[
39
];
MultiByteToWideChar
(
CP_ACP
,
0
,
szUpgradeCode
,
-
1
,
szUpgradeCodeW
,
len
);
if
(
szUpgradeCode
)
rc
=
MsiEnumRelatedProductsW
(
szUpgradeCodeW
,
dwReserved
,
{
iProductIndex
,
productW
);
szwUpgradeCode
=
strdupAtoW
(
szUpgradeCode
);
if
(
rc
==
ERROR_SUCCESS
)
if
(
!
szwUpgradeCode
)
{
return
ERROR_OUTOFMEMORY
;
LPWSTR
ptr
;
}
for
(
ptr
=
productW
;
*
ptr
;
)
r
=
MsiEnumRelatedProductsW
(
szwUpgradeCode
,
dwReserved
,
*
lpProductBuf
++
=
*
ptr
++
;
iProductIndex
,
productW
);
}
if
(
r
==
ERROR_SUCCESS
)
HeapFree
(
GetProcessHeap
(),
0
,
szUpgradeCodeW
);
{
WideCharToMultiByte
(
CP_ACP
,
0
,
productW
,
GUID_SIZE
,
lpProductBuf
,
GUID_SIZE
,
NULL
,
NULL
);
}
}
else
HeapFree
(
GetProcessHeap
(),
0
,
szwUpgradeCode
);
rc
=
ERROR_OUTOFMEMORY
;
return
r
;
return
rc
;
}
}
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