mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 19:53:14 +00:00
[KERNELBASE][KERNEL32] Import KernelBase from WINE-10.0 (#8049)
* [KERNELBASE] Import KernelBase from wine-10.0 * [KERNELBASE] Create some cmake files and add stuff into headers
This commit is contained in:
parent
1286711ac4
commit
9fe829874b
26 changed files with 50869 additions and 2 deletions
14
dll/win32/kernelbase/CMakeLists.txt
Normal file
14
dll/win32/kernelbase/CMakeLists.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502)
|
||||
add_definitions(-D_WIN32_WINNT=0x601 -DWINVER=0x601)
|
||||
|
||||
add_definitions(
|
||||
-D__WINESRC__
|
||||
-D_WINE
|
||||
-D__ROS_LONG64__
|
||||
-D_KERNELBASE_)
|
||||
|
||||
include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
|
||||
|
||||
#add_subdirectory(wine)
|
||||
# TODO: ReactOS Isn't ready for Kernelbase.dll
|
52
dll/win32/kernelbase/wine/CMakeLists.txt
Normal file
52
dll/win32/kernelbase/wine/CMakeLists.txt
Normal file
|
@ -0,0 +1,52 @@
|
|||
add_definitions(-D__WINESRC__ -D_KERNEL32_ -DWINVER=0x601 -D_WIN32_WINNT=0x601)
|
||||
add_definitions(
|
||||
-D__WINESRC__
|
||||
-D_WINE
|
||||
-D__ROS_LONG64__
|
||||
-Dwcsnicmp=_wcsnicmp
|
||||
-Dwcsicmp=_wcsicmp
|
||||
-Dstrnicmp=_strnicmp
|
||||
-Dswprintf=_swprintf
|
||||
-D_KERNELBASE_)
|
||||
|
||||
include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
|
||||
CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
# Silence GCC/Clang warnings
|
||||
add_compile_options(
|
||||
-Wno-unused-function
|
||||
-Wno-unknown-pragmas
|
||||
-Wno-unused-variable
|
||||
-Wno-unused-value
|
||||
-Wno-unused-function
|
||||
)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-reorder>)
|
||||
endif()
|
||||
|
||||
#list(APPEND SOURCE_PATH
|
||||
# path.c
|
||||
# )
|
||||
#
|
||||
#add_library(kernelbase_path ${SOURCE_PATH})
|
||||
#target_link_libraries(kernelbase_path ${PSEH_LIB})
|
||||
#add_dependencies(kernelbase_path psdk)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(kernelbase_path PRIVATE -Wno-unused-variable)
|
||||
target_compile_options(kernelbase_path PRIVATE -Wno-unused-function)
|
||||
endif()
|
||||
|
||||
list(APPEND SOURCE_STATIC
|
||||
#console.c #looks like ReactOS console.c is nothing like wine.
|
||||
)
|
||||
|
||||
add_library(kernelbase_static ${SOURCE_STATIC})
|
||||
target_link_libraries(kernelbase_static psapi_static ${PSEH_LIB})
|
||||
add_dependencies(kernelbase_static psdk)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(kernelbase_static PRIVATE -Wno-unused-variable)
|
||||
target_compile_options(kernelbase_static PRIVATE -Wno-unused-function)
|
||||
endif()
|
||||
|
2389
dll/win32/kernelbase/wine/console.c
Normal file
2389
dll/win32/kernelbase/wine/console.c
Normal file
File diff suppressed because it is too large
Load diff
1820
dll/win32/kernelbase/wine/debug.c
Normal file
1820
dll/win32/kernelbase/wine/debug.c
Normal file
File diff suppressed because it is too large
Load diff
4605
dll/win32/kernelbase/wine/file.c
Normal file
4605
dll/win32/kernelbase/wine/file.c
Normal file
File diff suppressed because it is too large
Load diff
63
dll/win32/kernelbase/wine/kernelbase.h
Normal file
63
dll/win32/kernelbase/wine/kernelbase.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Kernelbase internal definitions
|
||||
*
|
||||
* Copyright 2019 Alexandre Julliard
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __WINE_KERNELBASE_H
|
||||
#define __WINE_KERNELBASE_H
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
#ifdef __REACTOS__
|
||||
#include "synchacks.h"
|
||||
#endif
|
||||
|
||||
|
||||
struct pseudo_console
|
||||
{
|
||||
HANDLE signal;
|
||||
HANDLE reference;
|
||||
HANDLE process;
|
||||
};
|
||||
|
||||
extern WCHAR *file_name_AtoW( LPCSTR name, BOOL alloc );
|
||||
extern DWORD file_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen );
|
||||
extern void init_global_data(void);
|
||||
extern void init_startup_info( RTL_USER_PROCESS_PARAMETERS *params );
|
||||
extern void init_locale( HMODULE module );
|
||||
extern void init_console(void);
|
||||
|
||||
extern const WCHAR windows_dir[];
|
||||
extern const WCHAR system_dir[];
|
||||
|
||||
static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
|
||||
extern BOOL is_wow64;
|
||||
|
||||
static inline BOOL set_ntstatus( NTSTATUS status )
|
||||
{
|
||||
if (status) SetLastError( RtlNtStatusToDosError( status ));
|
||||
return !status;
|
||||
}
|
||||
|
||||
/* make the kernel32 names available */
|
||||
#define HeapAlloc(heap, flags, size) RtlAllocateHeap(heap, flags, size)
|
||||
#define HeapReAlloc(heap, flags, ptr, size) RtlReAllocateHeap(heap, flags, ptr, size)
|
||||
#define HeapFree(heap, flags, ptr) RtlFreeHeap(heap, flags, ptr)
|
||||
|
||||
#endif /* __WINE_KERNELBASE_H */
|
46
dll/win32/kernelbase/wine/kernelbase.rc
Normal file
46
dll/win32/kernelbase/wine/kernelbase.rc
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright 2020 Alexandre Julliard
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#pragma makedep po
|
||||
|
||||
#include <winresrc.h>
|
||||
#include <winnls.h>
|
||||
|
||||
/* @makedep: kernelbase.rgs */
|
||||
1 WINE_REGISTRY kernelbase.rgs
|
||||
|
||||
STRINGTABLE LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
{
|
||||
LGRPID_WESTERN_EUROPE "Western Europe and United States"
|
||||
LGRPID_CENTRAL_EUROPE "Central Europe"
|
||||
LGRPID_BALTIC "Baltic"
|
||||
LGRPID_GREEK "Greek"
|
||||
LGRPID_CYRILLIC "Cyrillic"
|
||||
LGRPID_TURKISH "Turkic"
|
||||
LGRPID_JAPANESE "Japanese"
|
||||
LGRPID_KOREAN "Korean"
|
||||
LGRPID_TRADITIONAL_CHINESE "Traditional Chinese"
|
||||
LGRPID_SIMPLIFIED_CHINESE "Simplified Chinese"
|
||||
LGRPID_THAI "Thai"
|
||||
LGRPID_HEBREW "Hebrew"
|
||||
LGRPID_ARABIC "Arabic"
|
||||
LGRPID_VIETNAMESE "Vietnamese"
|
||||
LGRPID_INDIC "Indic"
|
||||
LGRPID_GEORGIAN "Georgian"
|
||||
LGRPID_ARMENIAN "Armenian"
|
||||
}
|
3755
dll/win32/kernelbase/wine/kernelbase.rgs
Normal file
3755
dll/win32/kernelbase/wine/kernelbase.rgs
Normal file
File diff suppressed because it is too large
Load diff
1822
dll/win32/kernelbase/wine/kernelbase.spec
Normal file
1822
dll/win32/kernelbase/wine/kernelbase.spec
Normal file
File diff suppressed because it is too large
Load diff
1263
dll/win32/kernelbase/wine/loader.c
Normal file
1263
dll/win32/kernelbase/wine/loader.c
Normal file
File diff suppressed because it is too large
Load diff
8376
dll/win32/kernelbase/wine/locale.c
Normal file
8376
dll/win32/kernelbase/wine/locale.c
Normal file
File diff suppressed because it is too large
Load diff
572
dll/win32/kernelbase/wine/main.c
Normal file
572
dll/win32/kernelbase/wine/main.c
Normal file
|
@ -0,0 +1,572 @@
|
|||
/*
|
||||
* Copyright 2016 Michael Müller
|
||||
* Copyright 2017 Andrey Gusev
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "windows.h"
|
||||
#include "appmodel.h"
|
||||
#include "shlwapi.h"
|
||||
#include "perflib.h"
|
||||
#include "winternl.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "kernelbase.h"
|
||||
#include "wine/heap.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(kernelbase);
|
||||
|
||||
|
||||
BOOL is_wow64 = FALSE;
|
||||
|
||||
/***********************************************************************
|
||||
* DllMain
|
||||
*/
|
||||
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
||||
{
|
||||
if (reason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
DisableThreadLibraryCalls( hinst );
|
||||
IsWow64Process( GetCurrentProcess(), &is_wow64 );
|
||||
init_global_data();
|
||||
init_locale( hinst );
|
||||
init_startup_info( NtCurrentTeb()->Peb->ProcessParameters );
|
||||
init_console();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* MulDiv (kernelbase.@)
|
||||
*/
|
||||
INT WINAPI MulDiv( INT a, INT b, INT c )
|
||||
{
|
||||
LONGLONG ret;
|
||||
|
||||
if (!c) return -1;
|
||||
|
||||
/* We want to deal with a positive divisor to simplify the logic. */
|
||||
if (c < 0)
|
||||
{
|
||||
a = -a;
|
||||
c = -c;
|
||||
}
|
||||
|
||||
/* If the result is positive, we "add" to round. else, we subtract to round. */
|
||||
if ((a < 0 && b < 0) || (a >= 0 && b >= 0))
|
||||
ret = (((LONGLONG)a * b) + (c / 2)) / c;
|
||||
else
|
||||
ret = (((LONGLONG)a * b) - (c / 2)) / c;
|
||||
|
||||
if (ret > 2147483647 || ret < -2147483647) return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AppPolicyGetMediaFoundationCodecLoading (KERNELBASE.@)
|
||||
*/
|
||||
|
||||
LONG WINAPI AppPolicyGetMediaFoundationCodecLoading(HANDLE token, AppPolicyMediaFoundationCodecLoading *policy)
|
||||
{
|
||||
FIXME("%p, %p\n", token, policy);
|
||||
|
||||
if(policy)
|
||||
*policy = AppPolicyMediaFoundationCodecLoading_All;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AppPolicyGetProcessTerminationMethod (KERNELBASE.@)
|
||||
*/
|
||||
LONG WINAPI AppPolicyGetProcessTerminationMethod(HANDLE token, AppPolicyProcessTerminationMethod *policy)
|
||||
{
|
||||
FIXME("%p, %p\n", token, policy);
|
||||
|
||||
if(policy)
|
||||
*policy = AppPolicyProcessTerminationMethod_ExitProcess;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AppPolicyGetThreadInitializationType (KERNELBASE.@)
|
||||
*/
|
||||
LONG WINAPI AppPolicyGetThreadInitializationType(HANDLE token, AppPolicyThreadInitializationType *policy)
|
||||
{
|
||||
FIXME("%p, %p\n", token, policy);
|
||||
|
||||
if(policy)
|
||||
*policy = AppPolicyThreadInitializationType_None;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AppPolicyGetShowDeveloperDiagnostic (KERNELBASE.@)
|
||||
*/
|
||||
LONG WINAPI AppPolicyGetShowDeveloperDiagnostic(HANDLE token, AppPolicyShowDeveloperDiagnostic *policy)
|
||||
{
|
||||
FIXME("%p, %p\n", token, policy);
|
||||
|
||||
if(policy)
|
||||
*policy = AppPolicyShowDeveloperDiagnostic_ShowUI;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AppPolicyGetWindowingModel (KERNELBASE.@)
|
||||
*/
|
||||
LONG WINAPI AppPolicyGetWindowingModel(HANDLE token, AppPolicyWindowingModel *policy)
|
||||
{
|
||||
FIXME("%p, %p\n", token, policy);
|
||||
|
||||
if(policy)
|
||||
*policy = AppPolicyWindowingModel_ClassicDesktop;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
struct counterset_template
|
||||
{
|
||||
PERF_COUNTERSET_INFO counterset;
|
||||
PERF_COUNTER_INFO counter[1];
|
||||
};
|
||||
|
||||
struct counterset_instance
|
||||
{
|
||||
struct list entry;
|
||||
struct counterset_template *template;
|
||||
PERF_COUNTERSET_INSTANCE instance;
|
||||
};
|
||||
|
||||
struct perf_provider
|
||||
{
|
||||
GUID guid;
|
||||
PERFLIBREQUEST callback;
|
||||
struct counterset_template **countersets;
|
||||
unsigned int counterset_count;
|
||||
|
||||
struct list instance_list;
|
||||
};
|
||||
|
||||
static struct perf_provider *perf_provider_from_handle(HANDLE prov)
|
||||
{
|
||||
return (struct perf_provider *)prov;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PerfCreateInstance (KERNELBASE.@)
|
||||
*/
|
||||
PERF_COUNTERSET_INSTANCE WINAPI *PerfCreateInstance( HANDLE handle, const GUID *guid,
|
||||
const WCHAR *name, ULONG id )
|
||||
{
|
||||
struct perf_provider *prov = perf_provider_from_handle( handle );
|
||||
struct counterset_template *template;
|
||||
struct counterset_instance *inst;
|
||||
unsigned int i;
|
||||
ULONG size;
|
||||
|
||||
FIXME( "handle %p, guid %s, name %s, id %lu semi-stub.\n", handle, debugstr_guid(guid), debugstr_w(name), id );
|
||||
|
||||
if (!prov || !guid || !name)
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < prov->counterset_count; ++i)
|
||||
if (IsEqualGUID(guid, &prov->countersets[i]->counterset.CounterSetGuid)) break;
|
||||
|
||||
if (i == prov->counterset_count)
|
||||
{
|
||||
SetLastError( ERROR_NOT_FOUND );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template = prov->countersets[i];
|
||||
|
||||
LIST_FOR_EACH_ENTRY(inst, &prov->instance_list, struct counterset_instance, entry)
|
||||
{
|
||||
if (inst->template == template && inst->instance.InstanceId == id)
|
||||
{
|
||||
SetLastError( ERROR_ALREADY_EXISTS );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
size = (sizeof(PERF_COUNTERSET_INSTANCE) + template->counterset.NumCounters * sizeof(UINT64)
|
||||
+ (lstrlenW( name ) + 1) * sizeof(WCHAR) + 7) & ~7;
|
||||
inst = heap_alloc_zero( offsetof(struct counterset_instance, instance) + size );
|
||||
if (!inst)
|
||||
{
|
||||
SetLastError( ERROR_OUTOFMEMORY );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inst->template = template;
|
||||
inst->instance.CounterSetGuid = *guid;
|
||||
inst->instance.dwSize = size;
|
||||
inst->instance.InstanceId = id;
|
||||
inst->instance.InstanceNameOffset = sizeof(PERF_COUNTERSET_INSTANCE)
|
||||
+ template->counterset.NumCounters * sizeof(UINT64);
|
||||
inst->instance.InstanceNameSize = (lstrlenW( name ) + 1) * sizeof(WCHAR);
|
||||
memcpy( (BYTE *)&inst->instance + inst->instance.InstanceNameOffset, name, inst->instance.InstanceNameSize );
|
||||
list_add_tail( &prov->instance_list, &inst->entry );
|
||||
|
||||
return &inst->instance;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PerfDeleteInstance (KERNELBASE.@)
|
||||
*/
|
||||
ULONG WINAPI PerfDeleteInstance(HANDLE provider, PERF_COUNTERSET_INSTANCE *block)
|
||||
{
|
||||
struct perf_provider *prov = perf_provider_from_handle( provider );
|
||||
struct counterset_instance *inst;
|
||||
|
||||
TRACE( "provider %p, block %p.\n", provider, block );
|
||||
|
||||
if (!prov || !block) return ERROR_INVALID_PARAMETER;
|
||||
|
||||
inst = CONTAINING_RECORD(block, struct counterset_instance, instance);
|
||||
list_remove( &inst->entry );
|
||||
heap_free( inst );
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PerfSetCounterSetInfo (KERNELBASE.@)
|
||||
*/
|
||||
ULONG WINAPI PerfSetCounterSetInfo( HANDLE handle, PERF_COUNTERSET_INFO *template, ULONG size )
|
||||
{
|
||||
struct perf_provider *prov = perf_provider_from_handle( handle );
|
||||
struct counterset_template **new_array;
|
||||
struct counterset_template *new;
|
||||
unsigned int i;
|
||||
|
||||
FIXME( "handle %p, template %p, size %lu semi-stub.\n", handle, template, size );
|
||||
|
||||
if (!prov || !template) return ERROR_INVALID_PARAMETER;
|
||||
if (!template->NumCounters) return ERROR_INVALID_PARAMETER;
|
||||
if (size < sizeof(*template) || (size - (sizeof(*template))) / sizeof(PERF_COUNTER_INFO) < template->NumCounters)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
for (i = 0; i < prov->counterset_count; ++i)
|
||||
{
|
||||
if (IsEqualGUID( &template->CounterSetGuid, &prov->countersets[i]->counterset.CounterSetGuid ))
|
||||
return ERROR_ALREADY_EXISTS;
|
||||
}
|
||||
|
||||
size = offsetof( struct counterset_template, counter[template->NumCounters] );
|
||||
if (!(new = heap_alloc( size ))) return ERROR_OUTOFMEMORY;
|
||||
|
||||
if (prov->counterset_count)
|
||||
new_array = heap_realloc( prov->countersets, sizeof(*prov->countersets) * (prov->counterset_count + 1) );
|
||||
else
|
||||
new_array = heap_alloc( sizeof(*prov->countersets) );
|
||||
|
||||
if (!new_array)
|
||||
{
|
||||
heap_free( new );
|
||||
return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
memcpy( new, template, size );
|
||||
for (i = 0; i < template->NumCounters; ++i)
|
||||
new->counter[i].Offset = i * sizeof(UINT64);
|
||||
new_array[prov->counterset_count++] = new;
|
||||
prov->countersets = new_array;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PerfSetCounterRefValue (KERNELBASE.@)
|
||||
*/
|
||||
ULONG WINAPI PerfSetCounterRefValue(HANDLE provider, PERF_COUNTERSET_INSTANCE *instance,
|
||||
ULONG counterid, void *address)
|
||||
{
|
||||
struct perf_provider *prov = perf_provider_from_handle( provider );
|
||||
struct counterset_template *template;
|
||||
struct counterset_instance *inst;
|
||||
unsigned int i;
|
||||
|
||||
FIXME( "provider %p, instance %p, counterid %lu, address %p semi-stub.\n",
|
||||
provider, instance, counterid, address );
|
||||
|
||||
if (!prov || !instance || !address) return ERROR_INVALID_PARAMETER;
|
||||
|
||||
inst = CONTAINING_RECORD(instance, struct counterset_instance, instance);
|
||||
template = inst->template;
|
||||
|
||||
for (i = 0; i < template->counterset.NumCounters; ++i)
|
||||
if (template->counter[i].CounterId == counterid) break;
|
||||
|
||||
if (i == template->counterset.NumCounters) return ERROR_NOT_FOUND;
|
||||
*(void **)((BYTE *)&inst->instance + sizeof(PERF_COUNTERSET_INSTANCE) + template->counter[i].Offset) = address;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PerfStartProvider (KERNELBASE.@)
|
||||
*/
|
||||
ULONG WINAPI PerfStartProvider( GUID *guid, PERFLIBREQUEST callback, HANDLE *provider )
|
||||
{
|
||||
PERF_PROVIDER_CONTEXT ctx;
|
||||
|
||||
FIXME( "guid %s, callback %p, provider %p semi-stub.\n", debugstr_guid(guid), callback, provider );
|
||||
|
||||
memset( &ctx, 0, sizeof(ctx) );
|
||||
ctx.ContextSize = sizeof(ctx);
|
||||
ctx.ControlCallback = callback;
|
||||
|
||||
return PerfStartProviderEx( guid, &ctx, provider );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PerfStartProviderEx (KERNELBASE.@)
|
||||
*/
|
||||
ULONG WINAPI PerfStartProviderEx( GUID *guid, PERF_PROVIDER_CONTEXT *context, HANDLE *provider )
|
||||
{
|
||||
struct perf_provider *prov;
|
||||
|
||||
FIXME( "guid %s, context %p, provider %p semi-stub.\n", debugstr_guid(guid), context, provider );
|
||||
|
||||
if (!guid || !context || !provider) return ERROR_INVALID_PARAMETER;
|
||||
if (context->ContextSize < sizeof(*context)) return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (context->MemAllocRoutine || context->MemFreeRoutine)
|
||||
FIXME("Memory allocation routine is not supported.\n");
|
||||
|
||||
if (!(prov = heap_alloc_zero( sizeof(*prov) ))) return ERROR_OUTOFMEMORY;
|
||||
list_init( &prov->instance_list );
|
||||
memcpy( &prov->guid, guid, sizeof(prov->guid) );
|
||||
prov->callback = context->ControlCallback;
|
||||
*provider = prov;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PerfStopProvider (KERNELBASE.@)
|
||||
*/
|
||||
ULONG WINAPI PerfStopProvider(HANDLE handle)
|
||||
{
|
||||
struct perf_provider *prov = perf_provider_from_handle( handle );
|
||||
struct counterset_instance *inst, *next;
|
||||
unsigned int i;
|
||||
|
||||
TRACE( "handle %p.\n", handle );
|
||||
|
||||
if (!list_empty( &prov->instance_list ))
|
||||
WARN( "Stopping provider with active counter instances.\n" );
|
||||
|
||||
LIST_FOR_EACH_ENTRY_SAFE(inst, next, &prov->instance_list, struct counterset_instance, entry)
|
||||
{
|
||||
list_remove( &inst->entry );
|
||||
heap_free( inst );
|
||||
}
|
||||
|
||||
for (i = 0; i < prov->counterset_count; ++i)
|
||||
heap_free( prov->countersets[i] );
|
||||
heap_free( prov->countersets );
|
||||
heap_free( prov );
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* QuirkIsEnabled (KERNELBASE.@)
|
||||
*/
|
||||
BOOL WINAPI QuirkIsEnabled(void *arg)
|
||||
{
|
||||
FIXME("(%p): stub\n", arg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* QuirkIsEnabled3 (KERNELBASE.@)
|
||||
*/
|
||||
BOOL WINAPI QuirkIsEnabled3(void *unk1, void *unk2)
|
||||
{
|
||||
static int once;
|
||||
|
||||
if (!once++)
|
||||
FIXME("(%p, %p) stub!\n", unk1, unk2);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HRESULT WINAPI QISearch(void *base, const QITAB *table, REFIID riid, void **obj)
|
||||
{
|
||||
const QITAB *ptr;
|
||||
IUnknown *unk;
|
||||
|
||||
TRACE("%p, %p, %s, %p\n", base, table, debugstr_guid(riid), obj);
|
||||
|
||||
if (!obj)
|
||||
return E_POINTER;
|
||||
|
||||
for (ptr = table; ptr->piid; ++ptr)
|
||||
{
|
||||
TRACE("trying (offset %ld) %s\n", ptr->dwOffset, debugstr_guid(ptr->piid));
|
||||
if (IsEqualIID(riid, ptr->piid))
|
||||
{
|
||||
unk = (IUnknown *)((BYTE *)base + ptr->dwOffset);
|
||||
TRACE("matched, returning (%p)\n", unk);
|
||||
*obj = unk;
|
||||
IUnknown_AddRef(unk);
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsEqualIID(riid, &IID_IUnknown))
|
||||
{
|
||||
unk = (IUnknown *)((BYTE *)base + table->dwOffset);
|
||||
TRACE("returning first for IUnknown (%p)\n", unk);
|
||||
*obj = unk;
|
||||
IUnknown_AddRef(unk);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("Not found %s.\n", debugstr_guid(riid));
|
||||
*obj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
HRESULT WINAPI GetAcceptLanguagesA(LPSTR langbuf, DWORD *buflen)
|
||||
{
|
||||
DWORD buflenW, convlen;
|
||||
WCHAR *langbufW;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p, %p, *%p: %ld\n", langbuf, buflen, buflen, buflen ? *buflen : -1);
|
||||
|
||||
if (!langbuf || !buflen || !*buflen)
|
||||
return E_FAIL;
|
||||
|
||||
buflenW = *buflen;
|
||||
langbufW = heap_alloc(sizeof(WCHAR) * buflenW);
|
||||
hr = GetAcceptLanguagesW(langbufW, &buflenW);
|
||||
|
||||
if (hr == S_OK)
|
||||
{
|
||||
convlen = WideCharToMultiByte(CP_ACP, 0, langbufW, -1, langbuf, *buflen, NULL, NULL);
|
||||
convlen--; /* do not count the terminating 0 */
|
||||
}
|
||||
else /* copy partial string anyway */
|
||||
{
|
||||
convlen = WideCharToMultiByte(CP_ACP, 0, langbufW, *buflen, langbuf, *buflen, NULL, NULL);
|
||||
if (convlen < *buflen)
|
||||
{
|
||||
langbuf[convlen] = 0;
|
||||
convlen--; /* do not count the terminating 0 */
|
||||
}
|
||||
else
|
||||
{
|
||||
convlen = *buflen;
|
||||
}
|
||||
}
|
||||
*buflen = buflenW ? convlen : 0;
|
||||
|
||||
heap_free(langbufW);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT lcid_to_rfc1766(LCID lcid, WCHAR *rfc1766, INT len)
|
||||
{
|
||||
WCHAR buffer[6 /* MAX_RFC1766_NAME */];
|
||||
INT n = GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME, buffer, ARRAY_SIZE(buffer));
|
||||
INT i;
|
||||
|
||||
if (n)
|
||||
{
|
||||
i = PRIMARYLANGID(lcid);
|
||||
if ((((i == LANG_ENGLISH) || (i == LANG_CHINESE) || (i == LANG_ARABIC)) &&
|
||||
(SUBLANGID(lcid) == SUBLANG_DEFAULT)) ||
|
||||
(SUBLANGID(lcid) > SUBLANG_DEFAULT)) {
|
||||
|
||||
buffer[n - 1] = '-';
|
||||
i = GetLocaleInfoW(lcid, LOCALE_SISO3166CTRYNAME, buffer + n, ARRAY_SIZE(buffer) - n);
|
||||
if (!i)
|
||||
buffer[n - 1] = '\0';
|
||||
}
|
||||
else
|
||||
i = 0;
|
||||
|
||||
LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, buffer, n + i, rfc1766, len);
|
||||
return ((n + i) > len) ? E_INVALIDARG : S_OK;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT WINAPI GetAcceptLanguagesW(WCHAR *langbuf, DWORD *buflen)
|
||||
{
|
||||
DWORD mystrlen, mytype;
|
||||
WCHAR *mystr;
|
||||
LCID mylcid;
|
||||
HKEY mykey;
|
||||
LONG lres;
|
||||
DWORD len;
|
||||
|
||||
TRACE("%p, %p, *%p: %ld\n", langbuf, buflen, buflen, buflen ? *buflen : -1);
|
||||
|
||||
if (!langbuf || !buflen || !*buflen)
|
||||
return E_FAIL;
|
||||
|
||||
mystrlen = (*buflen > 20) ? *buflen : 20 ;
|
||||
len = mystrlen * sizeof(WCHAR);
|
||||
mystr = heap_alloc(len);
|
||||
mystr[0] = 0;
|
||||
RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Internet Explorer\\International",
|
||||
0, KEY_QUERY_VALUE, &mykey);
|
||||
lres = RegQueryValueExW(mykey, L"AcceptLanguage", 0, &mytype, (PBYTE)mystr, &len);
|
||||
RegCloseKey(mykey);
|
||||
len = lstrlenW(mystr);
|
||||
|
||||
if (!lres && (*buflen > len))
|
||||
{
|
||||
lstrcpyW(langbuf, mystr);
|
||||
*buflen = len;
|
||||
heap_free(mystr);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* Did not find a value in the registry or the user buffer is too small */
|
||||
mylcid = GetUserDefaultLCID();
|
||||
lcid_to_rfc1766(mylcid, mystr, mystrlen);
|
||||
len = lstrlenW(mystr);
|
||||
|
||||
memcpy(langbuf, mystr, min(*buflen, len + 1)*sizeof(WCHAR));
|
||||
heap_free(mystr);
|
||||
|
||||
if (*buflen > len)
|
||||
{
|
||||
*buflen = len;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*buflen = 0;
|
||||
return E_NOT_SUFFICIENT_BUFFER;
|
||||
}
|
1832
dll/win32/kernelbase/wine/memory.c
Normal file
1832
dll/win32/kernelbase/wine/memory.c
Normal file
File diff suppressed because it is too large
Load diff
5250
dll/win32/kernelbase/wine/path.c
Normal file
5250
dll/win32/kernelbase/wine/path.c
Normal file
File diff suppressed because it is too large
Load diff
1872
dll/win32/kernelbase/wine/process.c
Normal file
1872
dll/win32/kernelbase/wine/process.c
Normal file
File diff suppressed because it is too large
Load diff
4178
dll/win32/kernelbase/wine/registry.c
Normal file
4178
dll/win32/kernelbase/wine/registry.c
Normal file
File diff suppressed because it is too large
Load diff
1518
dll/win32/kernelbase/wine/security.c
Normal file
1518
dll/win32/kernelbase/wine/security.c
Normal file
File diff suppressed because it is too large
Load diff
1501
dll/win32/kernelbase/wine/string.c
Normal file
1501
dll/win32/kernelbase/wine/string.c
Normal file
File diff suppressed because it is too large
Load diff
1765
dll/win32/kernelbase/wine/sync.c
Normal file
1765
dll/win32/kernelbase/wine/sync.c
Normal file
File diff suppressed because it is too large
Load diff
4
dll/win32/kernelbase/wine/synchacks.h
Normal file
4
dll/win32/kernelbase/wine/synchacks.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
#define CRITICAL_SECTION RTL_CRITICAL_SECTION
|
||||
#define CRITICAL_SECTION_DEBUG RTL_CRITICAL_SECTION_DEBUG
|
1367
dll/win32/kernelbase/wine/thread.c
Normal file
1367
dll/win32/kernelbase/wine/thread.c
Normal file
File diff suppressed because it is too large
Load diff
1754
dll/win32/kernelbase/wine/version.c
Normal file
1754
dll/win32/kernelbase/wine/version.c
Normal file
File diff suppressed because it is too large
Load diff
1194
dll/win32/kernelbase/wine/volume.c
Normal file
1194
dll/win32/kernelbase/wine/volume.c
Normal file
File diff suppressed because it is too large
Load diff
3842
dll/win32/kernelbase/wine/winerror.mc
Normal file
3842
dll/win32/kernelbase/wine/winerror.mc
Normal file
File diff suppressed because it is too large
Load diff
|
@ -843,6 +843,14 @@ BOOL WINAPI PathCanonicalizeA(_Out_writes_(MAX_PATH) LPSTR, _In_ LPCSTR);
|
|||
BOOL WINAPI PathCanonicalizeW(_Out_writes_(MAX_PATH) LPWSTR, _In_ LPCWSTR);
|
||||
#define PathCanonicalize WINELIB_NAME_AW(PathCanonicalize)
|
||||
|
||||
HRESULT WINAPI PathMatchSpecExA(LPCSTR,LPCSTR,DWORD);
|
||||
HRESULT WINAPI PathMatchSpecExW(LPCWSTR,LPCWSTR,DWORD);
|
||||
#define PathMatchSpecEx WINELIB_NAME_AW(PathMatchSpecEx)
|
||||
|
||||
HRESULT WINAPI PathMatchSpecExA(LPCSTR,LPCSTR,DWORD);
|
||||
HRESULT WINAPI PathMatchSpecExW(LPCWSTR,LPCWSTR,DWORD);
|
||||
#define PathMatchSpecEx WINELIB_NAME_AW(PathMatchSpecEx)
|
||||
|
||||
LPSTR
|
||||
WINAPI
|
||||
PathCombineA(
|
||||
|
@ -1261,6 +1269,9 @@ typedef enum {
|
|||
#define URL_FILE_USE_PATHURL 0x00010000
|
||||
#define URL_ESCAPE_AS_UTF8 0x00040000
|
||||
|
||||
#define URL_UNESCAPE_AS_UTF8 URL_ESCAPE_AS_UTF8
|
||||
#define URL_UNESCAPE_URI_COMPONENT URL_UNESCAPE_AS_UTF8
|
||||
|
||||
#define URL_ESCAPE_SEGMENT_ONLY 0x00002000
|
||||
#define URL_ESCAPE_PERCENT 0x00001000
|
||||
|
||||
|
|
|
@ -666,7 +666,7 @@ typedef struct _numberfmtW {
|
|||
LPWSTR lpThousandSep;
|
||||
UINT NegativeOrder;
|
||||
} NUMBERFMTW,*LPNUMBERFMTW;
|
||||
#if (WINVER >= 0x0600)
|
||||
#if 1//(WINVER >= 0x0600)
|
||||
typedef enum _NORM_FORM {
|
||||
NormalizationOther = 0,
|
||||
NormalizationC = 0x1,
|
||||
|
@ -1042,7 +1042,7 @@ LANGID WINAPI GetUserDefaultUILanguage(void);
|
|||
BOOL WINAPI IsValidLanguageGroup(_In_ LGRPID, _In_ DWORD);
|
||||
#endif /* (WINVER >= 0x0500) */
|
||||
|
||||
#if (WINVER >= 0x0600)
|
||||
#if 1//(WINVER >= 0x0600)
|
||||
|
||||
_Success_(return != FALSE)
|
||||
BOOL
|
||||
|
@ -1201,6 +1201,8 @@ LCMapStringEx(
|
|||
|
||||
LCID WINAPI LocaleNameToLCID(_In_ LPCWSTR, _In_ DWORD);
|
||||
|
||||
WINBASEAPI INT WINAPI CompareStringOrdinal(const WCHAR *,INT,const WCHAR *,INT,BOOL);
|
||||
|
||||
#endif /* (WINVER >= 0x0600) */
|
||||
|
||||
WINBASEAPI
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue