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
ca3ad7d6
Commit
ca3ad7d6
authored
Mar 22, 2006
by
James Hawkins
Committed by
Alexandre Julliard
Mar 23, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advpack: Forward AddDelBackupEntryA to its unicode counterpart.
parent
dc8e564f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
16 deletions
+77
-16
advpack.spec
dlls/advpack/advpack.spec
+1
-1
files.c
dlls/advpack/files.c
+76
-15
No files found.
dlls/advpack/advpack.spec
View file @
ca3ad7d6
@ stdcall AddDelBackupEntryA(str str str long)
#
stdcall AddDelBackupEntryW(wstr wstr wstr long)
@
stdcall AddDelBackupEntryW(wstr wstr wstr long)
@ stdcall AddDelBackupEntry(str str str long) AddDelBackupEntryA
@ stdcall AdvInstallFileA(long str str str str long long)
# stdcall AdvInstallFileW(long wstr wstr wstr wstr long long)
...
...
dlls/advpack/files.c
View file @
ca3ad7d6
...
...
@@ -26,15 +26,70 @@
#include "winuser.h"
#include "winreg.h"
#include "winver.h"
#include "winternl.h"
#include "setupapi.h"
#include "advpub.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
advpack
);
/* converts an ansi double null-terminated list to a unicode list */
static
LPWSTR
ansi_to_unicode_list
(
LPCSTR
ansi_list
)
{
DWORD
len
,
wlen
=
0
;
LPWSTR
list
;
LPCSTR
ptr
=
ansi_list
;
while
(
*
ptr
)
ptr
+=
lstrlenA
(
ptr
)
+
1
;
len
=
ptr
+
1
-
ansi_list
;
wlen
=
MultiByteToWideChar
(
CP_ACP
,
0
,
ansi_list
,
len
,
NULL
,
0
);
list
=
HeapAlloc
(
GetProcessHeap
(),
0
,
wlen
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
ansi_list
,
len
,
list
,
wlen
);
return
list
;
}
/***********************************************************************
* AddDelBackupEntryA (ADVPACK.@)
*
* See AddDelBackupEntryW.
*/
HRESULT
WINAPI
AddDelBackupEntryA
(
LPCSTR
lpcszFileList
,
LPCSTR
lpcszBackupDir
,
LPCSTR
lpcszBaseName
,
DWORD
dwFlags
)
{
UNICODE_STRING
backupdir
,
basename
;
LPWSTR
filelist
,
backup
;
HRESULT
res
;
TRACE
(
"(%p, %p, %p, %ld)
\n
"
,
lpcszFileList
,
lpcszBackupDir
,
lpcszBaseName
,
dwFlags
);
if
(
lpcszFileList
)
filelist
=
ansi_to_unicode_list
(
lpcszFileList
);
else
filelist
=
NULL
;
RtlCreateUnicodeStringFromAsciiz
(
&
backupdir
,
lpcszBackupDir
);
RtlCreateUnicodeStringFromAsciiz
(
&
basename
,
lpcszBaseName
);
if
(
lpcszBackupDir
)
backup
=
backupdir
.
Buffer
;
else
backup
=
NULL
;
res
=
AddDelBackupEntryW
(
filelist
,
backup
,
basename
.
Buffer
,
dwFlags
);
HeapFree
(
GetProcessHeap
(),
0
,
filelist
);
RtlFreeUnicodeString
(
&
backupdir
);
RtlFreeUnicodeString
(
&
basename
);
return
res
;
}
/***********************************************************************
* AddDelBackupEntryW (ADVPACK.@)
*
* Either appends the files in the file list to the backup section of
* the specified INI, or deletes the entries from the INI file.
*
...
...
@@ -56,13 +111,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(advpack);
* If lpcszBackupDir is NULL, the INI file is assumed to exist in
* c:\windows or created there if it does not exist.
*/
HRESULT
WINAPI
AddDelBackupEntry
A
(
LPCSTR
lpcszFileList
,
LPC
STR
lpcszBackupDir
,
LPC
STR
lpcszBaseName
,
DWORD
dwFlags
)
HRESULT
WINAPI
AddDelBackupEntry
W
(
LPCWSTR
lpcszFileList
,
LPCW
STR
lpcszBackupDir
,
LPCW
STR
lpcszBaseName
,
DWORD
dwFlags
)
{
CHAR
szIniPath
[
MAX_PATH
];
LPSTR
szString
=
NULL
;
W
CHAR
szIniPath
[
MAX_PATH
];
LP
W
STR
szString
=
NULL
;
const
char
szBackupEntry
[]
=
"-1,0,0,0,0,0,-1"
;
static
const
WCHAR
szBackupEntry
[]
=
{
'-'
,
'1'
,
','
,
'0'
,
','
,
'0'
,
','
,
'0'
,
','
,
'0'
,
','
,
'0'
,
','
,
'-'
,
'1'
,
0
};
static
const
WCHAR
backslash
[]
=
{
'\\'
,
0
};
static
const
WCHAR
ini
[]
=
{
'.'
,
'i'
,
'n'
,
'i'
,
0
};
static
const
WCHAR
backup
[]
=
{
'b'
,
'a'
,
'c'
,
'k'
,
'u'
,
'p'
,
0
};
TRACE
(
"(%p, %p, %p, %ld)
\n
"
,
lpcszFileList
,
lpcszBackupDir
,
lpcszBaseName
,
dwFlags
);
...
...
@@ -71,30 +132,30 @@ HRESULT WINAPI AddDelBackupEntryA(LPCSTR lpcszFileList, LPCSTR lpcszBackupDir,
return
S_OK
;
if
(
lpcszBackupDir
)
lstrcpy
A
(
szIniPath
,
lpcszBackupDir
);
lstrcpy
W
(
szIniPath
,
lpcszBackupDir
);
else
GetWindowsDirectory
A
(
szIniPath
,
MAX_PATH
);
GetWindowsDirectory
W
(
szIniPath
,
MAX_PATH
);
lstrcat
A
(
szIniPath
,
"
\\
"
);
lstrcat
A
(
szIniPath
,
lpcszBaseName
);
lstrcat
A
(
szIniPath
,
".ini"
);
lstrcat
W
(
szIniPath
,
backslash
);
lstrcat
W
(
szIniPath
,
lpcszBaseName
);
lstrcat
W
(
szIniPath
,
ini
);
SetFileAttributes
A
(
szIniPath
,
FILE_ATTRIBUTE_NORMAL
);
SetFileAttributes
W
(
szIniPath
,
FILE_ATTRIBUTE_NORMAL
);
if
(
dwFlags
&
AADBE_ADD_ENTRY
)
szString
=
(
LPSTR
)
szBackupEntry
;
szString
=
(
LP
W
STR
)
szBackupEntry
;
else
if
(
dwFlags
&
AADBE_DEL_ENTRY
)
szString
=
NULL
;
/* add or delete the INI entries */
while
(
*
lpcszFileList
)
{
WritePrivateProfileString
A
(
"backup"
,
lpcszFileList
,
szString
,
szIniPath
);
lpcszFileList
+=
lstrlen
A
(
lpcszFileList
)
+
1
;
WritePrivateProfileString
W
(
backup
,
lpcszFileList
,
szString
,
szIniPath
);
lpcszFileList
+=
lstrlen
W
(
lpcszFileList
)
+
1
;
}
/* hide the INI file */
SetFileAttributes
A
(
szIniPath
,
FILE_ATTRIBUTE_READONLY
|
FILE_ATTRIBUTE_HIDDEN
);
SetFileAttributes
W
(
szIniPath
,
FILE_ATTRIBUTE_READONLY
|
FILE_ATTRIBUTE_HIDDEN
);
return
S_OK
;
}
...
...
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