1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00

Compare commits

...

49 Commits

Author SHA1 Message Date
cjy880927
685b644647
Merge 5235686be0 into 6c5d17af07 2024-06-23 09:19:43 +08:00
Fabian Maurer
6c5d17af07 wow64: In wow64_NtSetInformationToken forward TokenIntegrityLevel.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56725
2024-06-21 22:59:40 +02:00
Piotr Caban
08c0978f0b kernel32/tests: Test GetFileMUIInfo on language resource file. 2024-06-21 22:59:40 +02:00
Piotr Caban
fe6af4fb9e kernel32/tests: Add GetFileMUIInfo tests. 2024-06-21 22:59:40 +02:00
Piotr Caban
f477eca789 kernelbase: Add GetFileMUIInfo implementation. 2024-06-21 22:59:40 +02:00
Alistair Leslie-Hughes
4aab3e42c1 odbccp32: SQLConfigDataSource/W fix crash with passed NULL attribute parameter. 2024-06-21 22:59:40 +02:00
Alistair Leslie-Hughes
6dca99a713 odbccp32: Look at the Setup key to find the driver of ODBC config functions.
We need to look at the Setup key for the driver, as it can be different
compare to the actually driver.

For example, mysql uses the same Setup file to configure both the Ascii/Unicode
vession but has a different file for the actual ODBC functions.
2024-06-21 22:59:40 +02:00
Eric Pouech
bd36ac98c0 cmd: Expand delayed variables in IF operands.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-06-21 22:59:40 +02:00
Eric Pouech
01d0027739 cmd/tests: Add tests for delayed substitution in IF command.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-06-21 22:59:40 +02:00
Eric Pouech
411cce36b1 cmd: Introduce return code to indicate abort of current instruction.
Use that return code for WCMD_exit() and WCMD_goto().

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-06-21 22:59:40 +02:00
Eric Pouech
844d6b553a cmd: Use kernel32's error codes instead of literals.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-06-21 22:59:40 +02:00
Eric Pouech
2ec70835fc cmd: Introduce token-based syntax parser for building command nodes.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-06-21 22:59:40 +02:00
Rémi Bernon
9a7408e771 win32u: Use the shared data if possible for NtUserGetAsyncKeyState.
Based on a patch by Huw Davies.
2024-06-21 22:59:39 +02:00
Rémi Bernon
2eeb4d5192 server: Move the desktop keystate to shared memory.
Based on a patch by Huw Davies.
2024-06-21 22:59:39 +02:00
Rémi Bernon
d5b4458c8d server: Use separate functions to update the desktop and input keystates.
Based on a patch by Huw Davies.
2024-06-21 22:59:39 +02:00
Rémi Bernon
534aff4a63 server: Use a separate variable to determine the message on Alt release.
Based on a patch by Huw Davies.
2024-06-21 22:59:39 +02:00
Rémi Bernon
5b013260d1 win32u: Use the shared memory for get_clip_cursor. 2024-06-21 22:59:39 +02:00
Rémi Bernon
472ce7fd1d server: Get rid of the global cursor structure.
Based on a patch by Huw Davies.
2024-06-21 22:59:39 +02:00
Rémi Bernon
496f663157 server: Store the cursor clip rect in the shared data.
Based on a patch by Huw Davies.
2024-06-21 22:59:39 +02:00
Rémi Bernon
33a9097bb4 server: Mark block as writable in mark_block_uninitialized.
Before writing to it, it may have been marked as noaccess before
in free_shared_object.
2024-06-21 22:59:39 +02:00
Alex Henrie
c77a217d34 ntdll: Fix type and size of expanded strings in RtlQueryRegistryValues. 2024-06-21 22:59:39 +02:00
Alex Henrie
7dad7e87a9 ntdll: Don't write partial strings with RTL_QUERY_REGISTRY_DIRECT.
The new tests revealed only one case where too-small buffers were not
already being handled correctly.
2024-06-21 22:59:39 +02:00
Elizabeth Figura
1dee9881e2 ntdll: Do not fill the IOSB in NtFsControlFile() on failure. 2024-06-21 22:59:39 +02:00
Elizabeth Figura
86be09ac0b ntdll: Do not fill the IOSB or signal completion on failure in tape_DeviceIoControl().
We should never fill the IOSB or signal completion for NT_ERROR conditions.
2024-06-21 22:59:39 +02:00
Elizabeth Figura
98b99b6569 ntdll: Do not fill the IOSB or signal completion on failure in serial_DeviceIoControl().
We should never fill the IOSB or signal completion for NT_ERROR conditions.
2024-06-21 22:59:39 +02:00
Elizabeth Figura
5f76f07bff ntdll: Do not fill the IOSB or signal completion on failure in cdrom_DeviceIoControl().
Synchronous NT_ERROR conditions should not touch the IOSB or signal completion.
2024-06-21 22:59:39 +02:00
Elizabeth Figura
0e928ccaea ntdll: Remove the redundant filling of the IOSB in NtDeviceIoControlFile(). 2024-06-21 22:59:39 +02:00
Alexandre Julliard
b2017a48dc ntdll: Move the IP string conversion functions to rtlstr.c. 2024-06-21 22:59:39 +02:00
Alexandre Julliard
0051e102cc ntdll: Move RtlIsProcessorFeaturePresent implementation to the CPU backends. 2024-06-21 22:59:39 +02:00
Alexandre Julliard
7f53949a49 ntdll: Export a proper function for RtlGetNativeSystemInformation.
It will need custom handling on ARM64EC.
2024-06-21 22:59:39 +02:00
Alexandre Julliard
7830153c38 ntdll: Simplify preloader execution using HAVE_WINE_PRELOADER. 2024-06-21 22:59:36 +02:00
Brendan Shanks
7b82f507bd loader: Use zerofill sections instead of preloader on macOS when building with Xcode 15.3.
Xcode 15.3 adds a new linker flag ('-no_huge') which allows the loader
to use zero-fill sections to reserve the areas currently being
reserved by the preloader.

This means the preloader is no longer needed (a good thing, since it's
heavily dependent on private APIs).

The preloader will still be used when Xcode <15.3 is being used, or when
building for i386 (32-bit for 10.14 and earlier).
2024-06-21 17:33:24 +02:00
Brendan Shanks
5da03c7a60 configure: Define HAVE_WINE_PRELOADER when the preloader is being built. 2024-06-21 17:33:24 +02:00
Brendan Shanks
266e95a21b configure: Rename wine_can_build_preloader to wine_use_preloader, and also use it for Linux. 2024-06-21 17:33:24 +02:00
Brendan Shanks
9669cd56f4 configure: Remove warning when not using preloader on macOS. 2024-06-21 17:33:24 +02:00
Brendan Shanks
1f79e7697b configure: Don't build wineloader on macOS with '-pie'.
This is already the default for all Mac binaries targeting 10.7 or
later.
2024-06-21 17:33:24 +02:00
Rémi Bernon
f5a739ce62 include: Define frexpf as inline function in more cases. 2024-06-21 14:11:54 +02:00
Rémi Bernon
dea96222b4 include: Add a couple of CRT function declarations. 2024-06-21 14:11:54 +02:00
Zhiyi Zhang
53d03fb0a5 kernel32: Add AppPolicyGetWindowingModel(). 2024-06-21 14:11:54 +02:00
Arkadiusz Hiler
5a903c0f1a apisetschema: Add api-ms-win-appmodel-runtime-internal-l1-1-1. 2024-06-21 10:51:08 +02:00
Arkadiusz Hiler
2030973a3f bcp47langs: Add stub dll. 2024-06-21 10:51:08 +02:00
Zhiyi Zhang
2804012993 profapi: Add stub dll. 2024-06-21 10:47:56 +02:00
Biswapriyo Nath
4792d3dd2d include: Add Windows.Graphics.Capture.Direct3D11CaptureFramePool runtimeclass. 2024-06-21 10:47:38 +02:00
Biswapriyo Nath
ffe88e3b0d include: Add Windows.Graphics.Capture.Direct3D11CaptureFrame runtimeclass. 2024-06-21 10:47:38 +02:00
Biswapriyo Nath
68b62ecdc9 include: Add Windows.Graphics.Capture.GraphicsCaptureItem runtimeclass. 2024-06-21 10:47:38 +02:00
Biswapriyo Nath
657cc2a9f6 include: Add windows.graphics.idl file. 2024-06-21 10:47:37 +02:00
Biswapriyo Nath
0525a996a4 include: Add Windows.Graphics.Capture.IGraphicsCaptureSession3 definition. 2024-06-21 10:47:37 +02:00
Biswapriyo Nath
9954c6b7fb include: Add Windows.Graphics.Capture.IGraphicsCaptureSession2 definition. 2024-06-21 10:47:35 +02:00
chenjiangyi
5235686be0 ntdll: Support Ctrl-C stop debuggee and attach 32-bit process in wow64 mode.
Signed-off-by: chenjiangyi <chenjiangyi@uniontech.com>
2023-11-05 17:13:16 +08:00
108 changed files with 2655 additions and 1146 deletions

66
configure vendored
View File

@ -1006,6 +1006,7 @@ enable_authz
enable_avicap32
enable_avifil32
enable_avrt
enable_bcp47langs
enable_bcrypt
enable_bcryptprimitives
enable_bluetoothapis
@ -1369,6 +1370,7 @@ enable_pidgen
enable_powrprof
enable_printui
enable_prntvpt
enable_profapi
enable_propsys
enable_psapi
enable_pstorec
@ -9529,14 +9531,47 @@ fi
SYSTEMCONFIGURATION_LIBS="-framework SystemConfiguration"
WINELOADER_LDFLAGS="-Wl,-pie,-segalign,0x1000,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,loader/wine_info.plist"
WINELOADER_LDFLAGS="-Wl,-segalign,0x1000,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,loader/wine_info.plist"
case $HOST_ARCH in
i386|x86_64) wine_can_build_preloader=yes ;;
*) wine_can_build_preloader=no ;;
i386) wine_use_preloader=yes ;;
x86_64)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-no_huge" >&5
printf %s "checking whether the compiler supports -Wl,-no_huge... " >&6; }
if test ${ac_cv_cflags__Wl__no_huge+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -Wl,-no_huge"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(int argc, char **argv) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_cflags__Wl__no_huge=yes
else $as_nop
ac_cv_cflags__Wl__no_huge=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__no_huge" >&5
printf "%s\n" "$ac_cv_cflags__Wl__no_huge" >&6; }
if test "x$ac_cv_cflags__Wl__no_huge" = xyes
then :
wine_use_preloader=no
WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-no_pie,-image_base,0x200000000,-no_huge,-no_fixup_chains,-segalign,0x1000,-segaddr,WINE_RESERVE,0x1000,-segaddr,WINE_TOP_DOWN,0x7ff000000000"
else $as_nop
wine_use_preloader=yes
fi
;;
*) wine_use_preloader=no ;;
esac
if test "$wine_can_build_preloader" = "yes"
if test "$wine_use_preloader" = "yes"
then
WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs -e _start -ldylib1.o -mmacosx-version-min=10.7 -Wl,-no_new_main,-segalign,0x1000,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,loader/wine_info.plist"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-no_pie" >&5
@ -9576,8 +9611,6 @@ fi
;;
esac
WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -mmacosx-version-min=10.7"
else
as_fn_append wine_warnings "|can't build Wine preloader; many programs won't work"
fi
if test "x$with_coreaudio" != "xno";
@ -20448,19 +20481,20 @@ case $host_os in
linux*)
if test $HOST_ARCH != unknown
then
test "$wine_binary" = wine || as_fn_append CONFIGURE_TARGETS " loader/wine-preloader"
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
fi
;;
darwin*|macosx*)
if test "$wine_can_build_preloader" = "yes"
then
test "$wine_binary" = wine || as_fn_append CONFIGURE_TARGETS " loader/wine-preloader"
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
wine_use_preloader=yes
fi
;;
esac
if test "$wine_use_preloader" = "yes"
then
test "$wine_binary" = wine || as_fn_append CONFIGURE_TARGETS " loader/wine-preloader"
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
printf "%s\n" "#define HAVE_WINE_PRELOADER 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
printf %s "checking for library containing dlopen... " >&6; }
@ -21951,6 +21985,7 @@ wine_fn_config_makefile dlls/avifil32 enable_avifil32
wine_fn_config_makefile dlls/avifil32/tests enable_tests
wine_fn_config_makefile dlls/avifile.dll16 enable_win16
wine_fn_config_makefile dlls/avrt enable_avrt
wine_fn_config_makefile dlls/bcp47langs enable_bcp47langs
wine_fn_config_makefile dlls/bcrypt enable_bcrypt
wine_fn_config_makefile dlls/bcrypt/tests enable_tests
wine_fn_config_makefile dlls/bcryptprimitives enable_bcryptprimitives
@ -22517,6 +22552,7 @@ wine_fn_config_makefile dlls/powrprof enable_powrprof
wine_fn_config_makefile dlls/printui enable_printui
wine_fn_config_makefile dlls/prntvpt enable_prntvpt
wine_fn_config_makefile dlls/prntvpt/tests enable_tests
wine_fn_config_makefile dlls/profapi enable_profapi
wine_fn_config_makefile dlls/propsys enable_propsys
wine_fn_config_makefile dlls/propsys/tests enable_tests
wine_fn_config_makefile dlls/psapi enable_psapi

View File

@ -637,14 +637,21 @@ case $host_os in
AC_SUBST(SECURITY_LIBS,"-framework Security -framework CoreFoundation")
AC_SUBST(SYSTEMCONFIGURATION_LIBS,"-framework SystemConfiguration")
WINELOADER_LDFLAGS="-Wl,-pie,-segalign,0x1000,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,loader/wine_info.plist"
WINELOADER_LDFLAGS="-Wl,-segalign,0x1000,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,loader/wine_info.plist"
case $HOST_ARCH in
i386|x86_64) wine_can_build_preloader=yes ;;
*) wine_can_build_preloader=no ;;
i386) wine_use_preloader=yes ;;
x86_64)
dnl If the -no_huge linker option is present (added in Xcode 15.3), use zerofill sections instead of the preloader
WINE_TRY_CFLAGS([-Wl,-no_huge],
[wine_use_preloader=no
WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-no_pie,-image_base,0x200000000,-no_huge,-no_fixup_chains,-segalign,0x1000,-segaddr,WINE_RESERVE,0x1000,-segaddr,WINE_TOP_DOWN,0x7ff000000000"],
[wine_use_preloader=yes])
;;
*) wine_use_preloader=no ;;
esac
if test "$wine_can_build_preloader" = "yes"
if test "$wine_use_preloader" = "yes"
then
WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs -e _start -ldylib1.o -mmacosx-version-min=10.7 -Wl,-no_new_main,-segalign,0x1000,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,loader/wine_info.plist"
WINE_TRY_CFLAGS([-Wl,-no_pie],
@ -659,8 +666,6 @@ case $host_os in
esac
dnl If preloader is used, the loader needs to be an LC_UNIXTHREAD binary to avoid AppKit/Core Animation problems.
WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -mmacosx-version-min=10.7"
else
WINE_WARNING([can't build Wine preloader; many programs won't work])
fi
if test "x$with_coreaudio" != "xno";
@ -2035,19 +2040,18 @@ case $host_os in
linux*)
if test $HOST_ARCH != unknown
then
test "$wine_binary" = wine || WINE_IGNORE_FILE(loader/wine-preloader)
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
fi
;;
darwin*|macosx*)
if test "$wine_can_build_preloader" = "yes"
then
test "$wine_binary" = wine || WINE_IGNORE_FILE(loader/wine-preloader)
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
wine_use_preloader=yes
fi
;;
esac
if test "$wine_use_preloader" = "yes"
then
test "$wine_binary" = wine || WINE_IGNORE_FILE(loader/wine-preloader)
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
AC_DEFINE(HAVE_WINE_PRELOADER, 1, [Define to 1 if the Wine preloader is being used.])
fi
dnl **** Check for functions ****
dnl Check for -ldl
@ -2459,6 +2463,7 @@ WINE_CONFIG_MAKEFILE(dlls/avifil32)
WINE_CONFIG_MAKEFILE(dlls/avifil32/tests)
WINE_CONFIG_MAKEFILE(dlls/avifile.dll16,enable_win16)
WINE_CONFIG_MAKEFILE(dlls/avrt)
WINE_CONFIG_MAKEFILE(dlls/bcp47langs)
WINE_CONFIG_MAKEFILE(dlls/bcrypt)
WINE_CONFIG_MAKEFILE(dlls/bcrypt/tests)
WINE_CONFIG_MAKEFILE(dlls/bcryptprimitives)
@ -3025,6 +3030,7 @@ WINE_CONFIG_MAKEFILE(dlls/powrprof)
WINE_CONFIG_MAKEFILE(dlls/printui)
WINE_CONFIG_MAKEFILE(dlls/prntvpt)
WINE_CONFIG_MAKEFILE(dlls/prntvpt/tests)
WINE_CONFIG_MAKEFILE(dlls/profapi)
WINE_CONFIG_MAKEFILE(dlls/propsys)
WINE_CONFIG_MAKEFILE(dlls/propsys/tests)
WINE_CONFIG_MAKEFILE(dlls/psapi)

View File

@ -1,3 +1,4 @@
apiset api-ms-win-appmodel-runtime-internal-l1-1-1 = kernelbase.dll
apiset api-ms-win-appmodel-runtime-l1-1-2 = kernelbase.dll
apiset api-ms-win-base-bootconfig-l1-1-0 = advapi32.dll
apiset api-ms-win-base-util-l1-1-0 = advapi32.dll

View File

@ -0,0 +1,2 @@
MODULE = bcp47langs.dll
IMPORTLIB = bcp47langs

View File

@ -0,0 +1,71 @@
1 stub GetUnIsoRegionCode
@ stub AppendUserLanguageInputMethods
@ stub AppendUserLanguageInternal
@ stub AppendUserLanguages
@ stub Bcp47BufferFromLcid
@ stub Bcp47FindClosestLanguage
@ stub Bcp47FromCompactTagInternal
@ stub Bcp47FromHkl
@ stub Bcp47FromLcid
@ stub Bcp47GetAbbreviation
@ stub Bcp47GetDirectionality
@ stub Bcp47GetDistance
@ stub Bcp47GetExtensionSingletons
@ stub Bcp47GetExtensionSubstring
@ stub Bcp47GetIsoLanguageCode
@ stub Bcp47GetIsoScriptCode
@ stub Bcp47GetLanguageName
@ stub Bcp47GetMuiForm
@ stub Bcp47GetNeutralForm
@ stub Bcp47GetNlsForm
@ stub Bcp47GetSubtagMapInternal
@ stub Bcp47GetUnIsoRegionCode
@ stub Bcp47IsWellFormed
@ stub Bcp47Normalize
@ stub ClearApplicationLanguageOverride
@ stub ClearApplicationManifestLanguages
@ stub ClearHttpAcceptLanguageOptOut
@ stub ClearUserDisplayLanguageOverride
@ stub ClearUserLocaleFromLanguageProfileOptOut
@ stub CompactTagFromBcp47Internal
@ stub DllGetActivationFactory
@ stub DllGetClassObject
@ stub GetApplicationLanguageOverride
@ stub GetApplicationLanguages
@ stub GetApplicationManifestLanguages
@ stub GetAppropriateUserLocaleForUserLanguages
@ stub GetAppropriateUserPreferredAndDisplayLanguagesForUser
@ stub GetClosestMatchingUserLanguage
@ stub GetDisplayLanguagesForAllUsers
@ stub GetFontFallbackLanguageList
@ stub GetHttpAcceptLanguageOptOut
@ stub GetInputMethodOverrideForUser
@ stub GetPendingUserDisplayLanguage
@ stub GetRelevantLocalesFromLanguageTags
@ stub GetSerializedUserLanguageProfile
@ stub GetSerializedUserLanguagesForUser
@ stub GetStartingUserDisplayLanguage
@ stub GetUserDisplayLanguageOverride
@ stub GetUserLanguageInputMethods
@ stub GetUserLanguageInputMethodsForUser
@ stub GetUserLanguages
@ stub GetUserLanguagesForAllUsers
@ stub GetUserLanguagesForUser
@ stub GetUserLocaleFromLanguageProfileOptOut
@ stub IsTransientLcid
@ stub LanguageListAsMuiForm
@ stub LcidFromBcp47
@ stub RemoveInputsForAllLanguagesInternal
@ stub RemoveUserLanguageInputMethods
@ stub ResolveLanguages
@ stub SetApplicationLanguageOverride
@ stub SetApplicationManifestLanguages
@ stub SetHttpAcceptLanguageOptOut
@ stub SetInputMethodOverride
@ stub SetPreviousUserDisplayLanguages
@ stub SetStartingUserDisplayLanguage
@ stub SetUserDisplayLanguageOverride
@ stub SetUserLanguageInputMethods
@ stub SetUserLanguagesInternal
@ stub SetUserLanguagesInternalCore
@ stub SetUserLocaleFromLanguageProfileOptOut

View File

@ -158,6 +158,7 @@
@ stdcall ApplicationRecoveryFinished(long)
@ stdcall ApplicationRecoveryInProgress(ptr)
@ stdcall AppPolicyGetMediaFoundationCodecLoading(ptr ptr) kernelbase.AppPolicyGetMediaFoundationCodecLoading
@ stdcall AppPolicyGetWindowingModel(ptr ptr) kernelbase.AppPolicyGetWindowingModel
@ stdcall -import AreFileApisANSI()
@ stdcall AssignProcessToJobObject(ptr ptr)
@ stdcall -import AttachConsole(long)

View File

@ -520,6 +520,298 @@ static void test_internal_structure(void)
ok( EndUpdateResourceW( res, TRUE ), "EndUpdateResourceW failed\n");
}
static const struct
{
IMAGE_DOS_HEADER dos;
IMAGE_NT_HEADERS nt;
IMAGE_SECTION_HEADER section;
} dll_image =
{
{ IMAGE_DOS_SIGNATURE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0 }, 0, 0, { 0 },
sizeof(IMAGE_DOS_HEADER) },
{
IMAGE_NT_SIGNATURE, /* Signature */
{
#if defined __i386__
IMAGE_FILE_MACHINE_I386, /* Machine */
#elif defined __x86_64__
IMAGE_FILE_MACHINE_AMD64, /* Machine */
#elif defined __arm__
IMAGE_FILE_MACHINE_ARMNT, /* Machine */
#elif defined __aarch64__
IMAGE_FILE_MACHINE_ARM64, /* Machine */
#else
# error You must specify the machine type
#endif
1, /* NumberOfSections */
0, /* TimeDateStamp */
0, /* PointerToSymbolTable */
0, /* NumberOfSymbols */
sizeof(IMAGE_OPTIONAL_HEADER), /* SizeOfOptionalHeader */
IMAGE_FILE_EXECUTABLE_IMAGE | IMAGE_FILE_DLL /* Characteristics */
},
{ IMAGE_NT_OPTIONAL_HDR_MAGIC, /* Magic */
1, /* MajorLinkerVersion */
0, /* MinorLinkerVersion */
0, /* SizeOfCode */
0, /* SizeOfInitializedData */
0, /* SizeOfUninitializedData */
0, /* AddressOfEntryPoint */
0x1000, /* BaseOfCode */
#ifndef _WIN64
0, /* BaseOfData */
#endif
0x10000000, /* ImageBase */
0x1000, /* SectionAlignment */
0x1000, /* FileAlignment */
4, /* MajorOperatingSystemVersion */
0, /* MinorOperatingSystemVersion */
1, /* MajorImageVersion */
0, /* MinorImageVersion */
4, /* MajorSubsystemVersion */
0, /* MinorSubsystemVersion */
0, /* Win32VersionValue */
0x3000, /* SizeOfImage */
sizeof(IMAGE_DOS_HEADER) + sizeof(IMAGE_NT_HEADERS),
0, /* CheckSum */
IMAGE_SUBSYSTEM_WINDOWS_CUI, /* Subsystem */
IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT, /* DllCharacteristics */
0, /* SizeOfStackReserve */
0, /* SizeOfStackCommit */
0, /* SizeOfHeapReserve */
0, /* SizeOfHeapCommit */
0, /* LoaderFlags */
IMAGE_FILE_RESOURCE_DIRECTORY + 1, /* NumberOfRvaAndSizes */
{ { 0 }, { 0 }, { 0x1000, 0x1000 } } /* DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] */
}
},
{ ".rsrc\0\0", { 0 }, 0x1000, 0x1000, 0, 0, 0, 0, 0,
IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ }
};
static void create_test_dll( const WCHAR *name )
{
DWORD dummy;
HANDLE handle = CreateFileW( name, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, 0 );
ok( handle != INVALID_HANDLE_VALUE, "failed to create file err %lu\n", GetLastError() );
WriteFile( handle, &dll_image, sizeof(dll_image), &dummy, NULL );
SetFilePointer( handle, dll_image.nt.OptionalHeader.SizeOfImage, NULL, FILE_BEGIN );
SetEndOfFile( handle );
CloseHandle( handle );
}
static struct mui_res
{
DWORD signature;
DWORD size;
DWORD version;
DWORD path_type;
DWORD file_type;
DWORD system_attributes;
DWORD fallback_location;
BYTE service_checksum[16];
BYTE checksum[16];
DWORD unk1[2];
DWORD mui_path_off;
DWORD mui_path_size;
DWORD unk2[2];
DWORD ln_type_name_off;
DWORD ln_type_name_size;
DWORD ln_type_id_off;
DWORD ln_type_id_size;
DWORD mui_type_name_off;
DWORD mui_type_name_size;
DWORD mui_type_id_off;
DWORD mui_type_id_size;
DWORD lang_off;
DWORD lang_size;
DWORD fallback_lang_off;
DWORD fallback_lang_size;
WCHAR ln_type_names[8];
DWORD ln_type_ids[1];
WCHAR mui_type_names[8];
DWORD mui_type_ids[1];
WCHAR lang[8];
WCHAR fallback_lang[8];
} ln_mui_res = {
0xfecdfecd, sizeof(ln_mui_res), 0x10000, 0,
MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN >> 1,
0, 0, {'s','c'}, {'c'}, {0}, 0, 0, {0},
offsetof(struct mui_res, ln_type_names), sizeof(L"MUI\0"),
offsetof(struct mui_res, ln_type_ids), sizeof(ln_mui_res.ln_type_ids),
offsetof(struct mui_res, mui_type_names), sizeof(L"MUI\0"),
offsetof(struct mui_res, mui_type_ids), sizeof(ln_mui_res.mui_type_ids), 0, 0,
offsetof(struct mui_res, fallback_lang), sizeof(L"en-US"),
{'M','U','I',0,0}, {RT_CURSOR}, {'M','U','I',0,0}, {RT_STRING}, {0}, {'e','n','-','U','S',0},
}, en_mui_res = {
0xfecdfecd, sizeof(ln_mui_res), 0x10000, 0,
MUI_FILETYPE_LANGUAGE_NEUTRAL_MUI >> 1,
0, 0, {'s','c'}, {'c'}, {0}, 0, 0, {0},
offsetof(struct mui_res, ln_type_names), sizeof(L"MUI\0"),
offsetof(struct mui_res, ln_type_ids), sizeof(ln_mui_res.ln_type_ids),
0, 0, 0, 0, offsetof(struct mui_res, lang), sizeof(L"en-US"), 0, 0,
{'M','U','I',0,0}, {RT_STRING}, {0}, {0}, {'e','n','-','U','S',0}
};
static void test_mui(void)
{
static const WCHAR ln_dll[] = L"test_mui.dll";
static const WCHAR en_dll[] = L"en-US\\test_mui.dll.mui";
static const BYTE zeros[16] = { 0 };
BYTE buf[1024];
FILEMUIINFO *info = (FILEMUIINFO *)buf;
const WCHAR *str;
DWORD size, *id;
HANDLE res;
BOOL r;
size = 0;
r = GetFileMUIInfo( 0, ln_dll, NULL, &size);
ok( !r, "GetFileMUIInfo succeeded\n" );
ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError() = %ld\n", GetLastError() );
create_test_dll( ln_dll );
CreateDirectoryW( L"en-US", NULL );
create_test_dll( en_dll );
size = 0;
r = GetFileMUIInfo( 0, ln_dll, NULL, &size );
ok( r, "GetFileMUIInfo failed: %ld\n", GetLastError() );
ok( size == sizeof(*info), "unexpected size: %ld\n", size );
memset( buf, 0xfe, sizeof(buf) );
size = sizeof(buf);
info->dwSize = sizeof(buf);
info->dwVersion = 0;
r = GetFileMUIInfo( 0, ln_dll, info, &size );
ok( !r, "GetFileMUIInfo succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %ld\n", GetLastError() );
ok( !size, "size = %ld\n", size );
size = sizeof(buf);
info->dwVersion = MUI_FILEINFO_VERSION;
r = GetFileMUIInfo( 0, ln_dll, info, &size );
ok( r, "GetFileMUIInfo failed: %ld\n", GetLastError() );
ok( info->dwSize == sizeof(buf), "dwSize = %ld\n", info->dwSize );
ok( info->dwVersion == MUI_FILEINFO_VERSION, "dwVersion = %ld\n", info->dwVersion );
ok( info->dwFileType == MUI_FILETYPE_NOT_LANGUAGE_NEUTRAL, "dwFileType = %ld\n", info->dwFileType );
ok( !memcmp(info->pChecksum, zeros, sizeof(info->pChecksum)), "pChecksum = %s\n",
wine_dbgstr_an((char *)info->pChecksum, sizeof(info->pChecksum)) );
ok( !memcmp(info->pServiceChecksum, zeros, sizeof(info->pServiceChecksum)), "pServiceChecksum = %s\n",
wine_dbgstr_an((char *)info->pServiceChecksum, sizeof(info->pServiceChecksum)) );
ok( !info->dwLanguageNameOffset, "dwLanguageNameOffset = %ld\n", info->dwLanguageNameOffset );
ok( !info->dwTypeIDMainSize, "dwTypeIDMainSize = %ld\n", info->dwTypeIDMainSize );
ok( !info->dwTypeIDMainOffset, "dwTypeIDMainOffset = %ld\n", info->dwTypeIDMainOffset );
ok( !info->dwTypeNameMainOffset, "dwTypeNameMainOffset = %ld\n", info->dwTypeNameMainOffset );
ok( !info->dwTypeIDMUISize, "dwTypeIDMUISize = %ld\n", info->dwTypeIDMUISize );
ok( !info->dwTypeIDMUIOffset, "dwTypeIDMUIOffset = %ld\n", info->dwTypeIDMUIOffset );
ok( !info->dwTypeNameMUIOffset, "dwTypeNameMUIOffset = %ld\n", info->dwTypeNameMUIOffset );
ok( !memcmp(info->abBuffer, zeros, sizeof(info->abBuffer)), "abBuffer = %s\n",
wine_dbgstr_an((char *)info->abBuffer, sizeof(info->abBuffer)) );
res = BeginUpdateResourceW( ln_dll, TRUE );
ok( res != NULL, "BeginUpdateResourceW failed: %ld\n", GetLastError() );
r = UpdateResourceW( res, L"MUI", MAKEINTRESOURCEW(1), 0, &ln_mui_res, 4 );
ok( r, "UpdateResource failed: %ld\n", GetLastError() );
ok( EndUpdateResourceW( res, FALSE ), "EndUpdateResourceW failed: %ld\n", GetLastError() );
size = 0;
r = GetFileMUIInfo( MUI_QUERY_TYPE | MUI_QUERY_CHECKSUM | MUI_QUERY_LANGUAGE_NAME
| MUI_QUERY_RESOURCE_TYPES, ln_dll, NULL, &size );
ok( !r, "GetFileMUIInfo succeeded\n" );
ok( GetLastError() == ERROR_BAD_EXE_FORMAT, "GetLastError() = %ld\n", GetLastError() );
res = BeginUpdateResourceW( ln_dll, TRUE );
ok( res != NULL, "BeginUpdateResourceW failed: %ld\n", GetLastError() );
r = UpdateResourceW( res, L"MUI", MAKEINTRESOURCEW(1), 0, &ln_mui_res, sizeof(ln_mui_res) );
ok( r, "UpdateResource failed: %ld\n", GetLastError() );
ok( EndUpdateResourceW( res, FALSE ), "EndUpdateResourceW failed: %ld\n", GetLastError() );
size = 0;
r = GetFileMUIInfo( MUI_QUERY_TYPE | MUI_QUERY_CHECKSUM | MUI_QUERY_LANGUAGE_NAME
| MUI_QUERY_RESOURCE_TYPES, ln_dll, NULL, &size );
ok( !r, "GetFileMUIInfo succeeded\n" );
ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %ld\n", GetLastError() );
ok( size, "size was not set\n" );
memset( buf, 0xfe, sizeof(buf) );
size = sizeof(buf);
info->dwSize = sizeof(buf);
info->dwVersion = MUI_FILEINFO_VERSION;
r = GetFileMUIInfo( MUI_QUERY_TYPE | MUI_QUERY_CHECKSUM | MUI_QUERY_LANGUAGE_NAME
| MUI_QUERY_RESOURCE_TYPES, ln_dll, info, &size );
ok( r, "GetFileMUIInfo failed: %ld\n", GetLastError() );
ok( info->dwSize == sizeof(buf), "dwSize = %ld\n", info->dwSize );
ok( info->dwVersion == MUI_FILEINFO_VERSION, "dwVersion = %ld\n", info->dwVersion );
ok( info->dwFileType == MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN, "dwFileType = %ld\n", info->dwFileType );
ok( info->pChecksum[0] == 'c', "pChecksum = %s\n",
wine_dbgstr_an((char *)info->pChecksum, sizeof(info->pChecksum)) );
ok( info->pServiceChecksum[0] == 's', "pServiceChecksum = %s\n",
wine_dbgstr_an((char *)info->pServiceChecksum, sizeof(info->pServiceChecksum)) );
ok( info->dwLanguageNameOffset == 72, "dwLanguageNameOffset = %ld\n", info->dwLanguageNameOffset );
str = (WCHAR *)(buf + info->dwLanguageNameOffset);
ok( !wcscmp(str, L"en-US"), "language name = %s\n", wine_dbgstr_w(str) );
ok( info->dwTypeIDMainSize == 1, "dwTypeIDMainSize = %ld\n", info->dwTypeIDMainSize );
ok( info->dwTypeIDMainOffset == 84, "dwTypeIDMainOffset = %ld\n", info->dwTypeIDMainOffset );
id = (DWORD *)(buf + info->dwTypeIDMainOffset);
ok( id[0] == RT_CURSOR, "type ID main[0] = %ld\n", id[0] );
ok( info->dwTypeNameMainOffset == 88, "dwTypeNameMainOffset = %ld\n", info->dwTypeNameMainOffset );
str = (WCHAR *)(buf + info->dwTypeNameMainOffset);
ok( !wcscmp(str, L"MUI"), "type name main[0] = %s\n", wine_dbgstr_w(str) );
str += wcslen(str) + 1;
ok( !str[0], "string list is not NULL terminated: %s\n", wine_dbgstr_w(str) );
ok( info->dwTypeIDMUISize == 1, "dwTypeIDMUISize = %ld\n", info->dwTypeIDMUISize );
ok( info->dwTypeIDMUIOffset == 98, "dwTypeIDMUIOffset = %ld\n", info->dwTypeIDMUIOffset );
id = (DWORD *)(buf + info->dwTypeIDMUIOffset);
ok( id[0] == RT_STRING, "type ID MUI[0] = %ld\n", id[0] );
ok( info->dwTypeNameMUIOffset == 102, "dwTypeNameMUIOffset = %ld\n", info->dwTypeNameMUIOffset );
str = (WCHAR *)(buf + info->dwTypeNameMUIOffset);
ok( !wcscmp(str, L"MUI"), "type name MUI[0] = %s\n", wine_dbgstr_w(str) );
str += wcslen(str) + 1;
ok( !str[0], "string list is not NULL terminated: %s\n", wine_dbgstr_w(str) );
res = BeginUpdateResourceW( en_dll, TRUE );
ok( res != NULL, "BeginUpdateResourceW failed: %ld\n", GetLastError() );
r = UpdateResourceW( res, L"MUI", MAKEINTRESOURCEW(1), 0, &en_mui_res, sizeof(en_mui_res) );
ok( r, "UpdateResource failed: %ld\n", GetLastError() );
ok( EndUpdateResourceW( res, FALSE ), "EndUpdateResourceW failed: %ld\n", GetLastError() );
memset( buf, 0xfe, sizeof(buf) );
size = sizeof(buf);
info->dwSize = sizeof(buf);
info->dwVersion = MUI_FILEINFO_VERSION;
r = GetFileMUIInfo( MUI_QUERY_TYPE | MUI_QUERY_CHECKSUM | MUI_QUERY_LANGUAGE_NAME
| MUI_QUERY_RESOURCE_TYPES, en_dll, info, &size );
ok( r, "GetFileMUIInfo failed: %ld\n", GetLastError() );
ok( info->dwSize == sizeof(buf), "dwSize = %ld\n", info->dwSize );
ok( info->dwVersion == MUI_FILEINFO_VERSION, "dwVersion = %ld\n", info->dwVersion );
ok( info->dwFileType == MUI_FILETYPE_LANGUAGE_NEUTRAL_MUI, "dwFileType = %ld\n", info->dwFileType );
ok( info->pChecksum[0] == 'c', "pChecksum = %s\n",
wine_dbgstr_an((char *)info->pChecksum, sizeof(info->pChecksum)) );
ok( info->pServiceChecksum[0] == 's', "pServiceChecksum = %s\n",
wine_dbgstr_an((char *)info->pServiceChecksum, sizeof(info->pServiceChecksum)) );
ok( info->dwLanguageNameOffset == 72, "dwLanguageNameOffset = %ld\n", info->dwLanguageNameOffset );
str = (WCHAR *)(buf + info->dwLanguageNameOffset);
ok( !wcscmp(str, L"en-US"), "language name = %s\n", wine_dbgstr_w(str) );
ok( !info->dwTypeIDMainSize, "dwTypeIDMainSize = %ld\n", info->dwTypeIDMainSize );
ok( !info->dwTypeIDMainOffset, "dwTypeIDMainOffset = %ld\n", info->dwTypeIDMainOffset );
ok( !info->dwTypeNameMainOffset, "dwTypeNameMainOffset = %ld\n", info->dwTypeNameMainOffset );
ok( info->dwTypeIDMUISize == 1, "dwTypeIDMUISize = %ld\n", info->dwTypeIDMUISize );
ok( info->dwTypeIDMUIOffset == 84, "dwTypeIDMUIOffset = %ld\n", info->dwTypeIDMUIOffset );
id = (DWORD *)(buf + info->dwTypeIDMUIOffset);
ok( id[0] == RT_STRING, "type ID MUI[0] = %ld\n", id[0] );
ok( info->dwTypeNameMUIOffset == 88, "dwTypeNameMUIOffset = %ld\n", info->dwTypeNameMUIOffset );
str = (WCHAR *)(buf + info->dwTypeNameMUIOffset);
ok( !wcscmp(str, L"MUI"), "type name MUI[0] = %s\n", wine_dbgstr_w(str) );
str += wcslen(str) + 1;
ok( !str[0], "string list is not NULL terminated: %s\n", wine_dbgstr_w(str) );
DeleteFileW( ln_dll );
DeleteFileW( en_dll );
RemoveDirectoryW( L"en-US" );
}
START_TEST(resource)
{
DWORD i;
@ -552,4 +844,5 @@ START_TEST(resource)
DeleteFileA( filename );
}
test_find_resource();
test_mui();
}

View File

@ -5719,15 +5719,221 @@ done:
}
#define MUI_SIGNATURE 0xfecdfecd
struct mui_resource
{
DWORD signature;
DWORD size;
DWORD version;
DWORD path_type;
DWORD file_type;
DWORD system_attributes;
DWORD fallback_location;
BYTE service_checksum[16];
BYTE checksum[16];
DWORD unk1[2];
DWORD mui_path_off;
DWORD mui_path_size;
DWORD unk2[2];
DWORD ln_type_name_off;
DWORD ln_type_name_size;
DWORD ln_type_id_off;
DWORD ln_type_id_size;
DWORD mui_type_name_off;
DWORD mui_type_name_size;
DWORD mui_type_id_off;
DWORD mui_type_id_size;
DWORD lang_off;
DWORD lang_size;
DWORD fallback_lang_off;
DWORD fallback_lang_size;
};
static BOOL validate_mui_resource(struct mui_resource *mui, DWORD size)
{
if (size >= sizeof(DWORD) && mui->signature != MUI_SIGNATURE)
{
SetLastError(ERROR_MUI_INVALID_RC_CONFIG);
return FALSE;
}
size = min( size, mui->size );
if (size < sizeof(*mui) ||
mui->ln_type_name_off >= size || mui->ln_type_name_size > size - mui->ln_type_name_off ||
mui->ln_type_id_off >= size || mui->ln_type_id_size > size - mui->ln_type_id_off ||
mui->mui_type_name_off >= size || mui->mui_type_name_size > size - mui->mui_type_name_off ||
mui->mui_type_id_off >= size || mui->mui_type_id_size > size - mui->mui_type_id_off ||
mui->lang_off >= size || mui->lang_size > size - mui->lang_off ||
mui->fallback_lang_off >= size || mui->fallback_lang_size > size - mui->fallback_lang_off)
{
SetLastError(ERROR_BAD_EXE_FORMAT);
return FALSE;
}
return TRUE;
}
/******************************************************************************
* GetFileMUIInfo (kernelbase.@)
*/
BOOL WINAPI /* DECLSPEC_HOTPATCH */ GetFileMUIInfo( DWORD flags, const WCHAR *path,
FILEMUIINFO *info, DWORD *size )
BOOL WINAPI DECLSPEC_HOTPATCH GetFileMUIInfo( DWORD flags, const WCHAR *path,
FILEMUIINFO *info, DWORD *size )
{
FIXME( "stub: %lu, %s, %p, %p\n", flags, debugstr_w(path), info, size );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return FALSE;
DWORD off, mui_size, type = MUI_FILETYPE_NOT_LANGUAGE_NEUTRAL;
struct mui_resource *mui = NULL;
HMODULE hmod;
HRSRC hrsrc;
TRACE( "%lu, %s, %p, %p\n", flags, debugstr_w(path), info, size );
if (!path || !size || (*size && !info) ||
(info && (*size < sizeof(*info) || info->dwSize != *size ||
info->dwVersion != MUI_FILEINFO_VERSION)))
{
if (size) *size = 0;
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
if (!flags) flags = MUI_QUERY_TYPE | MUI_QUERY_CHECKSUM;
hmod = LoadLibraryExW( path, NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE );
if (!hmod) return FALSE;
hrsrc = FindResourceW( hmod, MAKEINTRESOURCEW(1), L"MUI" );
if (hrsrc)
{
mui = LockResource( LoadResource(hmod, hrsrc) );
if (mui) mui_size = SizeofResource( hmod, hrsrc );
if (!mui || !validate_mui_resource( mui, mui_size ))
{
FreeLibrary( hmod );
return FALSE;
}
if (mui->file_type & (MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN >> 1))
type = MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN;
else if (mui->file_type & (MUI_FILETYPE_LANGUAGE_NEUTRAL_MUI >> 1))
type = MUI_FILETYPE_LANGUAGE_NEUTRAL_MUI;
}
if (type == MUI_FILETYPE_NOT_LANGUAGE_NEUTRAL)
{
FreeLibrary( hmod );
if (!info)
{
*size = sizeof(*info);
return TRUE;
}
if (info->dwSize < sizeof(*info))
{
SetLastError( ERROR_INSUFFICIENT_BUFFER );
return FALSE;
}
memset( info, 0, sizeof(*info) );
info->dwSize = *size;
info->dwVersion = MUI_FILEINFO_VERSION;
if (flags & MUI_QUERY_TYPE) info->dwFileType = type;
return TRUE;
}
off = offsetof(FILEMUIINFO, abBuffer);
if (flags & MUI_QUERY_LANGUAGE_NAME)
{
off += type == MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN ?
mui->fallback_lang_size : mui->lang_size;
}
if (flags & MUI_QUERY_RESOURCE_TYPES)
{
if (type == MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN)
off += mui->ln_type_name_size + mui->ln_type_id_size;
off += mui->mui_type_name_size + mui->mui_type_id_size;
}
if (off < sizeof(*info)) off = sizeof(*info);
if (!info || info->dwSize < off)
{
FreeLibrary( hmod );
*size = off;
SetLastError( ERROR_INSUFFICIENT_BUFFER );
return FALSE;
}
off = 0;
memset( info, 0, sizeof(*info) );
info->dwSize = *size;
info->dwVersion = MUI_FILEINFO_VERSION;
if (flags & MUI_QUERY_TYPE) info->dwFileType = type;
if (flags & MUI_QUERY_CHECKSUM)
{
memcpy( info->pChecksum, mui->checksum, sizeof(info->pChecksum) );
memcpy( info->pServiceChecksum, mui->service_checksum, sizeof(info->pServiceChecksum) );
}
if (flags & MUI_QUERY_LANGUAGE_NAME)
{
if (type == MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN && mui->fallback_lang_off)
{
info->dwLanguageNameOffset = offsetof(FILEMUIINFO, abBuffer);
memcpy(info->abBuffer, ((BYTE *)mui) + mui->fallback_lang_off,
mui->fallback_lang_size);
off += mui->fallback_lang_size;
}
if (type == MUI_FILETYPE_LANGUAGE_NEUTRAL_MUI && mui->lang_off)
{
info->dwLanguageNameOffset = offsetof(FILEMUIINFO, abBuffer);
memcpy(info->abBuffer, ((BYTE *)mui) + mui->lang_off, mui->lang_size);
off += mui->lang_size;
}
}
if (flags & MUI_QUERY_RESOURCE_TYPES && type & MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN)
{
if (mui->ln_type_id_size && mui->ln_type_id_off)
{
info->dwTypeIDMainSize = mui->ln_type_id_size / sizeof(DWORD);
info->dwTypeIDMainOffset = offsetof(FILEMUIINFO, abBuffer[off]);
memcpy(info->abBuffer + off, ((BYTE *)mui) + mui->ln_type_id_off, mui->ln_type_id_size);
off += mui->ln_type_id_size;
}
if (mui->ln_type_name_off)
{
info->dwTypeNameMainOffset = offsetof(FILEMUIINFO, abBuffer[off]);
memcpy(info->abBuffer + off, ((BYTE *)mui) + mui->ln_type_name_off, mui->ln_type_name_size);
off += mui->ln_type_name_size;
}
if (mui->mui_type_id_size && mui->mui_type_id_off)
{
info->dwTypeIDMUISize = mui->mui_type_id_size / sizeof(DWORD);
info->dwTypeIDMUIOffset = offsetof(FILEMUIINFO, abBuffer[off]);
memcpy(info->abBuffer + off, ((BYTE *)mui) + mui->mui_type_id_off, mui->mui_type_id_size);
off += mui->mui_type_id_size;
}
if (mui->mui_type_name_off)
{
info->dwTypeNameMUIOffset = offsetof(FILEMUIINFO, abBuffer[off]);
memcpy(info->abBuffer + off, ((BYTE *)mui) + mui->mui_type_name_off, mui->mui_type_name_size);
off += mui->mui_type_name_size;
}
}
else if(flags & MUI_QUERY_RESOURCE_TYPES)
{
if (mui->ln_type_id_size && mui->ln_type_id_off)
{
info->dwTypeIDMUISize = mui->ln_type_id_size / sizeof(DWORD);
info->dwTypeIDMUIOffset = offsetof(FILEMUIINFO, abBuffer[off]);
memcpy(info->abBuffer + off, ((BYTE *)mui) + mui->ln_type_id_off, mui->ln_type_id_size);
off += mui->ln_type_id_size;
}
if (mui->ln_type_name_off)
{
info->dwTypeNameMUIOffset = offsetof(FILEMUIINFO, abBuffer[off]);
memcpy(info->abBuffer + off, ((BYTE *)mui) + mui->ln_type_name_off, mui->ln_type_name_size);
off += mui->ln_type_name_size;
}
}
FreeLibrary( hmod );
return TRUE;
}

View File

@ -743,8 +743,7 @@
# @ stub RtlGetLengthWithoutTrailingPathSeperators
@ stdcall RtlGetLocaleFileMappingAddress(ptr ptr ptr)
@ stdcall RtlGetLongestNtPathLength()
@ stdcall -syscall -arch=win32 RtlGetNativeSystemInformation(long ptr long ptr) NtWow64GetNativeSystemInformation
@ stdcall -syscall -arch=win64 RtlGetNativeSystemInformation(long ptr long ptr) NtQuerySystemInformation
@ stdcall RtlGetNativeSystemInformation(long ptr long ptr)
# @ stub RtlGetNextRange
@ stdcall RtlGetNtGlobalFlags()
@ stdcall RtlGetNtProductType(ptr)

View File

@ -712,16 +712,6 @@ NTSTATUS WINAPI DbgUiIssueRemoteBreakin( HANDLE process )
status = NtCreateThreadEx( &handle, THREAD_ALL_ACCESS, &attr, process,
DbgUiRemoteBreakin, NULL, 0, 0, 0, 0, NULL );
#ifdef _WIN64
/* FIXME: hack for debugging 32-bit wow64 process without a 64-bit ntdll */
if (status == STATUS_INVALID_PARAMETER)
{
ULONG_PTR wow;
if (!NtQueryInformationProcess( process, ProcessWow64Information, &wow, sizeof(wow), NULL ) && wow)
status = NtCreateThreadEx( &handle, THREAD_ALL_ACCESS, &attr, process,
(void *)0x7ffe1000, NULL, 0, 0, 0, 0, NULL );
}
#endif
if (!status) NtClose( handle );
return status;
}

View File

@ -327,7 +327,8 @@ static NTSTATUS RTL_ReportRegistryValue(PKEY_VALUE_FULL_INFORMATION pInfo,
str->Buffer = RtlAllocateHeap(GetProcessHeap(), 0, len);
str->MaximumLength = len;
}
len = min(len, str->MaximumLength);
else if (str->MaximumLength < len)
return STATUS_BUFFER_TOO_SMALL;
len -= sizeof(WCHAR);
memcpy(str->Buffer, ((CHAR*)pInfo) + pInfo->DataOffset, len);
str->Buffer[len / sizeof(WCHAR)] = 0;
@ -375,8 +376,7 @@ static NTSTATUS RTL_ReportRegistryValue(PKEY_VALUE_FULL_INFORMATION pInfo,
dst.MaximumLength = res;
dst.Buffer = RtlAllocateHeap(GetProcessHeap(), 0, res * sizeof(WCHAR));
RtlExpandEnvironmentStrings_U(pEnvironment, &src, &dst, &res);
status = pQuery->QueryRoutine(pQuery->Name, pInfo->Type, dst.Buffer,
dst.Length, pContext, pQuery->EntryContext);
status = pQuery->QueryRoutine(pQuery->Name, REG_SZ, dst.Buffer, res, pContext, pQuery->EntryContext);
RtlFreeHeap(GetProcessHeap(), 0, dst.Buffer);
}
else /* REG_MULTI_SZ */

View File

@ -27,22 +27,16 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "winsock2.h"
#include "windef.h"
#include "winternl.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "ntdll_misc.h"
#include "in6addr.h"
#include "ddk/ntddk.h"
#include "ddk/ntifs.h"
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
WINE_DECLARE_DEBUG_CHANNEL(debugstr);
#define htons(x) RtlUshortByteSwap(x)
#define ntohs(x) RtlUshortByteSwap(x)
/* CRC polynomial 0xedb88320 */
static const DWORD CRC_table[256] =
{
@ -91,16 +85,6 @@ static const DWORD CRC_table[256] =
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
static const int hex_table[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x00-0x0F */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x10-0x1F */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x20-0x2F */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, /* 0x30-0x3F */
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x40-0x4F */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x50-0x5F */
-1, 10, 11, 12, 13, 14, 15 /* 0x60-0x66 */
};
static LONG WINAPI debug_exception_handler( EXCEPTION_POINTERS *eptr )
{
@ -419,632 +403,6 @@ ULONG WINAPI RtlRandomEx( ULONG *seed )
return RtlRandom( seed );
}
static BOOL parse_ipv4_component(const WCHAR **str, BOOL strict, ULONG *value)
{
int base = 10, d;
WCHAR c;
ULONG cur_value, prev_value = 0;
BOOL success = FALSE;
if (**str == '.')
{
*str += 1;
return FALSE;
}
if ((*str)[0] == '0')
{
if ((*str)[1] == 'x' || (*str)[1] == 'X')
{
*str += 2;
if (strict) return FALSE;
base = 16;
}
else if ((*str)[1] >= '0' && (*str)[1] <= '9')
{
*str += 1;
if (strict) return FALSE;
base = 8;
}
}
for (cur_value = 0; **str; *str += 1)
{
c = **str;
if (c >= ARRAY_SIZE(hex_table)) break;
d = hex_table[c];
if (d == -1 || d >= base) break;
cur_value = cur_value * base + d;
success = TRUE;
if (cur_value < prev_value) return FALSE; /* overflow */
prev_value = cur_value;
}
if (success) *value = cur_value;
return success;
}
static NTSTATUS ipv4_string_to_address(const WCHAR *str, BOOL strict,
const WCHAR **terminator, IN_ADDR *address, USHORT *port)
{
ULONG fields[4];
int n = 0;
for (;;)
{
if (!parse_ipv4_component(&str, strict, &fields[n]))
goto error;
n++;
if (*str != '.')
break;
if (n == 4)
goto error;
str++;
}
if (strict && n < 4)
goto error;
switch (n)
{
case 4:
if (fields[0] > 0xFF || fields[1] > 0xFF || fields[2] > 0xFF || fields[3] > 0xFF)
goto error;
address->S_un.S_un_b.s_b1 = fields[0];
address->S_un.S_un_b.s_b2 = fields[1];
address->S_un.S_un_b.s_b3 = fields[2];
address->S_un.S_un_b.s_b4 = fields[3];
break;
case 3:
if (fields[0] > 0xFF || fields[1] > 0xFF || fields[2] > 0xFFFF)
goto error;
address->S_un.S_un_b.s_b1 = fields[0];
address->S_un.S_un_b.s_b2 = fields[1];
address->S_un.S_un_b.s_b3 = (fields[2] & 0xFF00) >> 8;
address->S_un.S_un_b.s_b4 = (fields[2] & 0x00FF);
break;
case 2:
if (fields[0] > 0xFF || fields[1] > 0xFFFFFF)
goto error;
address->S_un.S_un_b.s_b1 = fields[0];
address->S_un.S_un_b.s_b2 = (fields[1] & 0xFF0000) >> 16;
address->S_un.S_un_b.s_b3 = (fields[1] & 0x00FF00) >> 8;
address->S_un.S_un_b.s_b4 = (fields[1] & 0x0000FF);
break;
case 1:
address->S_un.S_un_b.s_b1 = (fields[0] & 0xFF000000) >> 24;
address->S_un.S_un_b.s_b2 = (fields[0] & 0x00FF0000) >> 16;
address->S_un.S_un_b.s_b3 = (fields[0] & 0x0000FF00) >> 8;
address->S_un.S_un_b.s_b4 = (fields[0] & 0x000000FF);
break;
default:
goto error;
}
if (terminator) *terminator = str;
if (*str == ':')
{
str++;
if (!parse_ipv4_component(&str, FALSE, &fields[0]))
goto error;
if (!fields[0] || fields[0] > 0xFFFF || *str)
goto error;
if (port)
{
*port = htons(fields[0]);
if (terminator) *terminator = str;
}
}
if (!terminator && *str)
return STATUS_INVALID_PARAMETER;
return STATUS_SUCCESS;
error:
if (terminator) *terminator = str;
return STATUS_INVALID_PARAMETER;
}
/***********************************************************************
* RtlIpv4StringToAddressExW [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv4StringToAddressExW(const WCHAR *str, BOOLEAN strict, IN_ADDR *address, USHORT *port)
{
TRACE("(%s, %u, %p, %p)\n", debugstr_w(str), strict, address, port);
if (!str || !address || !port) return STATUS_INVALID_PARAMETER;
return ipv4_string_to_address(str, strict, NULL, address, port);
}
/***********************************************************************
* RtlIpv4StringToAddressW [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv4StringToAddressW(const WCHAR *str, BOOLEAN strict, const WCHAR **terminator, IN_ADDR *address)
{
TRACE("(%s, %u, %p, %p)\n", debugstr_w(str), strict, terminator, address);
return ipv4_string_to_address(str, strict, terminator, address, NULL);
}
/***********************************************************************
* RtlIpv4StringToAddressExA [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv4StringToAddressExA(const char *str, BOOLEAN strict, IN_ADDR *address, USHORT *port)
{
WCHAR wstr[32];
TRACE("(%s, %u, %p, %p)\n", debugstr_a(str), strict, address, port);
if (!str || !address || !port)
return STATUS_INVALID_PARAMETER;
RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1);
wstr[ARRAY_SIZE(wstr) - 1] = 0;
return ipv4_string_to_address(wstr, strict, NULL, address, port);
}
/***********************************************************************
* RtlIpv4StringToAddressA [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv4StringToAddressA(const char *str, BOOLEAN strict, const char **terminator, IN_ADDR *address)
{
WCHAR wstr[32];
const WCHAR *wterminator;
NTSTATUS ret;
TRACE("(%s, %u, %p, %p)\n", debugstr_a(str), strict, terminator, address);
RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1);
wstr[ARRAY_SIZE(wstr) - 1] = 0;
ret = ipv4_string_to_address(wstr, strict, &wterminator, address, NULL);
if (terminator) *terminator = str + (wterminator - wstr);
return ret;
}
static BOOL parse_ipv6_component(const WCHAR **str, int base, ULONG *value)
{
WCHAR *terminator;
if (**str >= ARRAY_SIZE(hex_table) || hex_table[**str] == -1) return FALSE;
*value = min(wcstoul(*str, &terminator, base), 0x7FFFFFFF);
if (*terminator == '0') terminator++; /* "0x" but nothing valid after */
else if (terminator == *str) return FALSE;
*str = terminator;
return TRUE;
}
static NTSTATUS ipv6_string_to_address(const WCHAR *str, BOOL ex,
const WCHAR **terminator, IN6_ADDR *address, ULONG *scope, USHORT *port)
{
BOOL expecting_port = FALSE, has_0x = FALSE, too_big = FALSE;
int n_bytes = 0, n_ipv4_bytes = 0, gap = -1;
ULONG ip_component, scope_component = 0, port_component = 0;
const WCHAR *prev_str;
if (str[0] == '[')
{
if (!ex) goto error;
expecting_port = TRUE;
str++;
}
if (str[0] == ':')
{
if (str[1] != ':') goto error;
str++;
address->u.Word[0] = 0;
}
for (;;)
{
if (!n_ipv4_bytes && *str == ':')
{
/* double colon */
if (gap != -1) goto error;
str++;
prev_str = str;
gap = n_bytes;
if (n_bytes == 14 || !parse_ipv6_component(&str, 16, &ip_component)) break;
str = prev_str;
}
else
{
prev_str = str;
}
if (!n_ipv4_bytes && n_bytes <= (gap != -1 ? 10 : 12))
{
if (parse_ipv6_component(&str, 10, &ip_component) && *str == '.')
n_ipv4_bytes = 1;
str = prev_str;
}
if (n_ipv4_bytes)
{
/* IPv4 component */
if (!parse_ipv6_component(&str, 10, &ip_component)) goto error;
if (str - prev_str > 3 || ip_component > 255)
{
too_big = TRUE;
}
else
{
if (*str != '.' && (n_ipv4_bytes < 4 || (n_bytes < 15 && gap == -1))) goto error;
address->u.Byte[n_bytes] = ip_component;
n_bytes++;
}
if (n_ipv4_bytes == 4 || *str != '.') break;
n_ipv4_bytes++;
}
else
{
/* IPv6 component */
if (!parse_ipv6_component(&str, 16, &ip_component)) goto error;
if (prev_str[0] == '0' && (prev_str[1] == 'x' || prev_str[1] == 'X'))
{
/* Windows "feature": the last IPv6 component can start with "0x" and be longer than 4 digits */
if (terminator) *terminator = prev_str + 1; /* Windows says that the "x" is the terminator */
if (n_bytes < 14 && gap == -1) return STATUS_INVALID_PARAMETER;
address->u.Word[n_bytes/2] = htons(ip_component);
n_bytes += 2;
has_0x = TRUE;
goto fill_gap;
}
if (*str != ':' && n_bytes < 14 && gap == -1) goto error;
if (str - prev_str > 4)
too_big = TRUE;
else
address->u.Word[n_bytes/2] = htons(ip_component);
n_bytes += 2;
if (*str != ':' || (gap != -1 && str[1] == ':')) break;
}
if (n_bytes == (gap != -1 ? 14 : 16)) break;
if (too_big) return STATUS_INVALID_PARAMETER;
str++;
}
if (terminator) *terminator = str;
if (too_big) return STATUS_INVALID_PARAMETER;
fill_gap:
if (gap == -1)
{
if (n_bytes < 16) goto error;
}
else
{
memmove(address->u.Byte + 16 - (n_bytes - gap), address->u.Byte + gap, n_bytes - gap);
memset(address->u.Byte + gap, 0, 16 - n_bytes);
}
if (ex)
{
if (has_0x) goto error;
if (*str == '%')
{
str++;
if (!parse_ipv4_component(&str, TRUE, &scope_component)) goto error;
}
if (expecting_port)
{
if (*str != ']') goto error;
str++;
if (*str == ':')
{
str++;
if (!parse_ipv4_component(&str, FALSE, &port_component)) goto error;
if (!port_component || port_component > 0xFFFF || *str) goto error;
port_component = htons(port_component);
}
}
}
if (!terminator && *str) return STATUS_INVALID_PARAMETER;
if (scope) *scope = scope_component;
if (port) *port = port_component;
return STATUS_SUCCESS;
error:
if (terminator) *terminator = str;
return STATUS_INVALID_PARAMETER;
}
/***********************************************************************
* RtlIpv6StringToAddressExW [NTDLL.@]
*/
NTSTATUS NTAPI RtlIpv6StringToAddressExW(const WCHAR *str, IN6_ADDR *address, ULONG *scope, USHORT *port)
{
TRACE("(%s, %p, %p, %p)\n", debugstr_w(str), address, scope, port);
if (!str || !address || !scope || !port) return STATUS_INVALID_PARAMETER;
return ipv6_string_to_address(str, TRUE, NULL, address, scope, port);
}
/***********************************************************************
* RtlIpv6StringToAddressW [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv6StringToAddressW(const WCHAR *str, const WCHAR **terminator, IN6_ADDR *address)
{
TRACE("(%s, %p, %p)\n", debugstr_w(str), terminator, address);
return ipv6_string_to_address(str, FALSE, terminator, address, NULL, NULL);
}
/***********************************************************************
* RtlIpv6StringToAddressExA [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv6StringToAddressExA(const char *str, IN6_ADDR *address, ULONG *scope, USHORT *port)
{
WCHAR wstr[128];
TRACE("(%s, %p, %p, %p)\n", debugstr_a(str), address, scope, port);
if (!str || !address || !scope || !port)
return STATUS_INVALID_PARAMETER;
RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1);
wstr[ARRAY_SIZE(wstr) - 1] = 0;
return ipv6_string_to_address(wstr, TRUE, NULL, address, scope, port);
}
/***********************************************************************
* RtlIpv6StringToAddressA [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv6StringToAddressA(const char *str, const char **terminator, IN6_ADDR *address)
{
WCHAR wstr[128];
const WCHAR *wterminator = NULL;
NTSTATUS ret;
TRACE("(%s, %p, %p)\n", debugstr_a(str), terminator, address);
RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1);
wstr[ARRAY_SIZE(wstr) - 1] = 0;
ret = ipv6_string_to_address(wstr, FALSE, &wterminator, address, NULL, NULL);
if (terminator && wterminator) *terminator = str + (wterminator - wstr);
return ret;
}
/***********************************************************************
* RtlIpv4AddressToStringExW [NTDLL.@]
*
* Convert the given ipv4 address and optional the port to a string
*
* PARAMS
* pin [I] PTR to the ip address to convert (network byte order)
* port [I] optional port to convert (network byte order)
* buffer [O] destination buffer for the result
* psize [IO] PTR to available/used size of the destination buffer
*
* RETURNS
* Success: STATUS_SUCCESS
* Failure: STATUS_INVALID_PARAMETER
*
*/
NTSTATUS WINAPI RtlIpv4AddressToStringExW(const IN_ADDR *pin, USHORT port, LPWSTR buffer, PULONG psize)
{
WCHAR tmp_ip[32];
ULONG needed;
if (!pin || !buffer || !psize)
return STATUS_INVALID_PARAMETER;
TRACE("(%p:0x%lx, %d, %p, %p:%ld)\n", pin, pin->S_un.S_addr, port, buffer, psize, *psize);
needed = swprintf(tmp_ip, ARRAY_SIZE(tmp_ip), L"%u.%u.%u.%u",
pin->S_un.S_un_b.s_b1, pin->S_un.S_un_b.s_b2,
pin->S_un.S_un_b.s_b3, pin->S_un.S_un_b.s_b4);
if (port) needed += swprintf(tmp_ip + needed, ARRAY_SIZE(tmp_ip) - needed, L":%u", ntohs(port));
if (*psize > needed) {
*psize = needed + 1;
wcscpy(buffer, tmp_ip);
return STATUS_SUCCESS;
}
*psize = needed + 1;
return STATUS_INVALID_PARAMETER;
}
/***********************************************************************
* RtlIpv4AddressToStringExA [NTDLL.@]
*
* Convert the given ipv4 address and optional the port to a string
*
* See RtlIpv4AddressToStringExW
*/
NTSTATUS WINAPI RtlIpv4AddressToStringExA(const IN_ADDR *pin, USHORT port, LPSTR buffer, PULONG psize)
{
CHAR tmp_ip[32];
ULONG needed;
if (!pin || !buffer || !psize)
return STATUS_INVALID_PARAMETER;
TRACE("(%p:0x%lx, %d, %p, %p:%ld)\n", pin, pin->S_un.S_addr, port, buffer, psize, *psize);
needed = sprintf(tmp_ip, "%u.%u.%u.%u",
pin->S_un.S_un_b.s_b1, pin->S_un.S_un_b.s_b2,
pin->S_un.S_un_b.s_b3, pin->S_un.S_un_b.s_b4);
if (port) needed += sprintf(tmp_ip + needed, ":%u", ntohs(port));
if (*psize > needed) {
*psize = needed + 1;
strcpy(buffer, tmp_ip);
return STATUS_SUCCESS;
}
*psize = needed + 1;
return STATUS_INVALID_PARAMETER;
}
/***********************************************************************
* RtlIpv4AddressToStringW [NTDLL.@]
*
* Convert the given ipv4 address to a string
*
* PARAMS
* pin [I] PTR to the ip address to convert (network byte order)
* buffer [O] destination buffer for the result (at least 16 character)
*
* RETURNS
* PTR to the 0 character at the end of the converted string
*
*/
WCHAR * WINAPI RtlIpv4AddressToStringW(const IN_ADDR *pin, LPWSTR buffer)
{
ULONG size = 16;
if (RtlIpv4AddressToStringExW(pin, 0, buffer, &size)) size = 0;
return buffer + size - 1;
}
/***********************************************************************
* RtlIpv4AddressToStringA [NTDLL.@]
*
* Convert the given ipv4 address to a string
*
* See RtlIpv4AddressToStringW
*/
CHAR * WINAPI RtlIpv4AddressToStringA(const IN_ADDR *pin, LPSTR buffer)
{
ULONG size = 16;
if (RtlIpv4AddressToStringExA(pin, 0, buffer, &size)) size = 0;
return buffer + size - 1;
}
static BOOL is_ipv4_in_ipv6(const IN6_ADDR *address)
{
if (address->s6_words[5] == htons(0x5efe) && (address->s6_words[4] & ~htons(0x200)) == 0)
return TRUE;
if (*(UINT64 *)address != 0)
return FALSE;
if (address->s6_words[4] != 0 && address->s6_words[4] != 0xffff)
return FALSE;
if (address->s6_words[4] == 0 && address->s6_words[5] != 0 && address->s6_words[5] != 0xffff)
return FALSE;
if (address->s6_words[4] == 0xffff && address->s6_words[5] != 0)
return FALSE;
if (address->s6_words[6] == 0)
return FALSE;
return TRUE;
}
/***********************************************************************
* RtlIpv6AddressToStringExA [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv6AddressToStringExA(const IN6_ADDR *address, ULONG scope, USHORT port, char *str, ULONG *size)
{
char buffer[64], *p = buffer;
int i, len, gap = -1, gap_len = 1, ipv6_end = 8;
ULONG needed;
NTSTATUS ret;
TRACE("(%p %lu %u %p %p)\n", address, scope, port, str, size);
if (!address || !str || !size)
return STATUS_INVALID_PARAMETER;
if (is_ipv4_in_ipv6(address))
ipv6_end = 6;
for (i = 0; i < ipv6_end; i++)
{
len = 0;
while (!address->s6_words[i] && i < ipv6_end)
{
i++;
len++;
}
if (len > gap_len)
{
gap = i - len;
gap_len = len;
}
}
if (port) p += sprintf(p, "[");
i = 0;
while (i < ipv6_end)
{
if (i == gap)
{
p += sprintf(p, ":");
i += gap_len;
if (i == ipv6_end) p += sprintf(p, ":");
continue;
}
if (i > 0) p += sprintf(p, ":");
p += sprintf(p, "%x", ntohs(address->s6_words[i]));
i++;
}
if (ipv6_end == 6)
{
if (p[-1] != ':') p += sprintf(p, ":");
p = RtlIpv4AddressToStringA((IN_ADDR *)(address->s6_words + 6), p);
}
if (scope) p += sprintf(p, "%%%lu", scope);
if (port) p += sprintf(p, "]:%u", ntohs(port));
needed = p - buffer + 1;
if (*size >= needed)
{
strcpy(str, buffer);
ret = STATUS_SUCCESS;
}
else
{
ret = STATUS_INVALID_PARAMETER;
}
*size = needed;
return ret;
}
/***********************************************************************
* RtlIpv6AddressToStringA [NTDLL.@]
*/
char * WINAPI RtlIpv6AddressToStringA(const IN6_ADDR *address, char *str)
{
ULONG size = 46;
if (!address || !str) return str - 1;
str[45] = 0; /* this byte is set even though the string is always shorter */
RtlIpv6AddressToStringExA(address, 0, 0, str, &size);
return str + size - 1;
}
/***********************************************************************
* RtlIpv6AddressToStringExW [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv6AddressToStringExW(const IN6_ADDR *address, ULONG scope, USHORT port, WCHAR *str, ULONG *size)
{
char cstr[64];
NTSTATUS ret = RtlIpv6AddressToStringExA(address, scope, port, cstr, size);
if (ret == STATUS_SUCCESS) RtlMultiByteToUnicodeN(str, *size * sizeof(WCHAR), NULL, cstr, *size);
return ret;
}
/***********************************************************************
* RtlIpv6AddressToStringW [NTDLL.@]
*/
WCHAR * WINAPI RtlIpv6AddressToStringW(const IN6_ADDR *address, WCHAR *str)
{
ULONG size = 46;
if (!address || !str) return str;
str[45] = 0; /* this word is set even though the string is always shorter */
if (RtlIpv6AddressToStringExW(address, 0, 0, str, &size) != STATUS_SUCCESS)
return str;
return str + size - 1;
}
/***********************************************************************
* get_pointer_obfuscator (internal)
*/
@ -1421,40 +779,6 @@ void WINAPI RtlGetCurrentProcessorNumberEx(PROCESSOR_NUMBER *processor)
processor->Reserved = 0;
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
#ifdef __aarch64__
static const ULONGLONG arm64_features =
(1ull << PF_COMPARE_EXCHANGE_DOUBLE) |
(1ull << PF_NX_ENABLED) |
(1ull << PF_ARM_VFP_32_REGISTERS_AVAILABLE) |
(1ull << PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_SECOND_LEVEL_ADDRESS_TRANSLATION) |
(1ull << PF_FASTFAIL_AVAILABLE) |
(1ull << PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE) |
(1ull << PF_ARM_64BIT_LOADSTORE_ATOMIC) |
(1ull << PF_ARM_EXTERNAL_CACHE_AVAILABLE) |
(1ull << PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE);
return (feature < PROCESSOR_FEATURE_MAX && (arm64_features & (1ull << feature)) &&
user_shared_data->ProcessorFeatures[feature]);
#elif defined _WIN64
return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature];
#else
return NtWow64IsProcessorFeaturePresent( feature );
#endif
}
/***********************************************************************
* RtlInitializeGenericTableAvl (NTDLL.@)
*/

View File

@ -27,10 +27,12 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "winsock2.h"
#include "windef.h"
#include "winnt.h"
#include "winternl.h"
#include "ddk/ntddk.h"
#include "in6addr.h"
#include "wine/debug.h"
#include "ntdll_misc.h"
@ -1943,3 +1945,606 @@ NTSTATUS WINAPI RtlFormatMessageEx( const WCHAR *src, ULONG width, BOOLEAN ignor
*retsize = (buffer - start) * sizeof(WCHAR);
return STATUS_SUCCESS;
}
/***********************************************************************
* IP addresses
***********************************************************************/
#define htons(x) RtlUshortByteSwap(x)
#define ntohs(x) RtlUshortByteSwap(x)
static const signed char hex_table[] =
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x00-0x0F */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x10-0x1F */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x20-0x2F */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, /* 0x30-0x3F */
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x40-0x4F */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x50-0x5F */
-1, 10, 11, 12, 13, 14, 15 /* 0x60-0x66 */
};
static BOOL parse_ipv4_component(const WCHAR **str, BOOL strict, ULONG *value)
{
int base = 10, d;
WCHAR c;
ULONG cur_value, prev_value = 0;
BOOL success = FALSE;
if (**str == '.')
{
*str += 1;
return FALSE;
}
if ((*str)[0] == '0')
{
if ((*str)[1] == 'x' || (*str)[1] == 'X')
{
*str += 2;
if (strict) return FALSE;
base = 16;
}
else if ((*str)[1] >= '0' && (*str)[1] <= '9')
{
*str += 1;
if (strict) return FALSE;
base = 8;
}
}
for (cur_value = 0; **str; *str += 1)
{
c = **str;
if (c >= ARRAY_SIZE(hex_table)) break;
d = hex_table[c];
if (d == -1 || d >= base) break;
cur_value = cur_value * base + d;
success = TRUE;
if (cur_value < prev_value) return FALSE; /* overflow */
prev_value = cur_value;
}
if (success) *value = cur_value;
return success;
}
static NTSTATUS ipv4_string_to_address(const WCHAR *str, BOOL strict,
const WCHAR **terminator, IN_ADDR *address, USHORT *port)
{
ULONG fields[4];
int n = 0;
for (;;)
{
if (!parse_ipv4_component(&str, strict, &fields[n]))
goto error;
n++;
if (*str != '.')
break;
if (n == 4)
goto error;
str++;
}
if (strict && n < 4)
goto error;
switch (n)
{
case 4:
if (fields[0] > 0xFF || fields[1] > 0xFF || fields[2] > 0xFF || fields[3] > 0xFF)
goto error;
address->S_un.S_un_b.s_b1 = fields[0];
address->S_un.S_un_b.s_b2 = fields[1];
address->S_un.S_un_b.s_b3 = fields[2];
address->S_un.S_un_b.s_b4 = fields[3];
break;
case 3:
if (fields[0] > 0xFF || fields[1] > 0xFF || fields[2] > 0xFFFF)
goto error;
address->S_un.S_un_b.s_b1 = fields[0];
address->S_un.S_un_b.s_b2 = fields[1];
address->S_un.S_un_b.s_b3 = (fields[2] & 0xFF00) >> 8;
address->S_un.S_un_b.s_b4 = (fields[2] & 0x00FF);
break;
case 2:
if (fields[0] > 0xFF || fields[1] > 0xFFFFFF)
goto error;
address->S_un.S_un_b.s_b1 = fields[0];
address->S_un.S_un_b.s_b2 = (fields[1] & 0xFF0000) >> 16;
address->S_un.S_un_b.s_b3 = (fields[1] & 0x00FF00) >> 8;
address->S_un.S_un_b.s_b4 = (fields[1] & 0x0000FF);
break;
case 1:
address->S_un.S_un_b.s_b1 = (fields[0] & 0xFF000000) >> 24;
address->S_un.S_un_b.s_b2 = (fields[0] & 0x00FF0000) >> 16;
address->S_un.S_un_b.s_b3 = (fields[0] & 0x0000FF00) >> 8;
address->S_un.S_un_b.s_b4 = (fields[0] & 0x000000FF);
break;
default:
goto error;
}
if (terminator) *terminator = str;
if (*str == ':')
{
str++;
if (!parse_ipv4_component(&str, FALSE, &fields[0]))
goto error;
if (!fields[0] || fields[0] > 0xFFFF || *str)
goto error;
if (port)
{
*port = htons(fields[0]);
if (terminator) *terminator = str;
}
}
if (!terminator && *str)
return STATUS_INVALID_PARAMETER;
return STATUS_SUCCESS;
error:
if (terminator) *terminator = str;
return STATUS_INVALID_PARAMETER;
}
/***********************************************************************
* RtlIpv4StringToAddressExW [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv4StringToAddressExW(const WCHAR *str, BOOLEAN strict, IN_ADDR *address, USHORT *port)
{
TRACE("(%s, %u, %p, %p)\n", debugstr_w(str), strict, address, port);
if (!str || !address || !port) return STATUS_INVALID_PARAMETER;
return ipv4_string_to_address(str, strict, NULL, address, port);
}
/***********************************************************************
* RtlIpv4StringToAddressW [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv4StringToAddressW(const WCHAR *str, BOOLEAN strict, const WCHAR **terminator, IN_ADDR *address)
{
TRACE("(%s, %u, %p, %p)\n", debugstr_w(str), strict, terminator, address);
return ipv4_string_to_address(str, strict, terminator, address, NULL);
}
/***********************************************************************
* RtlIpv4StringToAddressExA [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv4StringToAddressExA(const char *str, BOOLEAN strict, IN_ADDR *address, USHORT *port)
{
WCHAR wstr[32];
if (!str) return STATUS_INVALID_PARAMETER;
RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1);
wstr[ARRAY_SIZE(wstr) - 1] = 0;
return RtlIpv4StringToAddressExW(wstr, strict, address, port);
}
/***********************************************************************
* RtlIpv4StringToAddressA [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv4StringToAddressA(const char *str, BOOLEAN strict, const char **terminator, IN_ADDR *address)
{
WCHAR wstr[32];
const WCHAR *wterminator;
NTSTATUS ret;
RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1);
wstr[ARRAY_SIZE(wstr) - 1] = 0;
ret = RtlIpv4StringToAddressW(wstr, strict, &wterminator, address);
if (terminator) *terminator = str + (wterminator - wstr);
return ret;
}
static BOOL parse_ipv6_component(const WCHAR **str, int base, ULONG *value)
{
WCHAR *terminator;
if (**str >= ARRAY_SIZE(hex_table) || hex_table[**str] == -1) return FALSE;
*value = min(wcstoul(*str, &terminator, base), 0x7FFFFFFF);
if (*terminator == '0') terminator++; /* "0x" but nothing valid after */
else if (terminator == *str) return FALSE;
*str = terminator;
return TRUE;
}
static NTSTATUS ipv6_string_to_address(const WCHAR *str, BOOL ex,
const WCHAR **terminator, IN6_ADDR *address, ULONG *scope, USHORT *port)
{
BOOL expecting_port = FALSE, has_0x = FALSE, too_big = FALSE;
int n_bytes = 0, n_ipv4_bytes = 0, gap = -1;
ULONG ip_component, scope_component = 0, port_component = 0;
const WCHAR *prev_str;
if (str[0] == '[')
{
if (!ex) goto error;
expecting_port = TRUE;
str++;
}
if (str[0] == ':')
{
if (str[1] != ':') goto error;
str++;
address->u.Word[0] = 0;
}
for (;;)
{
if (!n_ipv4_bytes && *str == ':')
{
/* double colon */
if (gap != -1) goto error;
str++;
prev_str = str;
gap = n_bytes;
if (n_bytes == 14 || !parse_ipv6_component(&str, 16, &ip_component)) break;
str = prev_str;
}
else
{
prev_str = str;
}
if (!n_ipv4_bytes && n_bytes <= (gap != -1 ? 10 : 12))
{
if (parse_ipv6_component(&str, 10, &ip_component) && *str == '.')
n_ipv4_bytes = 1;
str = prev_str;
}
if (n_ipv4_bytes)
{
/* IPv4 component */
if (!parse_ipv6_component(&str, 10, &ip_component)) goto error;
if (str - prev_str > 3 || ip_component > 255)
{
too_big = TRUE;
}
else
{
if (*str != '.' && (n_ipv4_bytes < 4 || (n_bytes < 15 && gap == -1))) goto error;
address->u.Byte[n_bytes] = ip_component;
n_bytes++;
}
if (n_ipv4_bytes == 4 || *str != '.') break;
n_ipv4_bytes++;
}
else
{
/* IPv6 component */
if (!parse_ipv6_component(&str, 16, &ip_component)) goto error;
if (prev_str[0] == '0' && (prev_str[1] == 'x' || prev_str[1] == 'X'))
{
/* Windows "feature": the last IPv6 component can start with "0x" and be longer than 4 digits */
if (terminator) *terminator = prev_str + 1; /* Windows says that the "x" is the terminator */
if (n_bytes < 14 && gap == -1) return STATUS_INVALID_PARAMETER;
address->u.Word[n_bytes/2] = htons(ip_component);
n_bytes += 2;
has_0x = TRUE;
goto fill_gap;
}
if (*str != ':' && n_bytes < 14 && gap == -1) goto error;
if (str - prev_str > 4)
too_big = TRUE;
else
address->u.Word[n_bytes/2] = htons(ip_component);
n_bytes += 2;
if (*str != ':' || (gap != -1 && str[1] == ':')) break;
}
if (n_bytes == (gap != -1 ? 14 : 16)) break;
if (too_big) return STATUS_INVALID_PARAMETER;
str++;
}
if (terminator) *terminator = str;
if (too_big) return STATUS_INVALID_PARAMETER;
fill_gap:
if (gap == -1)
{
if (n_bytes < 16) goto error;
}
else
{
memmove(address->u.Byte + 16 - (n_bytes - gap), address->u.Byte + gap, n_bytes - gap);
memset(address->u.Byte + gap, 0, 16 - n_bytes);
}
if (ex)
{
if (has_0x) goto error;
if (*str == '%')
{
str++;
if (!parse_ipv4_component(&str, TRUE, &scope_component)) goto error;
}
if (expecting_port)
{
if (*str != ']') goto error;
str++;
if (*str == ':')
{
str++;
if (!parse_ipv4_component(&str, FALSE, &port_component)) goto error;
if (!port_component || port_component > 0xFFFF || *str) goto error;
port_component = htons(port_component);
}
}
}
if (!terminator && *str) return STATUS_INVALID_PARAMETER;
if (scope) *scope = scope_component;
if (port) *port = port_component;
return STATUS_SUCCESS;
error:
if (terminator) *terminator = str;
return STATUS_INVALID_PARAMETER;
}
/***********************************************************************
* RtlIpv6StringToAddressExW [NTDLL.@]
*/
NTSTATUS NTAPI RtlIpv6StringToAddressExW(const WCHAR *str, IN6_ADDR *address, ULONG *scope, USHORT *port)
{
TRACE("(%s, %p, %p, %p)\n", debugstr_w(str), address, scope, port);
if (!str || !address || !scope || !port) return STATUS_INVALID_PARAMETER;
return ipv6_string_to_address(str, TRUE, NULL, address, scope, port);
}
/***********************************************************************
* RtlIpv6StringToAddressW [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv6StringToAddressW(const WCHAR *str, const WCHAR **terminator, IN6_ADDR *address)
{
TRACE("(%s, %p, %p)\n", debugstr_w(str), terminator, address);
return ipv6_string_to_address(str, FALSE, terminator, address, NULL, NULL);
}
/***********************************************************************
* RtlIpv6StringToAddressExA [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv6StringToAddressExA(const char *str, IN6_ADDR *address, ULONG *scope, USHORT *port)
{
WCHAR wstr[128];
if (!str) return STATUS_INVALID_PARAMETER;
RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1);
wstr[ARRAY_SIZE(wstr) - 1] = 0;
return RtlIpv6StringToAddressExW(wstr, address, scope, port);
}
/***********************************************************************
* RtlIpv6StringToAddressA [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv6StringToAddressA(const char *str, const char **terminator, IN6_ADDR *address)
{
WCHAR wstr[128];
const WCHAR *wterminator = NULL;
NTSTATUS ret;
RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1);
wstr[ARRAY_SIZE(wstr) - 1] = 0;
ret = RtlIpv6StringToAddressW(wstr, &wterminator, address);
if (terminator && wterminator) *terminator = str + (wterminator - wstr);
return ret;
}
/***********************************************************************
* RtlIpv4AddressToStringExW [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv4AddressToStringExW(const IN_ADDR *pin, USHORT port, LPWSTR buffer, PULONG psize)
{
WCHAR tmp_ip[32];
ULONG needed;
if (!pin || !buffer || !psize)
return STATUS_INVALID_PARAMETER;
TRACE("(%p:0x%lx, %d, %p, %p:%ld)\n", pin, pin->S_un.S_addr, port, buffer, psize, *psize);
needed = swprintf(tmp_ip, ARRAY_SIZE(tmp_ip), L"%u.%u.%u.%u",
pin->S_un.S_un_b.s_b1, pin->S_un.S_un_b.s_b2,
pin->S_un.S_un_b.s_b3, pin->S_un.S_un_b.s_b4);
if (port) needed += swprintf(tmp_ip + needed, ARRAY_SIZE(tmp_ip) - needed, L":%u", ntohs(port));
if (*psize > needed) {
*psize = needed + 1;
wcscpy(buffer, tmp_ip);
return STATUS_SUCCESS;
}
*psize = needed + 1;
return STATUS_INVALID_PARAMETER;
}
/***********************************************************************
* RtlIpv4AddressToStringExA [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv4AddressToStringExA(const IN_ADDR *pin, USHORT port, LPSTR buffer, PULONG psize)
{
CHAR tmp_ip[32];
ULONG needed;
if (!pin || !buffer || !psize)
return STATUS_INVALID_PARAMETER;
TRACE("(%p:0x%lx, %d, %p, %p:%ld)\n", pin, pin->S_un.S_addr, port, buffer, psize, *psize);
needed = sprintf(tmp_ip, "%u.%u.%u.%u",
pin->S_un.S_un_b.s_b1, pin->S_un.S_un_b.s_b2,
pin->S_un.S_un_b.s_b3, pin->S_un.S_un_b.s_b4);
if (port) needed += sprintf(tmp_ip + needed, ":%u", ntohs(port));
if (*psize > needed) {
*psize = needed + 1;
strcpy(buffer, tmp_ip);
return STATUS_SUCCESS;
}
*psize = needed + 1;
return STATUS_INVALID_PARAMETER;
}
/***********************************************************************
* RtlIpv4AddressToStringW [NTDLL.@]
*/
WCHAR * WINAPI RtlIpv4AddressToStringW(const IN_ADDR *pin, LPWSTR buffer)
{
ULONG size = 16;
if (RtlIpv4AddressToStringExW(pin, 0, buffer, &size)) size = 0;
return buffer + size - 1;
}
/***********************************************************************
* RtlIpv4AddressToStringA [NTDLL.@]
*/
CHAR * WINAPI RtlIpv4AddressToStringA(const IN_ADDR *pin, LPSTR buffer)
{
ULONG size = 16;
if (RtlIpv4AddressToStringExA(pin, 0, buffer, &size)) size = 0;
return buffer + size - 1;
}
static BOOL is_ipv4_in_ipv6(const IN6_ADDR *address)
{
if (address->s6_words[5] == htons(0x5efe) && (address->s6_words[4] & ~htons(0x200)) == 0)
return TRUE;
if (*(UINT64 *)address != 0)
return FALSE;
if (address->s6_words[4] != 0 && address->s6_words[4] != 0xffff)
return FALSE;
if (address->s6_words[4] == 0 && address->s6_words[5] != 0 && address->s6_words[5] != 0xffff)
return FALSE;
if (address->s6_words[4] == 0xffff && address->s6_words[5] != 0)
return FALSE;
if (address->s6_words[6] == 0)
return FALSE;
return TRUE;
}
/***********************************************************************
* RtlIpv6AddressToStringExA [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv6AddressToStringExA(const IN6_ADDR *address, ULONG scope, USHORT port,
char *str, ULONG *size)
{
char buffer[64], *p = buffer;
int i, len, gap = -1, gap_len = 1, ipv6_end = 8;
ULONG needed;
NTSTATUS ret;
TRACE("(%p %lu %u %p %p)\n", address, scope, port, str, size);
if (!address || !str || !size)
return STATUS_INVALID_PARAMETER;
if (is_ipv4_in_ipv6(address))
ipv6_end = 6;
for (i = 0; i < ipv6_end; i++)
{
len = 0;
while (!address->s6_words[i] && i < ipv6_end)
{
i++;
len++;
}
if (len > gap_len)
{
gap = i - len;
gap_len = len;
}
}
if (port) p += sprintf(p, "[");
i = 0;
while (i < ipv6_end)
{
if (i == gap)
{
p += sprintf(p, ":");
i += gap_len;
if (i == ipv6_end) p += sprintf(p, ":");
continue;
}
if (i > 0) p += sprintf(p, ":");
p += sprintf(p, "%x", ntohs(address->s6_words[i]));
i++;
}
if (ipv6_end == 6)
{
if (p[-1] != ':') p += sprintf(p, ":");
p = RtlIpv4AddressToStringA((IN_ADDR *)(address->s6_words + 6), p);
}
if (scope) p += sprintf(p, "%%%lu", scope);
if (port) p += sprintf(p, "]:%u", ntohs(port));
needed = p - buffer + 1;
if (*size >= needed)
{
strcpy(str, buffer);
ret = STATUS_SUCCESS;
}
else
{
ret = STATUS_INVALID_PARAMETER;
}
*size = needed;
return ret;
}
/***********************************************************************
* RtlIpv6AddressToStringA [NTDLL.@]
*/
char * WINAPI RtlIpv6AddressToStringA(const IN6_ADDR *address, char *str)
{
ULONG size = 46;
if (!address || !str) return str - 1;
str[45] = 0; /* this byte is set even though the string is always shorter */
RtlIpv6AddressToStringExA(address, 0, 0, str, &size);
return str + size - 1;
}
/***********************************************************************
* RtlIpv6AddressToStringExW [NTDLL.@]
*/
NTSTATUS WINAPI RtlIpv6AddressToStringExW(const IN6_ADDR *address, ULONG scope, USHORT port,
WCHAR *str, ULONG *size)
{
char cstr[64];
NTSTATUS ret = RtlIpv6AddressToStringExA(address, scope, port, cstr, size);
if (ret == STATUS_SUCCESS) RtlMultiByteToUnicodeN(str, *size * sizeof(WCHAR), NULL, cstr, *size);
return ret;
}
/***********************************************************************
* RtlIpv6AddressToStringW [NTDLL.@]
*/
WCHAR * WINAPI RtlIpv6AddressToStringW(const IN6_ADDR *address, WCHAR *str)
{
ULONG size = 46;
if (!address || !str) return str;
str[45] = 0; /* this word is set even though the string is always shorter */
if (RtlIpv6AddressToStringExW(address, 0, 0, str, &size) != STATUS_SUCCESS)
return str;
return str + size - 1;
}

View File

@ -556,6 +556,25 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
}
/*************************************************************************
* RtlGetNativeSystemInformation (NTDLL.@)
*/
NTSTATUS WINAPI RtlGetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class,
void *info, ULONG size, ULONG *ret_size )
{
return NtWow64GetNativeSystemInformation( class, info, size, ret_size );
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
return NtWow64IsProcessorFeaturePresent( feature );
}
/*************************************************************************
* RtlWalkFrameChain (NTDLL.@)
*/

View File

@ -31,6 +31,7 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
#include "ddk/wdm.h"
#include "wine/exception.h"
#include "ntdll_misc.h"
#include "wine/debug.h"
@ -590,6 +591,45 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
}
/*************************************************************************
* RtlGetNativeSystemInformation (NTDLL.@)
*/
NTSTATUS WINAPI RtlGetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class,
void *info, ULONG size, ULONG *ret_size )
{
return NtQuerySystemInformation( class, info, size, ret_size );
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
static const ULONGLONG arm64_features =
(1ull << PF_COMPARE_EXCHANGE_DOUBLE) |
(1ull << PF_NX_ENABLED) |
(1ull << PF_ARM_VFP_32_REGISTERS_AVAILABLE) |
(1ull << PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_SECOND_LEVEL_ADDRESS_TRANSLATION) |
(1ull << PF_FASTFAIL_AVAILABLE) |
(1ull << PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE) |
(1ull << PF_ARM_64BIT_LOADSTORE_ATOMIC) |
(1ull << PF_ARM_EXTERNAL_CACHE_AVAILABLE) |
(1ull << PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE);
return (feature < PROCESSOR_FEATURE_MAX && (arm64_features & (1ull << feature)) &&
user_shared_data->ProcessorFeatures[feature]);
}
/*************************************************************************
* RtlWalkFrameChain (NTDLL.@)
*/

View File

@ -28,6 +28,7 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
#include "ddk/wdm.h"
#include "wine/exception.h"
#include "wine/list.h"
#include "ntdll_misc.h"
@ -1194,6 +1195,25 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
}
/*************************************************************************
* RtlGetNativeSystemInformation (NTDLL.@)
*/
NTSTATUS WINAPI RtlGetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class,
void *info, ULONG size, ULONG *ret_size )
{
return NtQuerySystemInformation( class, info, size, ret_size );
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature];
}
/*************************************************************************
* RtlWalkFrameChain (NTDLL.@)
*/

View File

@ -451,6 +451,25 @@ __ASM_STDCALL_FUNC( RtlRaiseException, 4,
"ret $4" ) /* actually never returns */
/*************************************************************************
* RtlGetNativeSystemInformation (NTDLL.@)
*/
NTSTATUS WINAPI RtlGetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class,
void *info, ULONG size, ULONG *ret_size )
{
return NtWow64GetNativeSystemInformation( class, info, size, ret_size );
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
return NtWow64IsProcessorFeaturePresent( feature );
}
/*************************************************************************
* RtlWalkFrameChain (NTDLL.@)
*/

View File

@ -32,6 +32,7 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
#include "ddk/wdm.h"
#include "wine/exception.h"
#include "wine/list.h"
#include "ntdll_misc.h"
@ -792,6 +793,25 @@ __ASM_GLOBAL_FUNC( RtlRaiseException,
"call " __ASM_NAME("RtlRaiseStatus") /* does not return */ );
/*************************************************************************
* RtlGetNativeSystemInformation (NTDLL.@)
*/
NTSTATUS WINAPI RtlGetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class,
void *info, ULONG size, ULONG *ret_size )
{
return NtQuerySystemInformation( class, info, size, ret_size );
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature];
}
/*************************************************************************
* RtlWalkFrameChain (NTDLL.@)
*/

View File

@ -2624,7 +2624,8 @@ static NTSTATUS WINAPI query_routine(const WCHAR *value_name, ULONG value_type,
return STATUS_SUCCESS;
}
static UNICODE_STRING query_reg_values_direct_str;
static WCHAR query_reg_values_direct_str_buf[32];
static UNICODE_STRING query_reg_values_direct_str = {0, 0, query_reg_values_direct_str_buf};
static ULONG query_reg_values_direct_int;
@ -2689,16 +2690,25 @@ static struct query_reg_values_test query_reg_values_tests[] =
},
{
{{ NULL, RTL_QUERY_REGISTRY_DIRECT, (WCHAR*)L"WindowsDrive", &query_reg_values_direct_str }},
STATUS_SUCCESS, 0, 0, REG_SZ, L"C:"
STATUS_SUCCESS, 0, 0, REG_NONE, L"C:"
},
{
{{ NULL, RTL_QUERY_REGISTRY_DIRECT, (WCHAR*)L"WindowsDrive", &query_reg_values_direct_str }},
STATUS_SUCCESS, 0, 0, REG_NONE, L"\x2323", 0, 2 * sizeof(WCHAR)
},
{
{{ NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_NOEXPAND, (WCHAR*)L"WindowsDrive",
&query_reg_values_direct_str }},
STATUS_SUCCESS, 0, 0, REG_SZ, L"%SYSTEMDRIVE%"
STATUS_SUCCESS, 0, 0, REG_NONE, L"%SYSTEMDRIVE%"
},
{
{{ NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_NOEXPAND, (WCHAR*)L"WindowsDrive",
&query_reg_values_direct_str }},
STATUS_SUCCESS, 0, 0, REG_NONE, L"\x2323", 0, 2 * sizeof(WCHAR)
},
{
{{ NULL, RTL_QUERY_REGISTRY_DIRECT, (WCHAR*)L"MeaningOfLife32", &query_reg_values_direct_int }},
STATUS_SUCCESS, 0, 0, REG_DWORD, (WCHAR*)42
STATUS_SUCCESS, 0, 0, REG_NONE, (WCHAR*)42
},
{
{{ NULL, RTL_QUERY_REGISTRY_DIRECT, (WCHAR*)L"MeaningOfLife64", &query_reg_values_direct_sized }},
@ -2724,7 +2734,12 @@ static struct query_reg_values_test query_reg_values_tests[] =
{
{{ NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_NOEXPAND, (WCHAR*)L"CapitalsOfEurope",
&query_reg_values_direct_str }},
STATUS_SUCCESS, 0, 0, REG_SZ, L"Brussels\0Paris\0%PATH%\0", sizeof(L"Brussels\0Paris\0%PATH%\0")
STATUS_SUCCESS, 0, 0, REG_NONE, L"Brussels\0Paris\0%PATH%\0", sizeof(L"Brussels\0Paris\0%PATH%\0")
},
{
{{ NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_NOEXPAND, (WCHAR*)L"CapitalsOfEurope",
&query_reg_values_direct_str }},
STATUS_SUCCESS, 0, 0, REG_NONE, L"\x2323", 0, 2 * sizeof(WCHAR)
},
/* DIRECT with a null buffer crashes on Windows */
/* {
@ -2788,15 +2803,25 @@ static struct query_reg_values_test query_reg_values_tests[] =
&query_reg_values_direct_str, REG_SZ, (WCHAR*)L"%SYSTEMDRIVE%" }},
STATUS_SUCCESS, 0, EXPECT_DEFAULT_DATA
},
{
{{ NULL, RTL_QUERY_REGISTRY_DIRECT, (WCHAR*)L"I don't exist",
&query_reg_values_direct_str, REG_SZ, (WCHAR*)L"%SYSTEMDRIVE%" }},
STATUS_SUCCESS, 0, 0, REG_NONE, L"\x2323", 0, 2 * sizeof(WCHAR)
},
{
{{ NULL, RTL_QUERY_REGISTRY_DIRECT, (WCHAR*)L"I don't exist",
&query_reg_values_direct_str, REG_EXPAND_SZ, (WCHAR*)L"%SYSTEMDRIVE%" }},
STATUS_SUCCESS, 0, WINE_TODO_SIZE | WINE_TODO_DATA, REG_EXPAND_SZ, L"C:"
STATUS_SUCCESS, 0, WINE_TODO_SIZE | WINE_TODO_DATA, REG_NONE, L"C:"
},
{
{{ NULL, RTL_QUERY_REGISTRY_DIRECT, (WCHAR*)L"I don't exist",
&query_reg_values_direct_str, REG_EXPAND_SZ, (WCHAR*)L"%SYSTEMDRIVE%" }},
STATUS_SUCCESS, 0, WINE_TODO_SIZE, REG_NONE, L"\x2323", 0, 2 * sizeof(WCHAR)
},
/* DIRECT with a multi-string default value crashes on Windows */
/* {
{{ NULL, RTL_QUERY_REGISTRY_DIRECT, (WCHAR*)L"I don't exist",
&query_reg_values_direct_str, REG_MULTI_SZ, (WCHAR*)L"A\0B\0C\0", sizeof(L"A\0B\0C\0") }},
&query_reg_values_direct_str, REG_NONE, (WCHAR*)L"A\0B\0C\0", sizeof(L"A\0B\0C\0") }},
STATUS_SUCCESS, EXPECT_DEFAULT_DATA
}, */
/* The default value is not used if it is not valid */
@ -2838,7 +2863,7 @@ static struct query_reg_values_test query_reg_values_tests[] =
/* DELETE deletes the value after reading it */
{
{{ query_routine, RTL_QUERY_REGISTRY_DELETE, (WCHAR*)L"WindowsDrive" }},
STATUS_SUCCESS, 1, WINE_TODO_TYPE | WINE_TODO_SIZE, REG_SZ, L"C:"
STATUS_SUCCESS, 1, 0, REG_SZ, L"C:"
},
{
{{ query_routine, 0, (WCHAR*)L"I don't exist", NULL, REG_SZ, (WCHAR*)L"Some default" }},
@ -2871,10 +2896,6 @@ static void test_RtlQueryRegistryValues(void)
L"Yellow", sizeof(L"Yellow"));
ok(status == ERROR_SUCCESS, "Failed to create registry value Color: %lu\n", status);
query_reg_values_direct_str.MaximumLength = 32 * sizeof(WCHAR);
query_reg_values_direct_str.Buffer = pRtlAllocateHeap(GetProcessHeap(), 0,
query_reg_values_direct_str.MaximumLength);
for (i = 0; i < ARRAY_SIZE(query_reg_values_tests); i++)
{
struct query_reg_values_test *test = &query_reg_values_tests[i];
@ -2893,9 +2914,14 @@ static void test_RtlQueryRegistryValues(void)
query_routine_calls = 0;
query_reg_values_direct_str.Length = query_reg_values_direct_str.MaximumLength - sizeof(WCHAR);
query_reg_values_direct_str.MaximumLength = test->size_limit ? test->size_limit
: sizeof(query_reg_values_direct_str_buf);
if (query_reg_values_direct_str.MaximumLength >= sizeof(WCHAR))
query_reg_values_direct_str.Length = query_reg_values_direct_str.MaximumLength - sizeof(WCHAR);
else
query_reg_values_direct_str.Length = 0;
memset(query_reg_values_direct_str.Buffer, 0x23, query_reg_values_direct_str.Length);
query_reg_values_direct_str.Buffer[query_reg_values_direct_str.Length] = 0;
query_reg_values_direct_str.Buffer[query_reg_values_direct_str.Length / sizeof(WCHAR)] = 0;
query_reg_values_direct_int = 1;
@ -2992,8 +3018,6 @@ static void test_RtlQueryRegistryValues(void)
status = RegDeleteKeyValueW(HKEY_CURRENT_USER, L"WineTest", L"WindowsDrive");
ok(status == ERROR_FILE_NOT_FOUND, "Registry value WindowsDrive should have been deleted already\n");
pRtlFreeHeap(GetProcessHeap(), 0, query_reg_values_direct_str.Buffer);
}
START_TEST(reg)

View File

@ -2822,18 +2822,13 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc
TRACE( "%p %s %p %d %p %d %p\n", device, iocodex(code), in_buffer, in_size, out_buffer, out_size, io );
io->Information = 0;
if ((status = server_get_unix_fd( device, 0, &fd, &needs_close, NULL, NULL )))
{
if (status == STATUS_BAD_DEVICE_TYPE) return status; /* no associated fd */
goto error;
}
return status;
if ((status = CDROM_Open(fd, &dev)))
{
if (needs_close) close( fd );
goto error;
return status;
}
#ifdef __APPLE__
@ -2847,16 +2842,13 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc
* Also for some reason it wants the fd to be closed before we even
* open the parent if we're trying to eject the disk.
*/
if ((status = get_parent_device( fd, name, sizeof(name) ))) goto error;
if ((status = get_parent_device( fd, name, sizeof(name) ))) return status;
if (code == IOCTL_STORAGE_EJECT_MEDIA)
NtClose( device );
if (needs_close) close( fd );
TRACE("opening parent %s\n", name );
if ((fd = open( name, O_RDONLY )) == -1)
{
status = errno_to_status( errno );
goto error;
}
return errno_to_status( errno );
needs_close = 1;
}
#endif
@ -3117,13 +3109,14 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc
break;
default:
if (needs_close) close( fd );
return STATUS_NOT_SUPPORTED;
status = STATUS_NOT_SUPPORTED;
}
if (needs_close) close( fd );
error:
io->Status = status;
io->Information = sz;
if (event) NtSetEvent(event, NULL);
if (!NT_ERROR(status))
{
io->Status = status;
io->Information = sz;
if (event) NtSetEvent(event, NULL);
}
return status;
}

View File

@ -6120,7 +6120,6 @@ NTSTATUS WINAPI NtDeviceIoControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUT
case FILE_DEVICE_BEEP:
case FILE_DEVICE_NETWORK:
status = sock_ioctl( handle, event, apc, apc_context, io, code, in_buffer, in_size, out_buffer, out_size );
if (status != STATUS_NOT_SUPPORTED && status != STATUS_BAD_DEVICE_TYPE) return status;
break;
case FILE_DEVICE_DISK:
case FILE_DEVICE_CD_ROM:
@ -6143,8 +6142,6 @@ NTSTATUS WINAPI NtDeviceIoControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUT
if (status == STATUS_NOT_SUPPORTED || status == STATUS_BAD_DEVICE_TYPE)
return server_ioctl_file( handle, event, apc, apc_context, io, code,
in_buffer, in_size, out_buffer, out_size );
if (status != STATUS_PENDING && !NT_ERROR(status)) io->Status = status;
return status;
}
@ -6228,14 +6225,12 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
}
else
{
io->Information = 0;
status = STATUS_BUFFER_TOO_SMALL;
}
break;
}
case FSCTL_GET_REPARSE_POINT:
io->Information = 0;
if (out_buffer && out_size)
{
FIXME("FSCTL_GET_REPARSE_POINT semi-stub\n");
@ -6250,7 +6245,6 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
int fd, needs_close;
struct stat st;
io->Information = 0;
if (out_size >= sizeof(*info))
{
status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL );
@ -6276,7 +6270,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
in_buffer, in_size, out_buffer, out_size );
}
if (status != STATUS_PENDING) io->Status = status;
if (!NT_ERROR(status) && status != STATUS_PENDING) io->Status = status;
return status;
}

View File

@ -147,12 +147,6 @@ SYSTEM_SERVICE_TABLE KeServiceDescriptorTable[4] =
static void fatal_error( const char *err, ... ) __attribute__((noreturn, format(printf,1,2)));
#endif
#if defined(linux) || defined(__APPLE__)
static const BOOL use_preloader = TRUE;
#else
static const BOOL use_preloader = FALSE;
#endif
static const char *bin_dir;
static const char *dll_dir;
static const char *ntdll_dir;
@ -500,31 +494,30 @@ char *get_alternate_wineloader( WORD machine )
static void preloader_exec( char **argv )
{
if (use_preloader)
{
static const char *preloader = "wine-preloader";
char *p;
#ifdef HAVE_WINE_PRELOADER
static const char *preloader = "wine-preloader";
char *p;
if (!(p = strrchr( argv[1], '/' ))) p = argv[1];
else p++;
if (!(p = strrchr( argv[1], '/' ))) p = argv[1];
else p++;
if (strlen(p) > 2 && !strcmp( p + strlen(p) - 2, "64" )) preloader = "wine64-preloader";
argv[0] = malloc( p - argv[1] + strlen(preloader) + 1 );
memcpy( argv[0], argv[1], p - argv[1] );
strcpy( argv[0] + (p - argv[1]), preloader );
if (strlen(p) > 2 && !strcmp( p + strlen(p) - 2, "64" )) preloader = "wine64-preloader";
argv[0] = malloc( p - argv[1] + strlen(preloader) + 1 );
memcpy( argv[0], argv[1], p - argv[1] );
strcpy( argv[0] + (p - argv[1]), preloader );
#ifdef __APPLE__
{
posix_spawnattr_t attr;
posix_spawnattr_init( &attr );
posix_spawnattr_setflags( &attr, POSIX_SPAWN_SETEXEC | _POSIX_SPAWN_DISABLE_ASLR );
posix_spawn( NULL, argv[0], NULL, &attr, argv, *_NSGetEnviron() );
posix_spawnattr_destroy( &attr );
}
#endif
execv( argv[0], argv );
free( argv[0] );
{
posix_spawnattr_t attr;
posix_spawnattr_init( &attr );
posix_spawnattr_setflags( &attr, POSIX_SPAWN_SETEXEC | _POSIX_SPAWN_DISABLE_ASLR );
posix_spawn( NULL, argv[0], NULL, &attr, argv, *_NSGetEnviron() );
posix_spawnattr_destroy( &attr );
}
#endif
execv( argv[0], argv );
free( argv[0] );
#endif
execv( argv[1], argv + 1 );
}
@ -1583,7 +1576,7 @@ static void load_ntdll_wow64_functions( HMODULE module )
GET_FUNC( RtlpFreezeTimeBias );
GET_FUNC( RtlpQueryProcessDebugInformationRemote );
#undef GET_FUNC
pDbgUiRemoteBreakin = (void *)find_named_export( module, exports, "DbgUiRemoteBreakin" );
p__wine_ctrl_routine = (void *)find_named_export( module, exports, "__wine_ctrl_routine" );
#ifdef _WIN64
@ -2035,18 +2028,7 @@ static void apple_main_thread(void)
#endif /* __APPLE__ */
#ifdef __ANDROID__
static int pre_exec(void)
{
#if defined(__i386__) || defined(__x86_64__)
return 1; /* we have a preloader */
#else
return 0; /* no exec needed */
#endif
}
#elif defined(__linux__) && (defined(__i386__) || defined(__arm__))
#if defined(__linux__) && !defined(__ANDROID__) && (defined(__i386__) || defined(__arm__))
static void check_vmsplit( void *stack )
{
@ -2067,20 +2049,6 @@ static int pre_exec(void)
return 1; /* we have a preloader on x86/arm */
}
#elif defined(__linux__) && (defined(__x86_64__) || defined(__aarch64__))
static int pre_exec(void)
{
return 1; /* we have a preloader on x86-64/arm64 */
}
#elif defined(__APPLE__) && (defined(__i386__) || defined(__x86_64__))
static int pre_exec(void)
{
return 1; /* we have a preloader */
}
#elif (defined(__FreeBSD__) || defined (__FreeBSD_kernel__) || defined(__DragonFly__))
static int pre_exec(void)
@ -2097,7 +2065,11 @@ static int pre_exec(void)
static int pre_exec(void)
{
#ifdef HAVE_WINE_PRELOADER
return 1; /* we have a preloader */
#else
return 0; /* no exec needed */
#endif
}
#endif

View File

@ -1261,14 +1261,12 @@ NTSTATUS serial_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE ap
return STATUS_NOT_SUPPORTED;
}
io->Information = 0;
if ((status = server_get_unix_fd( device, access, &fd, &needs_close, &type, NULL ))) goto error;
if ((status = server_get_unix_fd( device, access, &fd, &needs_close, &type, NULL )))
return status;
if (type != FD_TYPE_SERIAL)
{
if (needs_close) close( fd );
status = STATUS_OBJECT_TYPE_MISMATCH;
goto error;
return STATUS_OBJECT_TYPE_MISMATCH;
}
switch (code)
@ -1455,11 +1453,15 @@ NTSTATUS serial_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE ap
status = STATUS_INVALID_PARAMETER;
break;
}
if (needs_close) close( fd );
error:
io->Status = status;
io->Information = sz;
if (event) NtSetEvent(event, NULL);
if (!NT_ERROR(status))
{
io->Status = status;
io->Information = sz;
if (event) NtSetEvent(event, NULL);
}
return status;
}

View File

@ -640,7 +640,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
(ULONG_PTR)func == call->create_thread.func && (ULONG_PTR)arg == call->create_thread.arg)
{
/* FIXME: hack for debugging 32-bit process without a 64-bit ntdll */
if (is_old_wow64() && func == (void *)0x7ffe1000) func = pDbgUiRemoteBreakin;
if (is_wow64()) func = pDbgUiRemoteBreakin;
attr->TotalLength = sizeof(buffer);
attr->Attributes[0].Attribute = PS_ATTRIBUTE_CLIENT_ID;
attr->Attributes[0].Size = sizeof(id);

View File

@ -528,9 +528,8 @@ NTSTATUS tape_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc,
TRACE( "%p %s %p %d %p %d %p\n", device, io2str(code),
in_buffer, in_size, out_buffer, out_size, io );
io->Information = 0;
if ((status = server_get_unix_fd( device, 0, &fd, &needs_close, NULL, NULL ))) goto error;
if ((status = server_get_unix_fd( device, 0, &fd, &needs_close, NULL, NULL )))
return status;
switch (code)
{
@ -580,9 +579,11 @@ NTSTATUS tape_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc,
if (needs_close) close( fd );
error:
io->Status = status;
io->Information = sz;
if (event) NtSetEvent( event, NULL );
if (!NT_ERROR(status))
{
io->Status = status;
io->Information = sz;
if (event) NtSetEvent( event, NULL );
}
return status;
}

View File

@ -223,7 +223,6 @@ static BOOL SQLInstall_narrow(int mode, LPSTR buffer, LPCWSTR str, WORD str_leng
static HMODULE load_config_driver(const WCHAR *driver)
{
static WCHAR reg_driver[] = {'d','r','i','v','e','r',0};
long ret;
HMODULE hmod;
WCHAR *filename = NULL;
@ -236,7 +235,7 @@ static HMODULE load_config_driver(const WCHAR *driver)
if ((ret = RegOpenKeyW(hkey, driver, &hkeydriver)) == ERROR_SUCCESS)
{
ret = RegGetValueW(hkeydriver, NULL, reg_driver, RRF_RT_REG_SZ, &type, NULL, &size);
ret = RegGetValueW(hkeydriver, NULL, L"Setup", RRF_RT_REG_SZ, &type, NULL, &size);
if(ret != ERROR_SUCCESS || type != REG_SZ)
{
RegCloseKey(hkeydriver);
@ -255,7 +254,7 @@ static HMODULE load_config_driver(const WCHAR *driver)
return NULL;
}
ret = RegGetValueW(hkeydriver, NULL, reg_driver, RRF_RT_REG_SZ, &type, filename, &size);
ret = RegGetValueW(hkeydriver, NULL, L"Setup", RRF_RT_REG_SZ, &type, filename, &size);
RegCloseKey(hkeydriver);
}
@ -373,7 +372,7 @@ BOOL WINAPI SQLConfigDataSourceW(HWND hwnd, WORD request, LPCWSTR driver, LPCWST
WORD mapped_request;
TRACE("%p, %d, %s, %s\n", hwnd, request, debugstr_w(driver), debugstr_w(attributes));
if (TRACE_ON(odbc))
if (TRACE_ON(odbc) && attributes)
{
const WCHAR *p;
for (p = attributes; *p; p += lstrlenW(p) + 1)
@ -418,7 +417,7 @@ BOOL WINAPI SQLConfigDataSource(HWND hwnd, WORD request, LPCSTR driver, LPCSTR a
TRACE("%p, %d, %s, %s\n", hwnd, request, debugstr_a(driver), debugstr_a(attributes));
if (TRACE_ON(odbc))
if (TRACE_ON(odbc) && attributes)
{
const char *p;
for (p = attributes; *p; p += lstrlenA(p) + 1)

2
dlls/profapi/Makefile.in Normal file
View File

@ -0,0 +1,2 @@
MODULE = profapi.dll
IMPORTLIB = profapi

17
dlls/profapi/profapi.spec Normal file
View File

@ -0,0 +1,17 @@
101 stub -noname @
102 stub -noname @
103 stub -noname @
104 stub -noname @
105 stub -noname @
106 stub -noname @
107 stub -noname @
108 stub -noname @
109 stub -noname @
110 stub -noname @
111 stub -noname @
112 stub -noname @
113 stub -noname @
114 stub -noname @
115 stub -noname @
116 stub -noname @
117 stub -noname @

View File

@ -345,8 +345,6 @@ static LRESULT call_hook( struct win_hook_params *info, const WCHAR *module, siz
if (params != info) free( params );
}
if (info->id == WH_KEYBOARD_LL || info->id == WH_MOUSE_LL)
InterlockedIncrement( &global_key_state_counter ); /* force refreshing the key state cache */
return ret;
}

View File

@ -406,7 +406,6 @@ static const KBDTABLES kbdus_tables =
static LONG clipping_cursor; /* clipping thread counter */
LONG global_key_state_counter = 0;
BOOL grab_pointer = TRUE;
BOOL grab_fullscreen = FALSE;
@ -810,52 +809,31 @@ static void check_for_events( UINT flags )
*/
SHORT WINAPI NtUserGetAsyncKeyState( INT key )
{
struct user_key_state_info *key_state_info = get_user_thread_info()->key_state;
INT counter = global_key_state_counter;
BYTE prev_key_state;
SHORT ret;
const desktop_shm_t *desktop_shm;
struct object_lock lock = OBJECT_LOCK_INIT;
NTSTATUS status;
BYTE state = 0;
SHORT ret = 0;
if (key < 0 || key >= 256) return 0;
check_for_events( QS_INPUT );
if (key_state_info && !(key_state_info->state[key] & 0xc0) &&
key_state_info->counter == counter && NtGetTickCount() - key_state_info->time < 50)
{
/* use cached value */
return 0;
}
else if (!key_state_info)
{
key_state_info = calloc( 1, sizeof(*key_state_info) );
get_user_thread_info()->key_state = key_state_info;
}
while ((status = get_shared_desktop( &lock, &desktop_shm )) == STATUS_PENDING)
state = desktop_shm->keystate[key];
ret = 0;
if (status) return 0;
if (!(state & 0x40)) return (state & 0x80) << 8;
/* Need to make a server call to reset the last pressed bit */
SERVER_START_REQ( get_key_state )
{
req->async = 1;
req->key = key;
if (key_state_info)
{
prev_key_state = key_state_info->state[key];
wine_server_set_reply( req, key_state_info->state, sizeof(key_state_info->state) );
}
if (!wine_server_call( req ))
{
if (reply->state & 0x40) ret |= 0x0001;
if (reply->state & 0x80) ret |= 0x8000;
if (key_state_info)
{
/* force refreshing the key state cache - some multithreaded programs
* (like Adobe Photoshop CS5) expect that changes to the async key state
* are also immediately available in other threads. */
if (prev_key_state != key_state_info->state[key])
counter = InterlockedIncrement( &global_key_state_counter );
key_state_info->time = NtGetTickCount();
key_state_info->counter = counter;
}
}
}
SERVER_END_REQ;
@ -2555,24 +2533,21 @@ BOOL WINAPI NtUserGetPointerInfoList( UINT32 id, POINTER_INPUT_TYPE type, UINT_P
BOOL get_clip_cursor( RECT *rect, UINT dpi )
{
BOOL ret;
struct object_lock lock = OBJECT_LOCK_INIT;
const desktop_shm_t *desktop_shm;
NTSTATUS status;
if (!rect) return FALSE;
SERVER_START_REQ( set_cursor )
{
req->flags = 0;
if ((ret = !wine_server_call( req )))
*rect = wine_server_get_rect( reply->new_clip );
}
SERVER_END_REQ;
while ((status = get_shared_desktop( &lock, &desktop_shm )) == STATUS_PENDING)
*rect = wine_server_get_rect( desktop_shm->cursor.clip );
if (ret)
if (!status)
{
HMONITOR monitor = monitor_from_rect( rect, MONITOR_DEFAULTTOPRIMARY, 0 );
*rect = map_dpi_rect( *rect, get_monitor_dpi( monitor ), dpi );
}
return ret;
return !status;
}
BOOL process_wine_clipcursor( HWND hwnd, UINT flags, BOOL reset )

View File

@ -3469,7 +3469,7 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA
struct send_message_info info;
int prev_x, prev_y, new_x, new_y;
NTSTATUS ret;
BOOL wait, affects_key_state = FALSE;
BOOL wait;
info.type = MSG_HARDWARE;
info.dest_tid = 0;
@ -3495,10 +3495,6 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA
req->input.mouse.flags = input->mi.dwFlags;
req->input.mouse.time = input->mi.time;
req->input.mouse.info = input->mi.dwExtraInfo;
affects_key_state = !!(input->mi.dwFlags & (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP |
MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP |
MOUSEEVENTF_MIDDLEDOWN | MOUSEEVENTF_MIDDLEUP |
MOUSEEVENTF_XDOWN | MOUSEEVENTF_XUP));
break;
case INPUT_KEYBOARD:
if (input->ki.dwFlags & KEYEVENTF_SCANCODE)
@ -3523,7 +3519,6 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA
req->input.kbd.flags = input->ki.dwFlags & ~KEYEVENTF_SCANCODE;
req->input.kbd.time = input->ki.time;
req->input.kbd.info = input->ki.dwExtraInfo;
affects_key_state = TRUE;
break;
case INPUT_HARDWARE:
req->input.hw.msg = input->hi.uMsg;
@ -3553,13 +3548,8 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA
}
SERVER_END_REQ;
if (!ret)
{
if (affects_key_state)
InterlockedIncrement( &global_key_state_counter ); /* force refreshing the key state cache */
if ((flags & SEND_HWMSG_INJECTED) && (prev_x != new_x || prev_y != new_y))
user_driver->pSetCursorPos( new_x, new_y );
}
if (!ret && (flags & SEND_HWMSG_INJECTED) && (prev_x != new_x || prev_y != new_y))
user_driver->pSetCursorPos( new_x, new_y );
if (wait)
{

View File

@ -116,7 +116,6 @@ struct user_thread_info
HHOOK hook; /* Current hook */
UINT active_hooks; /* Bitmap of active hooks */
struct received_message_info *receive_info; /* Message being currently received */
struct user_key_state_info *key_state; /* Cache of global key state */
struct imm_thread_data *imm_thread_data; /* IMM thread data */
HKL kbd_layout; /* Current keyboard layout */
UINT kbd_layout_id; /* Current keyboard layout ID */
@ -134,13 +133,6 @@ static inline struct user_thread_info *get_user_thread_info(void)
return CONTAINING_RECORD( NtUserGetThreadInfo(), struct user_thread_info, client_info );
}
struct user_key_state_info
{
UINT time; /* Time of last key state refresh */
INT counter; /* Counter to invalidate the key state */
BYTE state[256]; /* State for each key */
};
struct hook_extra_info
{
HHOOK handle;

View File

@ -6334,8 +6334,6 @@ static void thread_detach(void)
destroy_thread_windows();
user_driver->pThreadDetach();
free( thread_info->key_state );
thread_info->key_state = 0;
free( thread_info->rawinput );
cleanup_imm_thread();

View File

@ -90,7 +90,6 @@ extern void unregister_imm_window( HWND hwnd );
extern BOOL grab_pointer;
extern BOOL grab_fullscreen;
extern BOOL destroy_caret(void);
extern LONG global_key_state_counter;
extern HWND get_active_window(void);
extern HWND get_capture(void);
extern BOOL get_cursor_pos( POINT *pt );

View File

@ -441,11 +441,9 @@ BOOL WINAPI NtUserSetThreadDesktop( HDESK handle )
if (ret) /* reset the desktop windows */
{
struct user_thread_info *thread_info = get_user_thread_info();
struct user_key_state_info *key_state_info = thread_info->key_state;
get_session_thread_data()->shared_desktop = find_shared_session_object( locator );
thread_info->client_info.top_window = 0;
thread_info->client_info.msg_window = 0;
if (key_state_info) key_state_info->time = 0;
if (was_virtual_desktop != is_virtual_desktop()) update_display_cache( FALSE );
}
return ret;

View File

@ -521,6 +521,18 @@ NTSTATUS WINAPI wow64_NtSetInformationToken( UINT *args )
switch (class)
{
case TokenIntegrityLevel: /* TOKEN_MANDATORY_LABEL */
if (len >= sizeof(TOKEN_MANDATORY_LABEL32))
{
TOKEN_MANDATORY_LABEL32 *label32 = ptr;
TOKEN_MANDATORY_LABEL label;
label.Label.Sid = ULongToPtr( label32->Label.Sid );
label.Label.Attributes = label32->Label.Attributes;
return NtSetInformationToken( handle, class, &label, sizeof(label) );
}
else return STATUS_INFO_LENGTH_MISMATCH;
case TokenSessionId: /* ULONG */
return NtSetInformationToken( handle, class, ptr, len );

View File

@ -367,6 +367,11 @@ typedef struct
DWORD Attributes;
} SID_AND_ATTRIBUTES32;
typedef struct
{
SID_AND_ATTRIBUTES32 Label;
} TOKEN_MANDATORY_LABEL32;
typedef struct
{
ULONG DefaultDacl;

View File

@ -849,6 +849,7 @@ SOURCES = \
windows.graphics.directx.idl \
windows.graphics.effects.idl \
windows.graphics.holographic.idl \
windows.graphics.idl \
windows.graphics.imaging.idl \
windows.h \
windows.management.deployment.idl \

View File

@ -642,6 +642,9 @@
/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
#undef HAVE_VALGRIND_VALGRIND_H
/* Define to 1 if the Wine preloader is being used. */
#undef HAVE_WINE_PRELOADER
/* Define to 1 if you have the <X11/extensions/shape.h> header file. */
#undef HAVE_X11_EXTENSIONS_SHAPE_H

View File

@ -111,6 +111,9 @@ _ACRTIMP float __cdecl truncf(float);
_ACRTIMP int __cdecl ilogb(double);
_ACRTIMP int __cdecl ilogbf(float);
_ACRTIMP float __cdecl fmaf(float x, float y, float z);
_ACRTIMP double __cdecl fma(double x, double y, double z);
_ACRTIMP __int64 __cdecl llrint(double);
_ACRTIMP __int64 __cdecl llrintf(float);
_ACRTIMP __int64 __cdecl llround(double);
@ -156,7 +159,6 @@ _ACRTIMP float __cdecl powf(float, float);
_ACRTIMP float __cdecl sqrtf(float);
_ACRTIMP float __cdecl ceilf(float);
_ACRTIMP float __cdecl floorf(float);
_ACRTIMP float __cdecl frexpf(float, int*);
_ACRTIMP float __cdecl modff(float, float*);
_ACRTIMP float __cdecl fmodf(float, float);
@ -183,7 +185,6 @@ static inline float powf(float x, float y) { return pow(x, y); }
static inline float sqrtf(float x) { return sqrt(x); }
static inline float ceilf(float x) { return ceil(x); }
static inline float floorf(float x) { return floor(x); }
static inline float frexpf(float x, int *y) { return frexp(x, y); }
static inline float modff(float x, float *y) { double yd, ret = modf(x, &yd); *y = yd; return ret; }
static inline float fmodf(float x, float y) { return fmod(x, y); }
@ -206,6 +207,12 @@ static inline int _fpclassf(float x)
#endif
#if (defined(__x86_64__) && !defined(_UCRT)) || defined(_NO_CRT_MATH_INLINE)
_ACRTIMP float __cdecl frexpf(float, int*);
#else
static inline float frexpf(float x, int *y) { return frexp(x, y); }
#endif
#if (!defined(__i386__) && !defined(__x86_64__) && (_MSVCR_VER == 0 || _MSVCR_VER >= 110)) || defined(_NO_CRT_MATH_INLINE)
_ACRTIMP float __cdecl fabsf(float);
#else

View File

@ -238,6 +238,8 @@ _ACRTIMP unsigned __int64 __cdecl _strtoui64_l(const char*,char**,int,_locale_t)
_ACRTIMP int __cdecl system(const char*);
_ACRTIMP void* __cdecl bsearch(const void*,const void*,size_t,size_t,int (__cdecl *)(const void*,const void*));
_ACRTIMP void __cdecl qsort(void*,size_t,size_t,int (__cdecl *)(const void*,const void*));
_ACRTIMP void __cdecl qsort_s(void*,size_t,size_t,int (__cdecl *)(void*,const void*,const void*),void*);
_ACRTIMP unsigned int __cdecl _set_abort_behavior(unsigned int flags, unsigned int mask);
typedef void (__cdecl *_purecall_handler)(void);
_ACRTIMP _purecall_handler __cdecl _set_purecall_handler(_purecall_handler);

View File

@ -25,22 +25,169 @@ import "asyncinfo.idl";
import "eventtoken.idl";
import "windowscontracts.idl";
import "windows.foundation.idl";
/* import "windows.graphics.idl"; */
import "windows.graphics.idl";
import "windows.graphics.directx.idl";
import "windows.graphics.directx.direct3d11.idl";
/* import "windows.security.authorization.appcapabilityaccess.idl"; */
import "windows.system.idl";
import "windows.ui.idl";
/* import "windows.ui.composition.idl"; */
import "windows.ui.composition.idl";
namespace Windows.Graphics.Capture {
typedef enum GraphicsCaptureDirtyRegionMode GraphicsCaptureDirtyRegionMode;
interface IDirect3D11CaptureFrame;
interface IDirect3D11CaptureFrame2;
interface IDirect3D11CaptureFramePool;
interface IDirect3D11CaptureFramePoolStatics;
interface IDirect3D11CaptureFramePoolStatics2;
interface IGraphicsCaptureItem;
interface IGraphicsCaptureItemStatics;
interface IGraphicsCaptureItemStatics2;
interface IGraphicsCaptureSession;
interface IGraphicsCaptureSession2;
interface IGraphicsCaptureSession3;
interface IGraphicsCaptureSessionStatics;
runtimeclass Direct3D11CaptureFrame;
runtimeclass Direct3D11CaptureFramePool;
runtimeclass GraphicsCaptureItem;
runtimeclass GraphicsCaptureSession;
declare {
interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Graphics.Capture.GraphicsCaptureItem *>;
interface Windows.Foundation.IAsyncOperation<Windows.Graphics.Capture.GraphicsCaptureItem *>;
interface Windows.Foundation.TypedEventHandler<Windows.Graphics.Capture.Direct3D11CaptureFramePool *, IInspectable *>;
interface Windows.Foundation.TypedEventHandler<Windows.Graphics.Capture.GraphicsCaptureItem *, IInspectable *>;
}
[
contract(Windows.Foundation.UniversalApiContract, 19.0)
]
enum GraphicsCaptureDirtyRegionMode
{
ReportOnly = 0,
ReportAndRender = 1,
};
[
contract(Windows.Foundation.UniversalApiContract, 6.0),
exclusiveto(Windows.Graphics.Capture.Direct3D11CaptureFrame),
uuid(fa50c623-38da-4b32-acf3-fa9734ad800e)
]
interface IDirect3D11CaptureFrame : IInspectable
{
[propget] HRESULT Surface([out, retval] Windows.Graphics.DirectX.Direct3D11.IDirect3DSurface **value);
[propget] HRESULT SystemRelativeTime([out, retval] Windows.Foundation.TimeSpan *value);
[propget] HRESULT ContentSize([out, retval] Windows.Graphics.SizeInt32 *value);
}
[
contract(Windows.Foundation.UniversalApiContract, 19.0),
exclusiveto(Windows.Graphics.Capture.Direct3D11CaptureFrame),
uuid(37869cfa-2b48-5ebf-9afb-dffd805defdb)
]
interface IDirect3D11CaptureFrame2 : IInspectable
{
[propget] HRESULT DirtyRegions([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Graphics.RectInt32> **value);
[propget] HRESULT DirtyRegionMode([out, retval] Windows.Graphics.Capture.GraphicsCaptureDirtyRegionMode *value);
}
[
contract(Windows.Foundation.UniversalApiContract, 6.0),
exclusiveto(Windows.Graphics.Capture.Direct3D11CaptureFramePool),
uuid(24eb6d22-1975-422e-82e7-780dbd8ddf24)
]
interface IDirect3D11CaptureFramePool : IInspectable
{
HRESULT Recreate(
[in] Windows.Graphics.DirectX.Direct3D11.IDirect3DDevice *device,
[in] Windows.Graphics.DirectX.DirectXPixelFormat pixel_format,
[in] INT32 number_of_buffers, [in] Windows.Graphics.SizeInt32 size);
HRESULT TryGetNextFrame(
[out, retval] Windows.Graphics.Capture.Direct3D11CaptureFrame **result);
[eventadd] HRESULT FrameArrived(
[in] Windows.Foundation.TypedEventHandler<Windows.Graphics.Capture.Direct3D11CaptureFramePool *, IInspectable *> *handler,
[out, retval] EventRegistrationToken* token);
[eventremove] HRESULT FrameArrived([in] EventRegistrationToken token);
HRESULT CreateCaptureSession(
[in] Windows.Graphics.Capture.GraphicsCaptureItem *item,
[out, retval] Windows.Graphics.Capture.GraphicsCaptureSession **result);
[propget] HRESULT DispatcherQueue([out, retval] Windows.System.DispatcherQueue **value);
}
[
contract(Windows.Foundation.UniversalApiContract, 6.0),
exclusiveto(Windows.Graphics.Capture.Direct3D11CaptureFramePool),
uuid(7784056a-67aa-4d53-ae54-1088d5a8ca21)
]
interface IDirect3D11CaptureFramePoolStatics : IInspectable
{
HRESULT Create(
[in] Windows.Graphics.DirectX.Direct3D11.IDirect3DDevice *device,
[in] Windows.Graphics.DirectX.DirectXPixelFormat pixel_format,
[in] INT32 number_of_buffers,
[in] Windows.Graphics.SizeInt32 size,
[out, retval] Windows.Graphics.Capture.Direct3D11CaptureFramePool **result);
}
[
contract(Windows.Foundation.UniversalApiContract, 7.0),
exclusiveto(Windows.Graphics.Capture.Direct3D11CaptureFramePool),
uuid(589b103f-6bbc-5df5-a991-02e28b3b66d5)
]
interface IDirect3D11CaptureFramePoolStatics2 : IInspectable
{
HRESULT CreateFreeThreaded(
[in] Windows.Graphics.DirectX.Direct3D11.IDirect3DDevice *device,
[in] Windows.Graphics.DirectX.DirectXPixelFormat pixel_format,
[in] INT32 number_of_buffers,
[in] Windows.Graphics.SizeInt32 size,
[out, retval] Windows.Graphics.Capture.Direct3D11CaptureFramePool **result);
}
[
contract(Windows.Foundation.UniversalApiContract, 6.0),
exclusiveto(Windows.Graphics.Capture.GraphicsCaptureItem),
uuid(79c3f95b-31f7-4ec2-a464-632ef5d30760)
]
interface IGraphicsCaptureItem : IInspectable
{
[propget] HRESULT DisplayName([out, retval] HSTRING *value);
[propget] HRESULT Size([out, retval] Windows.Graphics.SizeInt32 *value);
[eventadd] HRESULT Closed(
[in] Windows.Foundation.TypedEventHandler<Windows.Graphics.Capture.GraphicsCaptureItem *, IInspectable *> *handler,
[out, retval] EventRegistrationToken *token);
[eventremove] HRESULT Closed([in] EventRegistrationToken token);
}
[
contract(Windows.Foundation.UniversalApiContract, 7.0),
exclusiveto(Windows.Graphics.Capture.GraphicsCaptureItem),
uuid(a87ebea5-457c-5788-ab47-0cf1d3637e74)
]
interface IGraphicsCaptureItemStatics : IInspectable
{
HRESULT CreateFromVisual(
[in] Windows.UI.Composition.Visual *visual,
[out, retval] Windows.Graphics.Capture.GraphicsCaptureItem **result);
}
[
contract(Windows.Foundation.UniversalApiContract, 12.0),
exclusiveto(Windows.Graphics.Capture.GraphicsCaptureItem),
uuid(3b92acc9-e584-5862-bf5c-9c316c6d2dbb)
]
interface IGraphicsCaptureItemStatics2 : IInspectable
{
HRESULT TryCreateFromWindowId(
[in] Windows.UI.WindowId window_id,
[out, retval] Windows.Graphics.Capture.GraphicsCaptureItem **result);
HRESULT TryCreateFromDisplayId(
[in] Windows.Graphics.DisplayId display_id,
[out, retval] Windows.Graphics.Capture.GraphicsCaptureItem **result);
}
[
contract(Windows.Foundation.UniversalApiContract, 6.0),
exclusiveto(Windows.Graphics.Capture.GraphicsCaptureSession),
@ -51,6 +198,28 @@ namespace Windows.Graphics.Capture {
HRESULT StartCapture();
}
[
contract(Windows.Foundation.UniversalApiContract, 10.0),
exclusiveto(Windows.Graphics.Capture.GraphicsCaptureSession),
uuid(2c39ae40-7d2e-5044-804e-8b6799d4cf9e)
]
interface IGraphicsCaptureSession2 : IInspectable
{
[propget] HRESULT IsCursorCaptureEnabled([out, retval] boolean *value);
[propput] HRESULT IsCursorCaptureEnabled([in] boolean value);
}
[
contract(Windows.Foundation.UniversalApiContract, 12.0),
exclusiveto(Windows.Graphics.Capture.GraphicsCaptureSession),
uuid(f2cdd966-22ae-5ea1-9596-3a289344c3be)
]
interface IGraphicsCaptureSession3 : IInspectable
{
[propget] HRESULT IsBorderRequired([out, retval] boolean *value);
[propput] HRESULT IsBorderRequired([in] boolean value);
}
[
contract(Windows.Foundation.UniversalApiContract, 6.0),
exclusiveto(Windows.Graphics.Capture.GraphicsCaptureSession),
@ -61,6 +230,42 @@ namespace Windows.Graphics.Capture {
HRESULT IsSupported([out, retval] boolean *result);
}
[
contract(Windows.Foundation.UniversalApiContract, 6.0),
marshaling_behavior(agile)
]
runtimeclass Direct3D11CaptureFrame
{
[default] interface Windows.Graphics.Capture.IDirect3D11CaptureFrame;
[contract(Windows.Foundation.UniversalApiContract, 19.0)] interface Windows.Graphics.Capture.IDirect3D11CaptureFrame2;
interface Windows.Foundation.IClosable;
}
[
contract(Windows.Foundation.UniversalApiContract, 6.0),
marshaling_behavior(agile),
static(Windows.Graphics.Capture.IDirect3D11CaptureFramePoolStatics, Windows.Foundation.UniversalApiContract, 6.0),
static(Windows.Graphics.Capture.IDirect3D11CaptureFramePoolStatics2, Windows.Foundation.UniversalApiContract, 7.0),
threading(both)
]
runtimeclass Direct3D11CaptureFramePool
{
[default] interface Windows.Graphics.Capture.IDirect3D11CaptureFramePool;
interface Windows.Foundation.IClosable;
}
[
contract(Windows.Foundation.UniversalApiContract, 6.0),
marshaling_behavior(agile),
static(Windows.Graphics.Capture.IGraphicsCaptureItemStatics, Windows.Foundation.UniversalApiContract, 7.0),
static(Windows.Graphics.Capture.IGraphicsCaptureItemStatics2, Windows.Foundation.UniversalApiContract, 12.0),
threading(both)
]
runtimeclass GraphicsCaptureItem
{
[default] interface Windows.Graphics.Capture.IGraphicsCaptureItem;
}
[
contract(Windows.Foundation.UniversalApiContract, 6.0),
marshaling_behavior(agile),

View File

@ -0,0 +1,97 @@
/*
* Copyright (C) 2024 Biswapriyo Nath
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef __WIDL__
#pragma winrt ns_prefix
#endif
import "inspectable.idl";
import "eventtoken.idl";
import "windowscontracts.idl";
import "windows.foundation.idl";
namespace Windows.Graphics {
typedef struct DisplayAdapterId DisplayAdapterId;
typedef struct DisplayId DisplayId;
typedef struct PointInt32 PointInt32;
typedef struct RectInt32 RectInt32;
typedef struct SizeInt32 SizeInt32;
interface IGeometrySource2D;
declare {
interface Windows.Foundation.Collections.IIterable<Windows.Graphics.RectInt32>;
interface Windows.Foundation.Collections.IIterator<Windows.Graphics.RectInt32>;
interface Windows.Foundation.Collections.IVectorView<Windows.Graphics.RectInt32>;
interface Windows.Foundation.IReference<Windows.Graphics.SizeInt32>;
}
[
contract(Windows.Foundation.UniversalApiContract, 6.0)
]
struct DisplayAdapterId
{
UINT32 LowPart;
INT32 HighPart;
};
[
contract(Windows.Foundation.UniversalApiContract, 12.0)
]
struct DisplayId
{
UINT64 Value;
};
[
contract(Windows.Foundation.UniversalApiContract, 4.0)
]
struct PointInt32
{
INT32 X;
INT32 Y;
};
[
contract(Windows.Foundation.UniversalApiContract, 4.0)
]
struct RectInt32
{
INT32 X;
INT32 Y;
INT32 Width;
INT32 Height;
};
[
contract(Windows.Foundation.UniversalApiContract, 4.0)
]
struct SizeInt32
{
INT32 Width;
INT32 Height;
};
[
contract(Windows.Foundation.UniversalApiContract, 6.0),
uuid(caff7902-670c-4181-a624-da977203b845)
]
interface IGeometrySource2D : IInspectable
{
}
}

View File

@ -888,11 +888,13 @@ struct shared_cursor
int x;
int y;
unsigned int last_change;
rectangle_t clip;
};
typedef volatile struct
{
struct shared_cursor cursor;
unsigned char keystate[256];
} desktop_shm_t;
typedef volatile union
@ -6567,7 +6569,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 813
#define SERVER_PROTOCOL_VERSION 815
/* ### protocol_version end ### */

View File

@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@ -38,9 +39,51 @@
extern char **environ;
#if defined(__APPLE__) && defined(__x86_64__) && !defined(HAVE_WINE_PRELOADER)
/* Not using the preloader on x86_64:
* Reserve the same areas as the preloader does, but using zero-fill sections
* (the only way to prevent system frameworks from using them, including allocations
* before main() runs).
*/
__asm__(".zerofill WINE_RESERVE,WINE_RESERVE");
static char __wine_reserve[0x1fffff000] __attribute__((section("WINE_RESERVE, WINE_RESERVE")));
__asm__(".zerofill WINE_TOP_DOWN,WINE_TOP_DOWN");
static char __wine_top_down[0x001ff0000] __attribute__((section("WINE_TOP_DOWN, WINE_TOP_DOWN")));
static const struct wine_preload_info preload_info[] =
{
{ __wine_reserve, sizeof(__wine_reserve) }, /* 0x1000 - 0x200000000: low 8GB */
{ __wine_top_down, sizeof(__wine_top_down) }, /* 0x7ff000000000 - 0x7ff001ff0000: top-down allocations + virtual heap */
{ 0, 0 } /* end of list */
};
const __attribute((visibility("default"))) struct wine_preload_info *wine_main_preload_info = preload_info;
static void init_reserved_areas(void)
{
int i;
for (i = 0; wine_main_preload_info[i].size != 0; i++)
{
/* Match how the preloader maps reserved areas: */
mmap(wine_main_preload_info[i].addr, wine_main_preload_info[i].size, PROT_NONE,
MAP_FIXED | MAP_NORESERVE | MAP_PRIVATE | MAP_ANON, -1, 0);
}
}
#else
/* the preloader will set this variable */
const __attribute((visibility("default"))) struct wine_preload_info *wine_main_preload_info = NULL;
static void init_reserved_areas(void)
{
}
#endif
/* canonicalize path and return its directory name */
static char *realpath_dirname( const char *name )
{
@ -177,6 +220,8 @@ int main( int argc, char *argv[] )
{
void *handle;
init_reserved_areas();
if ((handle = load_ntdll( argv[0] )))
{
void (*init_func)(int, char **, char **) = dlsym( handle, "__wine_main" );

View File

@ -15884,6 +15884,12 @@ msgstr ""
"صيغة الرقم غير سليمة حيث أنها يمكن أن تكون عشرية (12),\n"
" أو ست عشرية (0x34) أو ثماني (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "خطأ بنيوي\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "حجم المؤشر"

View File

@ -14479,6 +14479,12 @@ msgstr ""
"El númberu tien un formatu incorreutu. Ha ser\n"
"decimal (12), hexadecimal (0x34) o octal (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Error de la sintaxis\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Tamañu del cursor"

View File

@ -14575,6 +14575,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -14681,6 +14681,12 @@ msgstr ""
"El nombre és mal format - ha de ser un de decimal (12)\n"
" hexadecimal (0x34) o octal (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Error de sintaxi\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Mida de cursor"

View File

@ -15398,6 +15398,12 @@ msgstr ""
"Špatný formát čísla musí být desítkové (12),\n"
"šestnáctkové (0x34) či osmičkové (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Chyba syntaxe\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Velikost kurzoru"

View File

@ -15793,6 +15793,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Syntaks fejl\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Markør størrelse"

View File

@ -14663,6 +14663,12 @@ msgstr ""
"Zahl ungültig formatiert - muss dezimal (12),\n"
" hexadezimal (0x34) oder oktal (056) sein.\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Syntaxfehler\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Cursorgröße"

View File

@ -14331,6 +14331,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -14575,6 +14575,10 @@ msgstr ""
"Badly formed number - must be one of decimal (12),\n"
" hexadecimal (0x34) or octal (056).\n"
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr "Syntax error: unexpected %1\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Cursor size"

View File

@ -14575,6 +14575,10 @@ msgstr ""
"Badly formed number - must be one of decimal (12),\n"
" hexadecimal (0x34) or octal (056).\n"
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr "Syntax error: unexpected %1\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Cursor size"

View File

@ -14940,6 +14940,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Kursor-grando"

View File

@ -15258,6 +15258,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Error de sintaxis\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Tamaño del cursor"

View File

@ -14516,6 +14516,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -14555,6 +14555,12 @@ msgstr ""
"Luvun muoto ei kelpaa täytyy olla desimaaliluku (12),\n"
" heksadesimaaliluku (0x34) tai oktaaliluku (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Syntaksivirhe\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Kursorin koko"

View File

@ -15175,6 +15175,12 @@ msgstr ""
"Nombre mal formé : doit être décimal (12),\n"
" hexadécimal (0x34) ou octal (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Erreur de syntaxe\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Taille du curseur"

View File

@ -15339,6 +15339,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error"
msgid "Syntax error: unexpected %1\n"
msgstr "שגיאת תחביר"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "גודל הסמן"

View File

@ -14071,6 +14071,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -15350,6 +15350,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Sintaksna greška\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Veličina pokazivača"

View File

@ -15784,6 +15784,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Szintaktikai hiba\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Kurzor mérete"

View File

@ -15860,6 +15860,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Errore di sintassi\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Dimensione del cursore"

View File

@ -14575,6 +14575,12 @@ msgstr ""
"数値の形式に誤りがあります - 10 進数 (12)、16 進数 (0x34)、\n"
"8 進数 (056) のいずれかとする必要があります。\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "構文エラー\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "カーソルの大きさ"

View File

@ -14178,6 +14178,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "სინტაქსური შეცდომა\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "კურსორის ზომა"

View File

@ -14532,6 +14532,12 @@ msgstr ""
"잘못된 형식의 숫자 - 10진수(12)나,\n"
"16진수(0x34)나 8진수(056)중의 하나이어야 합니다.\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "문법 오류\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "커서 크기"

View File

@ -14581,6 +14581,12 @@ msgstr ""
"Blogai sudarytas skaičius privalo būti dešimtainis (12),\n"
" šešioliktainis (0x34) arba aštuntainis (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Sintaksės klaida\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Žymeklio dydis"

View File

@ -14070,6 +14070,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -15380,6 +15380,12 @@ msgstr ""
"Ugyldig tallformat - må være enten desimal (12),\n"
"heksadesimal (0x34) eller oktal (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Syntaksfeil\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Pekerstørrelse"

View File

@ -14630,6 +14630,12 @@ msgstr ""
"Misvormd nummer - moet of decimaal (12),\n"
" hexadecimaal (0x34) of octaal (056) zijn.\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Formuleringsfout\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Cursorgrootte"

View File

@ -14056,6 +14056,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -14056,6 +14056,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -14615,6 +14615,12 @@ msgstr ""
"Zły format liczbowy - musi on być jednym z formatów dziesiętnych (12),\n"
" szesnastkowych (0x34) lub ósemkowych (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Błąd składni\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Rozmiar kursora"

View File

@ -14781,6 +14781,12 @@ msgstr ""
"Número malformado - deve ser decimal (12),\n"
" hexadecimal (0x34) ou octal (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Erro de sintaxe\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Cursor"

View File

@ -15555,6 +15555,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Erro de sintaxe\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Tamanho do Cursor"

View File

@ -14144,6 +14144,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -15629,6 +15629,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Eroare de sintaxă\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Dimensiune cursor"

View File

@ -15012,6 +15012,12 @@ msgstr ""
"Неверный формат числа - должен быть десятичный (12),\n"
" шестнадцатеричный (0x34) или восьмеричный (056) формат.\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Синтаксическая ошибка\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Размер курсора"

View File

@ -14677,6 +14677,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "වාග් රීති දෝෂයක්\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "කර්සරය ප්රමාණය"

View File

@ -15096,6 +15096,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -15814,6 +15814,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Napaka skladnje\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Velikost kazalca"

View File

@ -15125,6 +15125,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error"
msgid "Syntax error: unexpected %1\n"
msgstr "Грешка у синтакси"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -15266,6 +15266,12 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error"
msgid "Syntax error: unexpected %1\n"
msgstr "Greška u sintaksi"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -15509,6 +15509,12 @@ msgstr ""
"Felaktigt talformat - måste vara en av decimal (12),\n"
" hexadecimal (0x34) eller oktal (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Syntaxfel\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Markörstorlek"

View File

@ -14044,6 +14044,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -14056,6 +14056,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -14607,6 +14607,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -14601,6 +14601,12 @@ msgstr ""
"Hatalı numara biçimi - ondalık (12), onaltılı (0x34) veya sekizli (056) "
"olmalıdır.\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Sözdizimi hatası\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "İmleç boyutu"

View File

@ -14874,6 +14874,12 @@ msgstr ""
"Неправильно сформоване число - має бути або десятковим (12),\n"
" або шістнадцятковим (0x34), або вісімковим (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Синтаксична помилка\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "Розмір курсора"

View File

@ -14501,6 +14501,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -13971,6 +13971,10 @@ msgid ""
" hexadecimal (0x34) or octal (056).\n"
msgstr ""
#: programs/cmd/cmd.rc:411
msgid "Syntax error: unexpected %1\n"
msgstr ""
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr ""

View File

@ -14369,6 +14369,12 @@ msgstr ""
"数字的格式错误 - 必须是十进制 (12),\n"
" 十六进制 (0x34) 或者八进制 (056)。\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "语法错误\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "光标尺寸"

View File

@ -14435,6 +14435,12 @@ msgstr ""
"錯誤的數字形式 - 必須是十進位 (12)、\n"
" 十六進位 (0x34) 或八進位 (056) 之一。\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "語法錯誤\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"
msgstr "游標大小"

View File

@ -77,7 +77,7 @@ void WCMD_batch (WCHAR *file, WCHAR *command, BOOL called, WCHAR *startLabel, HA
/* If processing a call :label, 'goto' the label in question */
if (startLabel) {
lstrcpyW(param1, startLabel);
WCMD_goto(NULL);
WCMD_goto();
}
/*
@ -654,7 +654,7 @@ void WCMD_call (WCHAR *command) {
if (*command != ':') {
WCMD_run_program(command, TRUE);
/* If the thing we try to run does not exist, call returns 1 */
if (errorlevel) errorlevel=1;
if (errorlevel) errorlevel = ERROR_INVALID_FUNCTION;
} else {
WCHAR gotoLabel[MAX_PATH];

View File

@ -303,7 +303,7 @@ void WCMD_choice (const WCHAR * args) {
BOOL opt_s = FALSE;
have_console = GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &oldmode);
errorlevel = 0;
errorlevel = NO_ERROR;
my_command = xstrdupW(WCMD_skip_leading_spaces((WCHAR*)args));
@ -422,7 +422,7 @@ void WCMD_choice (const WCHAR * args) {
if (!WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), answer, 1, &count))
{
free(my_command);
errorlevel = 0;
errorlevel = NO_ERROR;
return;
}
@ -641,12 +641,12 @@ void WCMD_copy(WCHAR * args) {
COPY_FILES *prevcopy = NULL;
/* Assume we were successful! */
errorlevel = 0;
errorlevel = NO_ERROR;
/* If no args supplied at all, report an error */
if (param1[0] == 0x00) {
WCMD_output_stderr (WCMD_LoadMessage(WCMD_NOARG));
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
return;
}
@ -726,7 +726,7 @@ void WCMD_copy(WCHAR * args) {
if (*thisparam=='+') {
if (lastcopyentry == NULL) {
WCMD_output_stderr(WCMD_LoadMessage(WCMD_SYNTAXERR));
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
goto exitreturn;
} else {
concatnextfilename = TRUE;
@ -781,7 +781,7 @@ void WCMD_copy(WCHAR * args) {
} else {
/* We have processed sources and destinations and still found more to do - invalid */
WCMD_output_stderr(WCMD_LoadMessage(WCMD_SYNTAXERR));
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
goto exitreturn;
}
concatnextfilename = FALSE;
@ -798,7 +798,7 @@ void WCMD_copy(WCHAR * args) {
/* Ensure we have at least one source file */
if (!sourcelist) {
WCMD_output_stderr(WCMD_LoadMessage(WCMD_SYNTAXERR));
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
goto exitreturn;
}
@ -1046,7 +1046,7 @@ void WCMD_copy(WCHAR * args) {
}
if (!status) {
WCMD_print_error ();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
} else {
WINE_TRACE("Copied successfully\n");
if (anyconcats) writtenoneconcat = TRUE;
@ -1058,7 +1058,7 @@ void WCMD_copy(WCHAR * args) {
if (!destination->binarycopy && !anyconcats && !thiscopy->binarycopy) {
if (!WCMD_AppendEOF(outname)) {
WCMD_print_error ();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
}
}
}
@ -1070,7 +1070,7 @@ void WCMD_copy(WCHAR * args) {
/* Error if the first file was not found */
if (!anyconcats || !writtenoneconcat) {
WCMD_print_error ();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
}
}
@ -1082,7 +1082,7 @@ void WCMD_copy(WCHAR * args) {
if (!errorlevel && !destination->binarycopy && anyconcats && writtenoneconcat) {
if (!WCMD_AppendEOF(destination->name)) {
WCMD_print_error ();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
}
}
@ -1165,7 +1165,7 @@ void WCMD_create_dir (WCHAR *args) {
if (!argN) break;
if (!create_full_path(thisArg)) {
WCMD_print_error ();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
}
}
}
@ -1444,7 +1444,7 @@ BOOL WCMD_delete (WCHAR *args) {
BOOL argsProcessed = FALSE;
BOOL foundAny = FALSE;
errorlevel = 0;
errorlevel = NO_ERROR;
for (argno=0; ; argno++) {
BOOL found;
@ -1926,7 +1926,7 @@ void WCMD_give_help (const WCHAR *args)
}
/****************************************************************************
* WCMD_go_to
* WCMD_goto
*
* Batch file jump instruction. Not the most efficient algorithm ;-)
* Prints error message if the specified label cannot be found - the file pointer is
@ -1934,27 +1934,24 @@ void WCMD_give_help (const WCHAR *args)
* FIXME: DOS is supposed to allow labels with spaces - we don't.
*/
void WCMD_goto (CMD_NODE **cmdList) {
RETURN_CODE WCMD_goto(void)
{
WCHAR string[MAX_PATH];
WCHAR *labelend = NULL;
const WCHAR labelEndsW[] = L"><|& :\t";
/* Do not process any more parts of a processed multipart or multilines command */
if (cmdList) *cmdList = NULL;
if (context != NULL) {
WCHAR *paramStart = param1, *str;
if (param1[0] == 0x00) {
WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOARG));
return;
return ERROR_INVALID_FUNCTION;
}
/* Handle special :EOF label */
if (lstrcmpiW(L":eof", param1) == 0) {
context -> skip_rest = TRUE;
return;
return RETURN_CODE_ABORTED;
}
/* Support goto :label as well as goto label plus remove trailing chars */
@ -2000,7 +1997,7 @@ void WCMD_goto (CMD_NODE **cmdList) {
if (labelend) *labelend = 0x00;
WINE_TRACE("comparing found label %s\n", wine_dbgstr_w(str));
if (lstrcmpiW (str, paramStart) == 0) return;
if (lstrcmpiW (str, paramStart) == 0) return RETURN_CODE_ABORTED;
}
/* See if we have gone beyond the end point if second time through */
@ -2021,7 +2018,7 @@ void WCMD_goto (CMD_NODE **cmdList) {
WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOTARGET));
context -> skip_rest = TRUE;
}
return;
return ERROR_INVALID_FUNCTION;
}
/*****************************************************************************
@ -2053,7 +2050,7 @@ void WCMD_pushd (const WCHAR *args)
/* Change directory using CD code with /D parameter */
lstrcpyW(quals, L"/D");
GetCurrentDirectoryW (1024, thisdir);
errorlevel = 0;
errorlevel = NO_ERROR;
WCMD_setshow_default(args);
if (errorlevel) {
LocalFree(curdir);
@ -2253,7 +2250,7 @@ void WCMD_move (void)
if (!status) {
WCMD_print_error ();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
}
} while (FindNextFileW(hff, &fd) != 0);
@ -2368,12 +2365,12 @@ void WCMD_rename (void)
WCHAR fname[MAX_PATH];
WCHAR ext[MAX_PATH];
errorlevel = 0;
errorlevel = NO_ERROR;
/* Must be at least two args */
if (param1[0] == 0x00 || param2[0] == 0x00) {
WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOARG));
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
return;
}
@ -2381,7 +2378,7 @@ void WCMD_rename (void)
if ((wcschr(param2,':') != NULL) || (wcschr(param2,'\\') != NULL)) {
SetLastError(ERROR_INVALID_PARAMETER);
WCMD_print_error();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
return;
}
@ -2444,7 +2441,7 @@ void WCMD_rename (void)
if (!status) {
WCMD_print_error ();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
}
} while (FindNextFileW(hff, &fd) != 0);
@ -2683,7 +2680,7 @@ void WCMD_setshow_default (const WCHAR *args) {
status = SetCurrentDirectoryW(string);
if (!status) {
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
WCMD_print_error ();
return;
} else {
@ -3432,7 +3429,7 @@ void WCMD_setshow_env (WCHAR *s) {
env = GetEnvironmentStringsW();
if (WCMD_setshow_sortenv( env, s ) == 0) {
WCMD_output_stderr(WCMD_LoadMessage(WCMD_MISSINGENV), s);
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
}
return;
}
@ -3444,9 +3441,9 @@ void WCMD_setshow_env (WCHAR *s) {
status = SetEnvironmentVariableW(s, p);
gle = GetLastError();
if ((!status) & (gle == ERROR_ENVVAR_NOT_FOUND)) {
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
} else if (!status) WCMD_print_error();
else if (!interactive) errorlevel = 0;
else if (!interactive) errorlevel = NO_ERROR;
}
}
@ -3675,7 +3672,7 @@ void WCMD_start(WCHAR *args)
DWORD exit_code;
WaitForSingleObject( pi.hProcess, INFINITE );
GetExitCodeProcess( pi.hProcess, &exit_code );
errorlevel = (exit_code == STILL_ACTIVE) ? 0 : exit_code;
errorlevel = (exit_code == STILL_ACTIVE) ? NO_ERROR : exit_code;
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
@ -3683,7 +3680,7 @@ void WCMD_start(WCHAR *args)
{
SetLastError(ERROR_FILE_NOT_FOUND);
WCMD_print_error ();
errorlevel = 9009;
errorlevel = RETURN_CODE_CANT_LAUNCH;
}
free(cmdline);
}
@ -3717,7 +3714,7 @@ void WCMD_type (WCHAR *args) {
if (param2[0] != 0x00) writeHeaders = TRUE;
/* Loop through all args */
errorlevel = 0;
errorlevel = NO_ERROR;
while (argN) {
WCHAR *thisArg = WCMD_parameter (args, argno++, &argN, FALSE, FALSE);
@ -3733,7 +3730,7 @@ void WCMD_type (WCHAR *args) {
if (h == INVALID_HANDLE_VALUE) {
WCMD_print_error ();
WCMD_output_stderr(WCMD_LoadMessage(WCMD_READFAIL), thisArg);
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
} else {
if (writeHeaders) {
WCMD_output_stderr(L"\n%1\n\n\n", thisArg);
@ -3764,7 +3761,7 @@ void WCMD_more (WCHAR *args) {
DWORD count;
/* Prefix the NLS more with '-- ', then load the text */
errorlevel = 0;
errorlevel = NO_ERROR;
lstrcpyW(moreStr, L"-- ");
LoadStringW(hinst, WCMD_MORESTR, &moreStr[3], ARRAY_SIZE(moreStr)-3);
@ -3828,7 +3825,7 @@ void WCMD_more (WCHAR *args) {
if (h == INVALID_HANDLE_VALUE) {
WCMD_print_error ();
WCMD_output_stderr(WCMD_LoadMessage(WCMD_READFAIL), thisArg);
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
} else {
ULONG64 curPos = 0;
ULONG64 fileLen = 0;
@ -3966,16 +3963,17 @@ int WCMD_volume(BOOL set_label, const WCHAR *path)
*
*/
void WCMD_exit (CMD_NODE **cmdList) {
RETURN_CODE WCMD_exit(void)
{
int rc = wcstol(param1, NULL, 10); /* Note: wcstol of empty parameter is 0 */
if (context && lstrcmpiW(quals, L"/B") == 0) {
if (context && lstrcmpiW(quals, L"/B") == 0)
{
errorlevel = rc;
context -> skip_rest = TRUE;
*cmdList = NULL;
} else {
ExitProcess(rc);
return RETURN_CODE_ABORTED;
}
ExitProcess(rc);
}
@ -3996,7 +3994,7 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
HKEY readKey;
/* See if parameter includes '=' */
errorlevel = 0;
errorlevel = NO_ERROR;
newValue = wcschr(args, '=');
if (newValue) accessOptions |= KEY_WRITE;
@ -4084,7 +4082,7 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
LoadStringW(hinst, WCMD_NOFTYPE, msgbuffer, ARRAY_SIZE(msgbuffer));
}
WCMD_output_stderr(msgbuffer, keyValue);
errorlevel = 2;
errorlevel = ERROR_FILE_NOT_FOUND;
}
/* Not a query - it's a set or clear of a value */
@ -4109,7 +4107,7 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
} else if (assoc && rc != ERROR_FILE_NOT_FOUND) {
WCMD_print_error();
errorlevel = 2;
errorlevel = ERROR_FILE_NOT_FOUND;
} else {
WCHAR msgbuffer[MAXSTRING];
@ -4121,7 +4119,7 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
LoadStringW(hinst, WCMD_NOFTYPE, msgbuffer, ARRAY_SIZE(msgbuffer));
}
WCMD_output_stderr(msgbuffer, args);
errorlevel = 2;
errorlevel = ERROR_FILE_NOT_FOUND;
}
/* It really is a set value = contents */
@ -4137,7 +4135,7 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
if (rc != ERROR_SUCCESS) {
WCMD_print_error();
errorlevel = 2;
errorlevel = ERROR_FILE_NOT_FOUND;
} else {
WCMD_output_asis(args);
WCMD_output_asis(L"=");
@ -4188,7 +4186,7 @@ void WCMD_color (void) {
/* Fail if fg == bg color */
if (((color & 0xF0) >> 4) == (color & 0x0F)) {
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
return;
}

View File

@ -407,4 +407,5 @@ Enter HELP <command> for further information on any of the above commands.\n"
WCMD_BADPAREN, "Mismatch in parentheses.\n"
WCMD_BADHEXOCT, "Badly formed number - must be one of decimal (12),\n hexadecimal (0x34) or octal (056).\n"
WCMD_FILENAMETOOLONG, "File name is too long.\n"
WCMD_BADTOKEN, "Syntax error: unexpected %1\n"
}

View File

@ -494,7 +494,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if ((file_total + dir_total == 0) && (level == 0)) {
SetLastError (ERROR_FILE_NOT_FOUND);
WCMD_print_error ();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
}
return parms;
@ -513,7 +513,7 @@ static void WCMD_dir_trailer(const WCHAR *path) {
WINE_TRACE("Writing trailer for '%s' gave %d(%ld)\n", wine_dbgstr_w(path),
status, GetLastError());
if (errorlevel==0 && !bare) {
if (errorlevel == NO_ERROR && !bare) {
if (recurse) {
WCMD_output (L"\n Total files listed:\n%1!8d! files%2!25s! bytes\n", file_total, WCMD_filesize64 (byte_total));
WCMD_output (L"%1!8d! directories %2!18s! bytes free\n\n", dir_total, WCMD_filesize64 (freebytes.QuadPart));
@ -650,7 +650,7 @@ void WCMD_directory (WCHAR *args)
WCHAR fname[MAX_PATH];
WCHAR ext[MAX_PATH];
errorlevel = 0;
errorlevel = NO_ERROR;
/* Prefill quals with (uppercased) DIRCMD env var */
if (GetEnvironmentVariableW(L"DIRCMD", string, ARRAY_SIZE(string))) {
@ -736,7 +736,7 @@ void WCMD_directory (WCHAR *args)
} else {
SetLastError(ERROR_INVALID_PARAMETER);
WCMD_print_error();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
return;
}
break;
@ -756,7 +756,7 @@ void WCMD_directory (WCHAR *args)
default:
SetLastError(ERROR_INVALID_PARAMETER);
WCMD_print_error();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
return;
}
p++;
@ -787,7 +787,7 @@ void WCMD_directory (WCHAR *args)
default:
SetLastError(ERROR_INVALID_PARAMETER);
WCMD_print_error();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
return;
}
@ -806,7 +806,7 @@ void WCMD_directory (WCHAR *args)
default:
SetLastError(ERROR_INVALID_PARAMETER);
WCMD_print_error();
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
return;
}
p = p + 1;
@ -945,7 +945,7 @@ void WCMD_directory (WCHAR *args)
status = WCMD_volume (0, drive);
trailerReqd = TRUE;
if (!status) {
errorlevel = 1;
errorlevel = ERROR_INVALID_FUNCTION;
goto exit;
}
}
@ -954,7 +954,7 @@ void WCMD_directory (WCHAR *args)
}
/* Clear any errors from previous invocations, and process it */
errorlevel = 0;
errorlevel = NO_ERROR;
prevEntry = thisEntry;
thisEntry = WCMD_list_directory (thisEntry, 0);
}

View File

@ -802,6 +802,12 @@ if %WINE_FOO% == foo (
set WINE_FOO=bar
if !WINE_FOO! == bar (echo bar) else echo foo
)
set WINE_FOO=32
if %WINE_FOO% == 32 (
set WINE_FOO=33
call :setError 33
if errorlevel !WINE_FOO! (echo gotitright) else echo gotitwrong
)
echo %ErrorLevel%
setlocal DisableDelayedExpansion
echo %ErrorLevel%

Some files were not shown because too many files have changed in this diff Show More