Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
7a041d52
Commit
7a041d52
authored
Dec 24, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
appwiz.cpl: Convert the application list to a standard Wine list.
parent
2f9927b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
79 deletions
+54
-79
appwiz.c
dlls/appwiz.cpl/appwiz.c
+54
-79
No files found.
dlls/appwiz.cpl/appwiz.c
View file @
7a041d52
...
...
@@ -27,8 +27,6 @@
#include "config.h"
#include "wine/port.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include <string.h>
#include <stdlib.h>
...
...
@@ -44,6 +42,9 @@
#include <commdlg.h>
#include <cpl.h>
#include "wine/unicode.h"
#include "wine/list.h"
#include "wine/debug.h"
#include "appwiz.h"
#include "res.h"
...
...
@@ -52,7 +53,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(appwizcpl);
/* define a maximum length for various buffers we use */
#define MAX_STRING_LEN 1024
typedef
struct
APPINFO
{
typedef
struct
APPINFO
{
struct
list
entry
;
int
id
;
LPWSTR
title
;
...
...
@@ -67,11 +70,9 @@ typedef struct APPINFO {
HKEY
regroot
;
WCHAR
regkey
[
MAX_STRING_LEN
];
struct
APPINFO
*
next
;
}
APPINFO
;
static
struct
APPINFO
*
AppInfo
=
NULL
;
static
struct
list
app_list
=
LIST_INIT
(
app_list
)
;
HINSTANCE
hInst
;
static
WCHAR
btnRemove
[
MAX_STRING_LEN
];
...
...
@@ -131,19 +132,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
*/
static
void
FreeAppInfo
(
APPINFO
*
info
)
{
while
(
info
)
{
APPINFO
*
next_info
=
info
->
next
;
HeapFree
(
GetProcessHeap
(),
0
,
info
->
title
);
HeapFree
(
GetProcessHeap
(),
0
,
info
->
path
);
HeapFree
(
GetProcessHeap
(),
0
,
info
->
path_modify
);
HeapFree
(
GetProcessHeap
(),
0
,
info
->
icon
);
HeapFree
(
GetProcessHeap
(),
0
,
info
->
publisher
);
HeapFree
(
GetProcessHeap
(),
0
,
info
->
version
);
HeapFree
(
GetProcessHeap
(),
0
,
info
);
info
=
next_info
;
}
HeapFree
(
GetProcessHeap
(),
0
,
info
->
title
);
HeapFree
(
GetProcessHeap
(),
0
,
info
->
path
);
HeapFree
(
GetProcessHeap
(),
0
,
info
->
path_modify
);
HeapFree
(
GetProcessHeap
(),
0
,
info
->
icon
);
HeapFree
(
GetProcessHeap
(),
0
,
info
->
publisher
);
HeapFree
(
GetProcessHeap
(),
0
,
info
->
version
);
HeapFree
(
GetProcessHeap
(),
0
,
info
);
}
/******************************************************************************
...
...
@@ -162,7 +157,7 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
WCHAR
subKeyName
[
256
];
WCHAR
key_app
[
MAX_STRING_LEN
];
WCHAR
*
p
,
*
command
;
APPINFO
*
i
ter
=
AppInfo
;
APPINFO
*
i
nfo
=
NULL
;
LPWSTR
iconPtr
;
BOOL
ret
=
FALSE
;
...
...
@@ -176,12 +171,6 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
sizeOfSubKeyName
=
sizeof
(
subKeyName
)
/
sizeof
(
subKeyName
[
0
]);
if
(
iter
)
{
/* find the end of the list */
for
(
iter
=
AppInfo
;
iter
->
next
;
iter
=
iter
->
next
);
}
for
(
i
=
0
;
RegEnumKeyExW
(
hkeyUninst
,
i
,
subKeyName
,
&
sizeOfSubKeyName
,
NULL
,
NULL
,
NULL
,
NULL
)
!=
ERROR_NO_MORE_ITEMS
;
++
i
)
{
...
...
@@ -213,33 +202,15 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
continue
;
}
/* if we already have iter, allocate the next entry */
if
(
iter
)
{
iter
->
next
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
APPINFO
));
info
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
APPINFO
));
if
(
!
info
)
goto
err
;
if
(
!
iter
->
next
)
goto
err
;
iter
=
iter
->
next
;
}
else
{
/* if not, start the list */
iter
=
AppInfo
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
APPINFO
));
info
->
title
=
HeapAlloc
(
GetProcessHeap
(),
0
,
displen
);
if
(
!
iter
)
goto
err
;
}
iter
->
title
=
HeapAlloc
(
GetProcessHeap
(),
0
,
displen
);
if
(
!
iter
->
title
)
if
(
!
info
->
title
)
goto
err
;
RegQueryValueExW
(
hkeyApp
,
DisplayNameW
,
0
,
0
,
(
LPBYTE
)
i
ter
->
title
,
RegQueryValueExW
(
hkeyApp
,
DisplayNameW
,
0
,
0
,
(
LPBYTE
)
i
nfo
->
title
,
&
displen
);
/* now get DisplayIcon */
...
...
@@ -247,24 +218,24 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
RegQueryValueExW
(
hkeyApp
,
DisplayIconW
,
0
,
0
,
NULL
,
&
displen
);
if
(
displen
==
0
)
i
ter
->
icon
=
0
;
i
nfo
->
icon
=
0
;
else
{
i
ter
->
icon
=
HeapAlloc
(
GetProcessHeap
(),
0
,
displen
);
i
nfo
->
icon
=
HeapAlloc
(
GetProcessHeap
(),
0
,
displen
);
if
(
!
i
ter
->
icon
)
if
(
!
i
nfo
->
icon
)
goto
err
;
RegQueryValueExW
(
hkeyApp
,
DisplayIconW
,
0
,
0
,
(
LPBYTE
)
i
ter
->
icon
,
RegQueryValueExW
(
hkeyApp
,
DisplayIconW
,
0
,
0
,
(
LPBYTE
)
i
nfo
->
icon
,
&
displen
);
/* separate the index from the icon name, if supplied */
iconPtr
=
strchrW
(
i
ter
->
icon
,
','
);
iconPtr
=
strchrW
(
i
nfo
->
icon
,
','
);
if
(
iconPtr
)
{
*
iconPtr
++
=
0
;
i
ter
->
iconIdx
=
atoiW
(
iconPtr
);
i
nfo
->
iconIdx
=
atoiW
(
iconPtr
);
}
}
...
...
@@ -272,24 +243,24 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
if
(
RegQueryValueExW
(
hkeyApp
,
PublisherW
,
0
,
0
,
NULL
,
&
displen
)
==
ERROR_SUCCESS
)
{
i
ter
->
publisher
=
HeapAlloc
(
GetProcessHeap
(),
0
,
displen
);
i
nfo
->
publisher
=
HeapAlloc
(
GetProcessHeap
(),
0
,
displen
);
if
(
!
i
ter
->
publisher
)
if
(
!
i
nfo
->
publisher
)
goto
err
;
RegQueryValueExW
(
hkeyApp
,
PublisherW
,
0
,
0
,
(
LPBYTE
)
i
ter
->
publisher
,
RegQueryValueExW
(
hkeyApp
,
PublisherW
,
0
,
0
,
(
LPBYTE
)
i
nfo
->
publisher
,
&
displen
);
}
if
(
RegQueryValueExW
(
hkeyApp
,
DisplayVersionW
,
0
,
0
,
NULL
,
&
displen
)
==
ERROR_SUCCESS
)
{
i
ter
->
version
=
HeapAlloc
(
GetProcessHeap
(),
0
,
displen
);
i
nfo
->
version
=
HeapAlloc
(
GetProcessHeap
(),
0
,
displen
);
if
(
!
i
ter
->
version
)
if
(
!
i
nfo
->
version
)
goto
err
;
RegQueryValueExW
(
hkeyApp
,
DisplayVersionW
,
0
,
0
,
(
LPBYTE
)
i
ter
->
version
,
RegQueryValueExW
(
hkeyApp
,
DisplayVersionW
,
0
,
0
,
(
LPBYTE
)
i
nfo
->
version
,
&
displen
);
}
...
...
@@ -304,10 +275,9 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
dwNoModify
=
0
;
}
/* Some installers incorrectly create a REG_SZ instead of a REG_DWORD - check for
ASCII 49, which equals 1 */
/* Some installers incorrectly create a REG_SZ instead of a REG_DWORD */
if
(
dwType
==
REG_SZ
)
dwNoModify
=
(
dwNoModify
==
49
)
?
1
:
0
;
dwNoModify
=
(
*
(
BYTE
*
)
&
dwNoModify
==
'1'
)
;
/* Fetch the modify path */
if
(
!
dwNoModify
)
...
...
@@ -318,22 +288,23 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
static
const
WCHAR
fmtW
[]
=
{
'm'
,
's'
,
'i'
,
'e'
,
'x'
,
'e'
,
'c'
,
' '
,
'/'
,
'i'
,
'%'
,
's'
,
0
};
int
len
=
lstrlenW
(
fmtW
)
+
lstrlenW
(
subKeyName
);
if
(
!
(
i
ter
->
path_modify
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
))))
goto
err
;
wsprintfW
(
i
ter
->
path_modify
,
fmtW
,
subKeyName
);
if
(
!
(
i
nfo
->
path_modify
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
))))
goto
err
;
wsprintfW
(
i
nfo
->
path_modify
,
fmtW
,
subKeyName
);
}
else
if
(
!
RegQueryValueExW
(
hkeyApp
,
ModifyPathW
,
0
,
0
,
NULL
,
&
displen
))
{
if
(
!
(
i
ter
->
path_modify
=
HeapAlloc
(
GetProcessHeap
(),
0
,
displen
)))
goto
err
;
RegQueryValueExW
(
hkeyApp
,
ModifyPathW
,
0
,
0
,
(
LPBYTE
)
i
ter
->
path_modify
,
&
displen
);
if
(
!
(
i
nfo
->
path_modify
=
HeapAlloc
(
GetProcessHeap
(),
0
,
displen
)))
goto
err
;
RegQueryValueExW
(
hkeyApp
,
ModifyPathW
,
0
,
0
,
(
LPBYTE
)
i
nfo
->
path_modify
,
&
displen
);
}
}
/* registry key */
i
ter
->
regroot
=
root
;
lstrcpyW
(
i
ter
->
regkey
,
subKeyName
);
i
ter
->
path
=
command
;
i
nfo
->
regroot
=
root
;
lstrcpyW
(
i
nfo
->
regkey
,
subKeyName
);
i
nfo
->
path
=
command
;
iter
->
id
=
id
++
;
info
->
id
=
id
++
;
list_add_tail
(
&
app_list
,
&
info
->
entry
);
}
RegCloseKey
(
hkeyApp
);
...
...
@@ -345,7 +316,7 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
err:
RegCloseKey
(
hkeyApp
);
FreeAppInfo
(
iter
);
if
(
info
)
FreeAppInfo
(
info
);
end:
RegCloseKey
(
hkeyUninst
);
...
...
@@ -365,7 +336,7 @@ static void AddApplicationsToList(HWND hWnd, HIMAGELIST hList)
HICON
hIcon
;
int
index
;
for
(
iter
=
AppInfo
;
iter
;
iter
=
iter
->
next
)
LIST_FOR_EACH_ENTRY
(
iter
,
&
app_list
,
APPINFO
,
entry
)
{
if
(
!
iter
->
title
[
0
])
continue
;
...
...
@@ -412,8 +383,12 @@ static void RemoveItemsFromList(HWND hWnd)
*/
static
inline
void
EmptyList
(
void
)
{
FreeAppInfo
(
AppInfo
);
AppInfo
=
NULL
;
APPINFO
*
info
,
*
next
;
LIST_FOR_EACH_ENTRY_SAFE
(
info
,
next
,
&
app_list
,
APPINFO
,
entry
)
{
list_remove
(
&
info
->
entry
);
FreeAppInfo
(
info
);
}
}
/******************************************************************************
...
...
@@ -437,7 +412,7 @@ static void UpdateButtons(HWND hWnd)
if
(
SendDlgItemMessageW
(
hWnd
,
IDL_PROGRAMS
,
LVM_GETITEMW
,
0
,
(
LPARAM
)
&
lvItem
))
{
for
(
iter
=
AppInfo
;
iter
;
iter
=
iter
->
next
)
LIST_FOR_EACH_ENTRY
(
iter
,
&
app_list
,
APPINFO
,
entry
)
{
if
(
iter
->
id
==
lvItem
.
lParam
)
{
...
...
@@ -524,7 +499,7 @@ static void UninstallProgram(int id, DWORD button)
LoadStringW
(
hInst
,
IDS_UNINSTALL_FAILED
,
sUninstallFailed
,
sizeof
(
sUninstallFailed
)
/
sizeof
(
sUninstallFailed
[
0
]));
for
(
iter
=
AppInfo
;
iter
;
iter
=
iter
->
next
)
LIST_FOR_EACH_ENTRY
(
iter
,
&
app_list
,
APPINFO
,
entry
)
{
if
(
iter
->
id
==
id
)
{
...
...
@@ -626,7 +601,7 @@ static BOOL CALLBACK SupportInfoDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
switch
(
msg
)
{
case
WM_INITDIALOG
:
for
(
iter
=
AppInfo
;
iter
;
iter
=
iter
->
next
)
LIST_FOR_EACH_ENTRY
(
iter
,
&
app_list
,
APPINFO
,
entry
)
{
if
(
iter
->
id
==
(
int
)
lParam
)
{
...
...
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