Compare commits

...

57 Commits

Author SHA1 Message Date
winesync
ed539a7636 [WINESYNC]: setupapi is now in sync with wine-staging wine-8.15 2023-10-03 18:15:28 +02:00
winesync
4526e7e08a [WINESYNC] setupapi: ImplementSetupAddSectionToDiskSpaceList.
wine-staging patch by Michael Müller <michael@fds-team.de>
2023-10-03 18:15:27 +02:00
winesync
d3aa91663d [WINESYNC] setupapi: Use CRT functions for memory allocation where possible.
The big win here is getting rid of the reimplementation of wcsdup.

wine commit id c293cd781fb4b330b7d93171501134f86a5138b8 by Alex Henrie <alexhenrie24@gmail.com>
2023-10-03 18:15:27 +02:00
winesync
3f15023934 [WINESYNC] setupapi: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id e498e0ec9bf5a3f9cdb965f8668888697ac642ae by Eric Pouech <eric.pouech@gmail.com>
2023-10-03 18:15:26 +02:00
winesync
fc54e289b7 [WINESYNC] setupapi: Use the source path if the target path is missing in SetupQueueRename().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 47111ff6b08dc019456d0f3c910a924deb1267d2 by Zebediah Figura <zfigura@codeweavers.com>
2023-10-03 18:15:25 +02:00
winesync
4af2403e22 [WINESYNC] setupapi: Use correct integral type.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id fd8d0babe1ba8efde1d5a251deee43994d2d8eec by Eric Pouech <eric.pouech@gmail.com>
2023-10-03 18:15:25 +02:00
winesync
e1fa50b773 [WINESYNC] setupapi: Handle NULL source filename in build_filepathsW.
Source filename is NULL for files to be deleted.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id fac1e40aaf0726a3e328a922cb496927548190cf by Hans Leidekker <hans@codeweavers.com>
2023-10-03 18:15:24 +02:00
winesync
f93ddb4085 [WINESYNC] setupapi: Add an extension to support file copies from module resources.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 5696c3c23d5be9f5ce57ef7e361d88722120da09 by Alexandre Julliard <julliard@winehq.org>

NOTE: This commit is a Wine-specific feature, that does not exist in
Windows, and should not exist in ReactOS either: surrounded in __WINESRC__.
2023-10-03 18:15:23 +02:00
winesync
88d2ebed04 [WINESYNC] setupapi: Implement SP_COPY_IN_USE_NEEDS_REBOOT.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=36059
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 87b2af73baf3cc26fe5ed135cbd6ed494a9003be by Michael Müller <michael@fds-team.de>

+ Adaptation for ReactOS-specific code: the temporary file is already
  created because of the LZOpenFileW steps from above, introduced by
  commit e0e3c56ec (r68659), so we can directly call
  MoveFileExW(..., MOVEFILE_DELAY_UNTIL_REBOOT);
  with suitable parameters.

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2023-10-03 18:15:23 +02:00
Hermès Bélusca-Maïto
db708a955b [SETUPAPI] Use wide character string literals in ReactOS-specific code too. 2023-10-03 18:15:22 +02:00
winesync
2fb1294673 [WINESYNC] setupapi: Use wide character string literals.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 32a2cde6c187ac3805303929a16c12d4412df832 by Alexandre Julliard <julliard@winehq.org>
2023-10-03 18:15:22 +02:00
winesync
6ae132d680 [WINESYNC] setupapi: Handle copy errors in SetupCommitFileQueueW().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id b3abc343c373ee5fd0764a3ceedeef52589c0ab2 by Alexandre Julliard <julliard@winehq.org>
2023-10-03 18:15:21 +02:00
winesync
6357b9dbc3 [WINESYNC] setupapi: Fix handling of FILEOP_SKIP from the SPFILENOTIFY_STARTCOPY callback.
Fixes a regression introduced by 3e5c9798a80641e0e39e95e4467c60405b22b062.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47436
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id a431b4b54a36b49821cae363d7ea8733eefe62ef by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:15:20 +02:00
winesync
63901e1e31 [WINESYNC] setupapi: Fix an uninitialized variable warning (Valgrind).
Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id ecbd2dd34b4239318162242caaa197ae4f0911f5 by Sven Baars <sven.wine@gmail.com>
2023-10-03 18:15:20 +02:00
winesync
d396b4a092 [WINESYNC] setupapi: Fix a path leak (Valgrind).
Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 5f0d53e20903b009ee47a238a642f2e95f27d712 by Sven Baars <sven.wine@gmail.com>
2023-10-03 18:15:19 +02:00
winesync
15cbdf1dd8 [WINESYNC] setupapi: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 72d6759f3a86c24e2db0b6190f4d2fae642e487f by Alexandre Julliard <julliard@winehq.org>
2023-10-03 18:15:18 +02:00
winesync
fe5d20311f [WINESYNC] setupapi: Don't fail a queued copy if no copy was necessary.
This fixes a regression introduced by 3e5c9798a80641e0e39e95e4467c60405b22b062.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47219
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 8bc25b24af0276985ad080c8364c11cfff3a1fe5 by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:15:18 +02:00
winesync
eeeb7b76bd [WINESYNC] setupapi: Clear the Win32 error if no copy was necessary.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id a748f685a502891bc8fa5f4719f80b6feb39ac9c by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:15:17 +02:00
winesync
dd8855fed0 [WINESYNC] setupapi: Retrieve the default destination path in SetupInstallFile().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id d5f6d6419b16ef81ce882f01a318189251320fcb by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:15:16 +02:00
winesync
5c6b3c96e6 [WINESYNC] setupapi: Handle an empty string for the source file in SetupQueueCopySection().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47185
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 86724af01241b257a4b4b39682031c9c7a3aaeaa by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:15:08 +02:00
winesync
ad46d59658 [WINESYNC] setupapi: Add magic bytes to struct file_queue and validate them in SetupCloseFileQueue().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=12332
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id c65d98065c0038e0919f40bec4a9dc978fb2ade9 by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:47 +02:00
winesync
b90e00d977 [WINESYNC] setupapi: Implement source media path resolution.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47107
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 3e5c9798a80641e0e39e95e4467c60405b22b062 by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:46 +02:00
winesync
fb66d44a59 [WINESYNC] setupapi: Use the source file name if the destination file name is NULL.
Do not do the reverse. Windows crashes if SourceFilename is NULL.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id cfe4ce28ebc0f381eb2f561ad3111eef71505546 by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:46 +02:00
winesync
9dca8ec700 [WINESYNC] setupapi: Properly null-terminate the path in concat_W().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id db8e2388d940f908db009f34f620da1ac8b46d07 by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:45 +02:00
winesync
cf5bd24450 [WINESYNC] setupapi: Implement W -> A mapping of SPFILENOTIFY_NEEDMEDIA.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id e8c4dbcec21d9b65cb680c6c773e560f761d42f8 by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:44 +02:00
winesync
8fdc1ad627 [WINESYNC] setupapi: Implement SetupDefaultQueueCallback(SPFILENOTIFY_NEEDMEDIA).
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 46dc6dddf3d1ef02aa773d0e25c121b8643d4bba by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:43 +02:00
winesync
a6b04495a6 [WINESYNC] setupapi: Keep track of source media in a separate list.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 31bb0097ad85090b1e006ade020c68aa5582dc0c by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:43 +02:00
winesync
889c7e60dd [WINESYNC] setupapi: Separate the entire copy operation into a helper function.
So as to centralize SPFILENOTIFY_COPYERROR callbacks into one place.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 3cb621e6ca78064adeb2415bf3467e476e9eba6a by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:42 +02:00
winesync
956cadf34c ** SKIPPED COMMIT **
[WINESYNC] setupapi: Remove implementation for LayoutInf parameter of SP_FILE_COPY_PARAMS.

Tests demonstrate that the existing implementation is not correct, and I was
unable to find an arrangement of parameters such that it was respected on
Windows. Most likely it has to do with the undocumented parameters used in
the "master" C:\windows\inf\layout.inf.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id ee36f923c59d9ba51b429247df90e0ed30592e62 by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:41 +02:00
winesync
5294cf1289 [WINESYNC] setupapi: Implement SetupQueueCopyIndirectA() on top of the W variant.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 466b80786fbf7ced695358af3ee87302ed00eb1b by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:40 +02:00
winesync
845bff885a [WINESYNC] setupapi: Fill out all source file parameters in SetupQueueDefaultCopy().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 705d3eed86f3ff96ee1190dbc694148c21c4939c by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:40 +02:00
winesync
86f3b6a42e [WINESYNC] setupapi: Fill out all source file parameters in SetupQueueCopySection().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id f9f25ee227a60c335ea8767e8b09d2f3bc3d53f7 by Zebediah Figura <z.figura12@gmail.com>
2023-10-03 18:06:39 +02:00
winesync
cfcf9aa436 [WINESYNC] setupapi: Extract individual files from cabinets.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id fccb7552ebe81ea2c0c17bc747a920f90e2537a5 by Zebediah Figura <z.figura12@gmail.com>

NOTE: Already committed in ReactOS in commit 5c8ec78b7 (PR #5233).
2023-10-03 18:06:38 +02:00
winesync
089cb6ef8c [WINESYNC] setupapi: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id d33f06746050984c622366ffbc19219ec1f5aa7d by Michael Stefaniuc <mstefani@winehq.org>
2023-10-03 18:06:37 +02:00
winesync
f8bb73dc2e [WINESYNC] setupapi: Remove dead code (Clang).
Signed-off-by: André Hentschel <nerv@dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 9edfb14c6be13f599aafe5e300986f10e6fb999d by André Hentschel <nerv@dawncrow.de>

NOTE: Already committed in ReactOS in commit cd73072e5 (r72565)
2023-10-03 18:06:37 +02:00
winesync
2d8d92011b [WINESYNC] setupapi: Make default context structure layout compatible.
wine commit id dcab5fe61bed87b291901ceff686894a64871d98 by Nikolay Sivov <nsivov@codeweavers.com>
2023-10-03 18:06:36 +02:00
winesync
8b35e9820e [WINESYNC] setupapi: Avoid memory leaks (coverity).
wine commit id 4d796458d0ed517d45adc57a1aedaf1c3bdde232 by André Hentschel <nerv@dawncrow.de>
2023-10-03 18:06:35 +02:00
winesync
1e2b01fc94 [WINESYNC] setupapi: Avoid hardcoding the Unicode string literal lengths.
wine commit id 9097fa132e56cc542fa3ea77706fea79353d2f4a by Francois Gouget <fgouget@free.fr>
2023-10-03 18:06:35 +02:00
winesync
49128cb35c [WINESYNC] setupapi: Destination directory defaults to system directory.
wine commit id 1b8ba2537111f0d691d2592bb4ffb6bc4fe4f20e by Hans Leidekker <hans@codeweavers.com>
2023-10-03 18:06:34 +02:00
winesync
a90d1056c2 [WINESYNC] setupapi: Fix memory leak.
Found by Valgrind.

wine commit id 63231be8044441218fb82899e748900e1ace3d0d by Huw Davies <huw@codeweavers.com>

NOTE: Some of the code was already present as part of ReactOS-specific
changes. It has been slightly adapted to suit Wine changes.

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2023-10-03 18:06:33 +02:00
winesync
8c082605da [WINESYNC] setupapi: Remove superfluous pointer casts.
wine commit id ffae0123ac46ba6dfac74d7c84422073fd53b580 by Michael Stefaniuc <mstefani@redhat.de>
2023-10-03 18:06:32 +02:00
winesync
2231ba3ce5 [WINESYNC] setupapi: Implement SetupInstallFileExA/W.
wine commit id bd9c265cc26a4cf2c9141a99dadb2f9ccf4b6f8c by Hans Leidekker <hans@codeweavers.com>
2023-10-03 18:06:32 +02:00
winesync
fd1ef5d59a [WINESYNC] setupapi: Implement SetupInstallFile{A, W}.
wine commit id 19764fcf4c7c05d5badbef54be64170c2ebadd83 by Hans Leidekker <hans@codeweavers.com>

NOTE: Already committed in ReactOS in commit 336ef53fa (r37876).
The lost memory cleanup on failure will be recovered by wine commit
4d796458d0ed517d45adc57a1aedaf1c3bdde232
2023-10-03 18:04:02 +02:00
winesync
487b0d5c45 [WINESYNC] setupapi: Remove unneeded address-of operator from array name.
wine commit id ce2184e2f14e6ace87cd50c938b5e99d35ca80c1 by Andrew Talbot <andrew.talbot@talbotville.com>
2023-10-03 17:23:22 +02:00
winesync
007e5540ac [WINESYNC] setupapi: Move strdupW and strdupWtoA to the setupapi_private.h header.
wine commit id 44ab294e0b6f285f1aab5fc8533a36e852be38fa by Alexandre Julliard <julliard@winehq.org>
2023-10-03 17:23:21 +02:00
Hermès Bélusca-Maïto
a38a84cffd [WINESYNC] Initial bootstrap for setupapi queue.c partial sync.
Start sync at wine-0.9.59

Start sync at wine commit 44ab294e0b6f285f1aab5fc8533a36e852be38fa
"setupapi: Move strdupW and strdupWtoA to the setupapi_private.h header."
by Alexandre Julliard, April 16, 2008
2023-10-03 17:23:20 +02:00
Hermès Bélusca-Maïto
a76268972b [SETUPAPI] Prepare for partial Wine sync.
- Add __REACTOS__ for ReactOS-specific copied files security descriptor support.
- Add missing __REACTOS__ guard + restoring original wine code in CopyFileW call.

- Remove erroneous casts: input parameters are already strings.
  Revert unnecessary changes from commit fc10b038f (r16937).
2023-10-03 17:23:02 +02:00
Hermès Bélusca-Maïto
db61749e48 [WINESYNC] For staging patches: Simplify patch directory usage; Fix the path shown in the warning message.
The staging patch path in the warning message didn't show the correct
sub-directory where the patch resides.
2023-09-26 22:38:19 +02:00
Hermès Bélusca-Maïto
836303199c [WINESYNC] When initially reverting wine-staging patches, ignore whitespace.
This fixes in particular problems when reverting created new files (i.e.
they are deleted). I suspect this is due to an endline-format "expectation"
from the git apply command.
2023-09-26 22:38:18 +02:00
Hermès Bélusca-Maïto
9f44998093 [WINESYNC] Use the same 'winesync' author as for all the other commits the script generates.
This now correctly sets the commit author as 'winesync' (before it was
the committer's developer name) for the following types of commits:

`[WINESYNC]: revert wine-staging patchset for <MODULE_NAME>`

and

`[WINESYNC]: <MODULE_NAME> is now in sync with wine-staging <WINE_TAG>`
2023-09-26 22:38:18 +02:00
Hermès Bélusca-Maïto
e769fef5ac [WINESYNC] Make the wine-staging tag optional, in which case Wine-Staging is not used. 2023-09-26 22:38:17 +02:00
Hermès Bélusca-Maïto
676d2b33c1 [WINESYNC] Elegantly handle empty 'files' and 'directories' lists.
Expand on Timo's commit 4b5a55516.
We may encounter cases where either the 'directories' or 'files' lists
in the .cfg YAML files are empty, and we don't want the script to throw
an exception in that case.

Furthermore, explicitly check for such empty lists when calling PyGit2
index.add_all(...) function, because if it's called on a None or empty
list, _all_ untracked files in the selected git repository get added,
which is not what we want there.
2023-09-26 22:38:16 +02:00
Hermès Bélusca-Maïto
ba4898d807 [WINESYNC] Allow using the "new" Wine-Staging patchinstall.py script.
Wine-Staging switched to staging/patchinstall.py , removing the
deprecated patches/patchinstall.sh in Feb.16, 2023 commit
c1b4af92f7
just before the v8.2 release.

In order to maintain interoperability between older and newer
Wine-Staging versions, try to run first the new script; if it fails,
fall back to the older script.
2023-09-26 22:38:15 +02:00
Hermès Bélusca-Maïto
998033dddd [WINESYNC] Use --no-autoconf otherwise running time is too long. 2023-09-26 22:38:14 +02:00
Hermès Bélusca-Maïto
5c69e1b921 [WINESYNC] Explicitly use posix paths for git actions.
Whenever using git, be it on Windows CMD, git-bash on Windows, or in
*nix systems, git appears to always use posix-like paths internally.
So, enforce them with posixpath when building/concatenating paths that
are going to be passed to pygit2 functions.

Otherwise, exceptions like the following one happens:

```
  File "./winesync.py", line 296, in revert_staged_patchset
    self.reactos_index.remove(os.path.join(self.staged_patch_dir, patch_file_name))
[... skipped ...]
OSError: index does not contain sdk\tools\winesync\setupapi_staging\0002-wine-staging-4.0-setupapi_winetest.patch at stage 0
```

(The git index actually contains the specified path, but in "posix" form
with slash-separators.)

On *nix platforms, these changes should not matter.
2023-09-26 22:38:13 +02:00
Hermès Bélusca-Maïto
b5e56d85d8 [WINESYNC] Fix some apparent problems with commits manipulation with pygit2. 2023-09-26 22:38:12 +02:00
Hermès Bélusca-Maïto
049c44e318 [WINESYNC] Minor formatting. 2023-09-26 22:38:12 +02:00
6 changed files with 815 additions and 376 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -438,8 +438,8 @@
@ stdcall SetupInitializeFileLogA(str long)
@ stdcall SetupInitializeFileLogW(wstr long)
@ stdcall SetupInstallFileA(ptr ptr str str str long ptr ptr)
@ stub SetupInstallFileExA
@ stub SetupInstallFileExW
@ stdcall SetupInstallFileExA(ptr ptr str str str long ptr ptr ptr)
@ stdcall SetupInstallFileExW(ptr ptr wstr wstr wstr long ptr ptr ptr)
@ stdcall SetupInstallFileW(ptr ptr wstr wstr wstr long ptr ptr)
@ stdcall SetupInstallFilesFromInfSectionA(long long long str str long)
@ stdcall SetupInstallFilesFromInfSectionW(long long long wstr wstr long)

View File

@@ -262,7 +262,30 @@ extern DWORD GlobalSetupFlags;
#define REGPART_RENAME "\\Rename"
#define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
inline static WCHAR *strdupAtoW( const char *str )
static inline WCHAR *strdupW( const WCHAR *str )
{
WCHAR *ret = NULL;
if (str)
{
int len = (strlenW(str) + 1) * sizeof(WCHAR);
if ((ret = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( ret, str, len );
}
return ret;
}
static inline char *strdupWtoA( const WCHAR *str )
{
char *ret = NULL;
if (str)
{
DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
}
return ret;
}
static inline WCHAR *strdupAtoW( const char *str )
{
WCHAR *ret = NULL;
if (str)

View File

@@ -0,0 +1,5 @@
directories: null
files:
dlls/setupapi/queue.c: dll/win32/setupapi/queue.c
tags:
wine: wine-8.15

View File

@@ -0,0 +1,13 @@
diff --git a/dll/win32/setupapi/queue.c b/dll/win32/setupapi/queue.c
index b2c03e63f97..bb8f8856987 100644
--- a/dll/win32/setupapi/queue.c
+++ b/dll/win32/setupapi/queue.c
@@ -415,7 +415,7 @@ static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARA
*
* Retrieve the destination dir for a given section.
*/
-static WCHAR *get_destination_dir( HINF hinf, const WCHAR *section )
+WCHAR *get_destination_dir( HINF hinf, const WCHAR *section )
{
INFCONTEXT context;
WCHAR systemdir[MAX_PATH], *dir;

View File

@@ -2,6 +2,7 @@
import sys
import os
import posixpath
import string
import argparse
import subprocess
@@ -35,7 +36,7 @@ class wine_sync:
self.reactos_src = input('Please enter the path to the reactos git tree: ')
self.wine_src = input('Please enter the path to the wine git tree: ')
self.wine_staging_src = input('Please enter the path to the wine-staging git tree: ')
config['repos'] = { 'reactos' : self.reactos_src,
config['repos'] = { 'reactos': self.reactos_src,
'wine': self.wine_src,
'wine-staging': self.wine_staging_src }
with open('winesync.cfg', 'w') as file_output:
@@ -45,6 +46,9 @@ class wine_sync:
self.wine_staging_repo = pygit2.Repository(self.wine_staging_src)
self.reactos_repo = pygit2.Repository(self.reactos_src)
# the standard author signature we will use
self.winesync_author_signature = pygit2.Signature('winesync', 'ros-dev@reactos.org')
# read the index from the reactos tree
self.reactos_index = self.reactos_repo.index
self.reactos_index.read()
@@ -54,45 +58,58 @@ class wine_sync:
with open(module + '.cfg', 'r') as file_input:
self.module_cfg = yaml.safe_load(file_input)
self.staged_patch_dir = os.path.join('sdk', 'tools', 'winesync', self.module + '_staging')
self.staged_patch_dir = posixpath.join('sdk', 'tools', 'winesync', self.module + '_staging')
def create_or_checkout_wine_branch(self, wine_tag, wine_staging_tag):
wine_branch_name = 'winesync-' + wine_tag + '-' + wine_staging_tag
# build the wine branch name
wine_branch_name = 'winesync-' + wine_tag
if wine_staging_tag:
wine_branch_name += '-' + wine_staging_tag
branch = self.wine_repo.lookup_branch(wine_branch_name)
if branch is None:
# get our target commits
wine_target_commit = self.wine_repo.revparse_single(wine_tag)
if isinstance(wine_target_commit, pygit2.Tag):
wine_target_commit = wine_target_commit.target
if isinstance(wine_target_commit, pygit2.Commit):
wine_target_commit = wine_target_commit.id
wine_staging_target_commit = self.wine_staging_repo.revparse_single(wine_staging_tag)
if isinstance(wine_staging_target_commit, pygit2.Tag):
wine_staging_target_commit = wine_staging_target_commit.target
# do the same for the wine-staging tree
if wine_staging_tag:
wine_staging_target_commit = self.wine_staging_repo.revparse_single(wine_staging_tag)
if isinstance(wine_staging_target_commit, pygit2.Tag):
wine_staging_target_commit = wine_staging_target_commit.target
if isinstance(wine_staging_target_commit, pygit2.Commit):
wine_staging_target_commit = wine_staging_target_commit.id
self.wine_repo.branches.local.create(wine_branch_name, self.wine_repo.revparse_single('HEAD'))
self.wine_repo.checkout(self.wine_repo.lookup_branch(wine_branch_name))
self.wine_repo.reset(wine_target_commit, pygit2.GIT_RESET_HARD)
# do the same for the wine-staging tree
self.wine_staging_repo.branches.local.create(wine_branch_name, self.wine_staging_repo.revparse_single('HEAD'))
self.wine_staging_repo.checkout(self.wine_staging_repo.lookup_branch(wine_branch_name))
self.wine_staging_repo.reset(wine_staging_target_commit, pygit2.GIT_RESET_HARD)
if wine_staging_tag:
self.wine_staging_repo.branches.local.create(wine_branch_name, self.wine_staging_repo.revparse_single('HEAD'))
self.wine_staging_repo.checkout(self.wine_staging_repo.lookup_branch(wine_branch_name))
self.wine_staging_repo.reset(wine_staging_target_commit, pygit2.GIT_RESET_HARD)
# run the wine-staging script
subprocess.call(['bash', '-c', self.wine_staging_src + '/patches/patchinstall.sh DESTDIR=' + self.wine_src + ' --all --backend=git-am'])
# run the wine-staging script
if subprocess.call(['python', self.wine_staging_src + '/staging/patchinstall.py', 'DESTDIR=' + self.wine_src, '--all', '--backend=git-am', '--no-autoconf']):
# the new script failed (it doesn't exist?), try the old one
subprocess.call(['bash', '-c', self.wine_staging_src + '/patches/patchinstall.sh DESTDIR=' + self.wine_src + ' --all --backend=git-am --no-autoconf'])
# delete the branch we created
self.wine_staging_repo.checkout(self.wine_staging_repo.lookup_branch('master'))
self.wine_staging_repo.branches.delete(wine_branch_name)
# delete the branch we created
self.wine_staging_repo.checkout(self.wine_staging_repo.lookup_branch('master'))
self.wine_staging_repo.branches.delete(wine_branch_name)
else:
self.wine_repo.checkout(self.wine_repo.lookup_branch(wine_branch_name))
return wine_branch_name
# helper function for resolving wine tree path to reactos one
# Note : it doesn't care about the fact that the file actually exists or not
# Helper function for resolving wine tree path to reactos one
# Note: it doesn't care about the fact that the file actually exists or not
def wine_to_reactos_path(self, wine_path):
if wine_path in self.module_cfg['files']:
if self.module_cfg['files'] and (wine_path in self.module_cfg['files']):
# we have a direct mapping
return self.module_cfg['files'][wine_path]
@@ -100,13 +117,10 @@ class wine_sync:
# root files should have a direct mapping
return None
if self.module_cfg['directories'] is None:
return None
wine_dir, wine_file = os.path.split(wine_path)
if wine_dir in self.module_cfg['directories']:
if self.module_cfg['directories'] and (wine_dir in self.module_cfg['directories']):
# we have a mapping for the directory
return os.path.join(self.module_cfg['directories'][wine_dir], wine_file)
return posixpath.join(self.module_cfg['directories'][wine_dir], wine_file)
# no match
return None
@@ -123,7 +137,8 @@ class wine_sync:
if in_staging:
# see if we already applied this patch
patch_file_name = f'{staging_patch_index:04}-{string_to_valid_file_name(wine_commit.message.splitlines()[0])}.diff'
patch_path = os.path.join(self.reactos_src, self.staged_patch_dir, patch_file_name)
patch_dir = os.path.join(self.reactos_src, self.staged_patch_dir)
patch_path = os.path.join(patch_dir, patch_file_name)
if os.path.isfile(patch_path):
print(f'Skipping patch as {patch_path} already exists')
return True, ''
@@ -133,7 +148,7 @@ class wine_sync:
# check if we should care
new_reactos_path = self.wine_to_reactos_path(delta.new_file.path)
if not new_reactos_path is None:
warning_message += 'file ' + delta.new_file.path + ' is added to the wine tree !\n'
warning_message += 'file ' + delta.new_file.path + ' is added to the wine tree!\n'
old_reactos_path = '/dev/null'
else:
old_reactos_path = None
@@ -141,12 +156,12 @@ class wine_sync:
# check if we should care
old_reactos_path = self.wine_to_reactos_path(delta.old_file.path)
if not old_reactos_path is None:
warning_message += 'file ' + delta.old_file.path + ' is removed from the wine tree !\n'
warning_message += 'file ' + delta.old_file.path + ' is removed from the wine tree!\n'
new_reactos_path = '/dev/null'
else:
new_reactos_path = None
elif delta.new_file.path.endswith('Makefile.in'):
warning_message += 'file ' + delta.new_file.path + ' was modified !\n'
warning_message += 'file ' + delta.new_file.path + ' was modified!\n'
# no need to warn that those are ignored, we just did.
continue
else:
@@ -210,7 +225,7 @@ class wine_sync:
print('Applied patches from wine commit ' + str(wine_commit.id))
if ignored_files:
warning_message += 'WARNING : some files were ignored: ' + ' '.join(ignored_files) + '\n'
warning_message += 'WARNING: some files were ignored: ' + ' '.join(ignored_files) + '\n'
if not in_staging:
self.module_cfg['tags']['wine'] = str(wine_commit.id)
@@ -220,11 +235,11 @@ class wine_sync:
else:
# Add the staging patch
# do not save the wine commit ID in <module>.cfg, as it's a local one for staging patches
if not os.path.isdir(os.path.join(self.reactos_src, self.staged_patch_dir)):
os.mkdir(os.path.join(self.reactos_src, self.staged_patch_dir))
if not os.path.isdir(patch_dir):
os.mkdir(patch_dir)
with open(patch_path, 'w') as file_output:
file_output.write(complete_patch)
self.reactos_index.add(os.path.join(self.staged_patch_dir, patch_file_name))
self.reactos_index.add(posixpath.join(self.staged_patch_dir, patch_file_name))
self.reactos_index.write()
@@ -234,8 +249,9 @@ class wine_sync:
else:
commit_msg += f'wine commit id {str(wine_commit.id)} by {wine_commit.author.name} <{wine_commit.author.email}>'
self.reactos_repo.create_commit('HEAD',
pygit2.Signature('winesync', 'ros-dev@reactos.org'),
self.reactos_repo.create_commit(
'HEAD',
self.winesync_author_signature,
self.reactos_repo.default_signature,
commit_msg,
self.reactos_index.write_tree(),
@@ -249,18 +265,19 @@ class wine_sync:
f'You can see the details of the wine commit here:\n' \
f' https://source.winehq.org/git/wine.git/commit/{str(wine_commit.id)}\n'
else:
patch_file_path = posixpath.join(self.staged_patch_dir, patch_file_name)
warning_message += f'\n' \
f'Do not forget to run\n' \
f' git diff HEAD^ \':(exclude)sdk/tools/winesync/{patch_file_name}\' > sdk/tools/winesync/{patch_file_name}\n' \
f' git diff HEAD^ \':(exclude){patch_file_path}\' > {patch_file_path}\n' \
f'after your correction and then\n' \
f' git add sdk/tools/winesync/{patch_file_name}\n' \
f' git add {patch_file_path}\n' \
f'before running "git commit --amend"'
return True, warning_message
def revert_staged_patchset(self):
# revert all of this in one commit
staged_patch_dir_path = os.path.join(self.reactos_src, self.staged_patch_dir)
staged_patch_dir_path = posixpath.join(self.reactos_src, self.staged_patch_dir)
if not os.path.isdir(staged_patch_dir_path):
return True
@@ -275,26 +292,31 @@ class wine_sync:
with open(patch_path, 'rb') as patch_file:
try:
subprocess.run(['git', '-C', self.reactos_src, 'apply', '-R', '--reject'], stdin=patch_file, check=True)
subprocess.run(['git', '-C', self.reactos_src, 'apply', '-R', '--ignore-whitespace', '--reject'], stdin=patch_file, check=True)
except subprocess.CalledProcessError as err:
print(f'Error while reverting patch {patch_file_name}')
print('Please check, remove the offending patch with git rm, and relaunch this script')
return False
self.reactos_index.remove(os.path.join(self.staged_patch_dir, patch_file_name))
self.reactos_index.remove(posixpath.join(self.staged_patch_dir, patch_file_name))
self.reactos_index.write()
os.remove(patch_path)
if not has_patches:
return True
self.reactos_index.add_all([f for f in self.module_cfg['files'].values()])
self.reactos_index.add_all([f'{d}/*.*' for d in self.module_cfg['directories'].values()])
# Note: these path lists may be empty or None, in which case
# we should not call index.add_all(), otherwise we would add
# any untracked file present in the repository.
if self.module_cfg['files']:
self.reactos_index.add_all([f for f in self.module_cfg['files'].values()])
if self.module_cfg['directories']:
self.reactos_index.add_all([f'{d}/*.*' for d in self.module_cfg['directories'].values()])
self.reactos_index.write()
self.reactos_repo.create_commit(
'HEAD',
self.reactos_repo.default_signature,
self.winesync_author_signature,
self.reactos_repo.default_signature,
f'[WINESYNC]: revert wine-staging patchset for {self.module}',
self.reactos_index.write_tree(),
@@ -306,16 +328,18 @@ class wine_sync:
wine_target_commit = self.wine_repo.revparse_single(wine_tag)
if isinstance(wine_target_commit, pygit2.Tag):
wine_target_commit = wine_target_commit.target
if isinstance(wine_target_commit, pygit2.Commit):
wine_target_commit = wine_target_commit.id
# print(f'wine target commit is {wine_target_commit}')
# get the wine commit id where we left
in_staging = False
wine_last_sync = self.wine_repo.revparse_single(self.module_cfg['tags']['wine'])
if (isinstance(wine_last_sync, pygit2.Tag)):
if isinstance(wine_last_sync, pygit2.Tag):
if not self.revert_staged_patchset():
return
wine_last_sync = wine_last_sync.target
if (isinstance(wine_last_sync, pygit2.Commit)):
if isinstance(wine_last_sync, pygit2.Commit):
wine_last_sync = wine_last_sync.id
# create a branch to keep things clean
@@ -358,7 +382,7 @@ class wine_sync:
self.reactos_index.write()
self.reactos_repo.create_commit(
'HEAD',
self.reactos_repo.default_signature,
self.winesync_author_signature,
self.reactos_repo.default_signature,
f'[WINESYNC]: {self.module} is now in sync with wine-staging {wine_tag}',
self.reactos_index.write_tree(),
@@ -368,9 +392,9 @@ class wine_sync:
def main():
parser = argparse.ArgumentParser()
parser.add_argument('module', help='The module you want to sync. <module>.cfg must exist in the current directory')
parser.add_argument('wine_tag', help='The wine tag or commit id to sync to')
parser.add_argument('wine_staging_tag', help='The wine staging tag or commit id to pick wine staged patches from')
parser.add_argument('module', help='The module you want to sync. <module>.cfg must exist in the current directory.')
parser.add_argument('wine_tag', help='The wine tag or commit id to sync to.')
parser.add_argument('wine_staging_tag', nargs='?', default=None, help='The optional wine staging tag or commit id to pick wine staged patches from.')
args = parser.parse_args()