Skip to content

Commit

Permalink
WIP - Build KernelBase
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkFire01 committed Nov 1, 2024
1 parent a02bf20 commit a7dd615
Show file tree
Hide file tree
Showing 11 changed files with 537 additions and 18 deletions.
12 changes: 6 additions & 6 deletions dll/win32/KernelBase/wine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ list(APPEND SOURCE_STATIC
#file.c
loader.c
locale.c
#main.c
#memory.c
main.c
memory.c
path.c
#process.c
process.c
#registry.c
#security.c
#string.c
#sync.c
security.c
string.c
sync.c
version.c
volume.c)

Expand Down
58 changes: 47 additions & 11 deletions dll/win32/KernelBase/wine/hacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ NTSYSAPI NTSTATUS WINAPI RtlQueryActivationContextApplicationSettings(DWORD,HAN
NTSYSAPI NTSTATUS WINAPI LdrSetDefaultDllDirectories(ULONG);
NTSYSAPI NTSTATUS WINAPI LdrRemoveDllDirectory(void*);

//rtl types
//
// Constant String Macro
//
#define RTL_CONSTANT_STRING(__SOURCE_STRING__) \
{ \
sizeof(__SOURCE_STRING__) - sizeof((__SOURCE_STRING__)[0]), \
sizeof(__SOURCE_STRING__), \
(__SOURCE_STRING__) \
}

//kernel32

Expand All @@ -51,4 +41,50 @@ HRESULT WINAPI PathMatchSpecExW(const WCHAR *path, const WCHAR *mask, DWORD flag
INT WINAPI DECLSPEC_HOTPATCH CompareStringOrdinal( const WCHAR *str1, INT len1,
const WCHAR *str2, INT len2, BOOL ignore_case );

#define URL_UNESCAPE_AS_UTF8 URL_ESCAPE_AS_UTF8
#define URL_UNESCAPE_AS_UTF8 URL_ESCAPE_AS_UTF8

//shlwapi
HRESULT WINAPI GetAcceptLanguagesW(WCHAR *langbuf, DWORD *buflen);

BOOL WINAPI GetWindowsAccountDomainSid( PSID sid, PSID domain_sid, DWORD *size );
//rtl types
//
// Constant String Macro
//
#define RTL_CONSTANT_STRING(__SOURCE_STRING__) \
{ \
sizeof(__SOURCE_STRING__) - sizeof((__SOURCE_STRING__)[0]), \
sizeof(__SOURCE_STRING__), \
(__SOURCE_STRING__) \
}
//rtl
NTSTATUS
NTAPI
RtlNewSecurityObjectEx(IN PSECURITY_DESCRIPTOR ParentDescriptor,
IN PSECURITY_DESCRIPTOR CreatorDescriptor,
OUT PSECURITY_DESCRIPTOR *NewDescriptor,
IN LPGUID ObjectType,
IN BOOLEAN IsDirectoryObject,
IN ULONG AutoInheritFlags,
IN HANDLE Token,
IN PGENERIC_MAPPING GenericMapping);

NTSTATUS
NTAPI
RtlNewSecurityObjectWithMultipleInheritance(IN PSECURITY_DESCRIPTOR ParentDescriptor,
IN PSECURITY_DESCRIPTOR CreatorDescriptor,
OUT PSECURITY_DESCRIPTOR *NewDescriptor,
IN LPGUID *ObjectTypes,
IN ULONG GuidCount,
IN BOOLEAN IsDirectoryObject,
IN ULONG AutoInheritFlags,
IN HANDLE Token,
IN PGENERIC_MAPPING GenericMapping);
NTSTATUS
NTAPI
RtlConvertToAutoInheritSecurityObject(IN PSECURITY_DESCRIPTOR ParentDescriptor,
IN PSECURITY_DESCRIPTOR CreatorDescriptor,
OUT PSECURITY_DESCRIPTOR *NewDescriptor,
IN LPGUID ObjectType,
IN BOOLEAN IsDirectoryObject,
IN PGENERIC_MAPPING GenericMapping);
2 changes: 2 additions & 0 deletions dll/win32/KernelBase/wine/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
init_global_data();
init_locale( hinst );
init_startup_info( NtCurrentTeb()->Peb->ProcessParameters );
#ifndef __REACTOS__
init_console();
#endif
}
return TRUE;
}
Expand Down
3 changes: 3 additions & 0 deletions dll/win32/KernelBase/wine/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
#include "winnls.h"
#include "winternl.h"
#include "winerror.h"
#ifdef __REACTOS__
#else
#include "ddk/wdm.h"
#endif

#include "kernelbase.h"
#include "wine/exception.h"
Expand Down
7 changes: 7 additions & 0 deletions dll/win32/KernelBase/wine/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#ifdef __REACTOS__
#include <wincon.h>
#else
#include "wincontypes.h"
#endif
#include "winternl.h"

#include "kernelbase.h"
Expand Down Expand Up @@ -251,6 +255,8 @@ struct _PROC_THREAD_ATTRIBUTE_LIST
struct proc_thread_attr attrs[1];
};

#ifndef __REACTOS__

/***********************************************************************
* create_nt_process
*/
Expand Down Expand Up @@ -704,6 +710,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW( const WCHAR *app_name, WCHAR *cmd_
inherit, flags, env, cur_dir, startup_info, info, NULL );
}

#endif

/**********************************************************************
* SetProcessInformation (kernelbase.@)
Expand Down
3 changes: 3 additions & 0 deletions dll/win32/KernelBase/wine/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
#include "winerror.h"
#include "winternl.h"
#include "winioctl.h"
#ifdef __REACTOS__
#else
#include "ddk/ntddk.h"
#endif

#include "kernelbase.h"
#include "wine/debug.h"
Expand Down
4 changes: 3 additions & 1 deletion dll/win32/KernelBase/wine/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
#include "winnls.h"
#include "winternl.h"
#include "winioctl.h"
#ifdef __REACTOS__
#else
#include "ddk/wdm.h"

#endif
#include "kernelbase.h"
#include "wine/asm.h"
#include "wine/exception.h"
Expand Down
123 changes: 123 additions & 0 deletions sdk/include/psdk/perflib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
* Copyright (C) 2017 Austin English
*
* 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 _PERFLIB_H_
#define _PERFLIB_H_

#ifdef __cplusplus
extern "C" {
#endif

typedef void * (__WINE_ALLOC_SIZE(1) CDECL * PERF_MEM_ALLOC)(SIZE_T,void*);
typedef void (CDECL * PERF_MEM_FREE)(LPVOID,LPVOID);
typedef ULONG (WINAPI * PERFLIBREQUEST)(ULONG,PVOID,ULONG);

typedef struct _PERF_COUNTERSET_INFO {
GUID CounterSetGuid;
GUID ProviderGuid;
ULONG NumCounters;
ULONG InstanceType;
} PERF_COUNTERSET_INFO, * PPERF_COUNTERSET_INFO;

/* PERF_COUNTERSET_INFO InstanceType values. */
#define PERF_COUNTERSET_FLAG_MULTIPLE 0x00000002
#define PERF_COUNTERSET_FLAG_AGGREGATE 0x00000004
#define PERF_COUNTERSET_FLAG_HISTORY 0x00000008
#define PERF_COUNTERSET_FLAG_INSTANCE 0x00000010

#define PERF_COUNTERSET_SINGLE_INSTANCE 0
#define PERF_COUNTERSET_MULTI_INSTANCES PERF_COUNTERSET_FLAG_MULTIPLE
#define PERF_COUNTERSET_SINGLE_AGGREGATE PERF_COUNTERSET_FLAG_AGGREGATE
#define PERF_COUNTERSET_MULTI_AGGREGATE (PERF_COUNTERSET_FLAG_AGGREGATE | PERF_COUNTERSET_FLAG_MULTIPLE)
#define PERF_COUNTERSET_SINGLE_AGGREGATE_HISTORY (PERF_COUNTERSET_FLAG_HISTORY | PERF_COUNTERSET_SINGLE_AGGREGATE)
#define PERF_COUNTERSET_INSTANCE_AGGREGATE (PERF_COUNTERSET_MULTI_AGGREGATE | PERF_COUNTERSET_FLAG_INSTANCE)

typedef struct _PERF_COUNTERSET_INSTANCE {
GUID CounterSetGuid;
ULONG dwSize;
ULONG InstanceId;
ULONG InstanceNameOffset;
ULONG InstanceNameSize;
} PERF_COUNTERSET_INSTANCE, * PPERF_COUNTERSET_INSTANCE;

typedef struct _PERF_COUNTER_INFO {
ULONG CounterId;
ULONG Type;
ULONGLONG Attrib;
ULONG Size;
ULONG DetailLevel;
LONG Scale;
ULONG Offset;
} PERF_COUNTER_INFO, *PPERF_COUNTER_INFO;

/* PERF_COUNTER_INFO Attrib flags. */
#define PERF_ATTRIB_BY_REFERENCE 0x00000001
#define PERF_ATTRIB_NO_DISPLAYABLE 0x00000002
#define PERF_ATTRIB_NO_GROUP_SEPARATOR 0x00000004
#define PERF_ATTRIB_DISPLAY_AS_REAL 0x00000008
#define PERF_ATTRIB_DISPLAY_AS_HEX 0x00000010

typedef struct _PROVIDER_CONTEXT {
DWORD ContextSize;
DWORD Reserved;
PERFLIBREQUEST ControlCallback;
PERF_MEM_ALLOC MemAllocRoutine;
PERF_MEM_FREE MemFreeRoutine;
LPVOID pMemContext;
} PERF_PROVIDER_CONTEXT, * PPERF_PROVIDER_CONTEXT;

typedef struct _PERF_COUNTER_IDENTIFIER {
GUID CounterSetGuid;
ULONG Status;
ULONG Size;
ULONG CounterId;
ULONG InstanceId;
ULONG Index;
ULONG Reserved;
} PERF_COUNTER_IDENTIFIER, *PPERF_COUNTER_IDENTIFIER;

#define PERF_WILDCARD_COUNTER 0xFFFFFFFF
#define PERF_WILDCARD_INSTANCE L"*"

typedef struct _PERF_DATA_HEADER {
ULONG dwTotalSize;
ULONG dwNumCounters;
LONGLONG PerfTimeStamp;
LONGLONG PerfTime100NSec;
LONGLONG PerfFreq;
SYSTEMTIME SystemTime;
} PERF_DATA_HEADER, *PPERF_DATA_HEADER;

PERF_COUNTERSET_INSTANCE WINAPI *PerfCreateInstance(HANDLE, const GUID *, const WCHAR *, ULONG);
ULONG WINAPI PerfDeleteInstance(HANDLE, PERF_COUNTERSET_INSTANCE *);
ULONG WINAPI PerfSetCounterRefValue(HANDLE, PERF_COUNTERSET_INSTANCE *, ULONG, void *);
ULONG WINAPI PerfSetCounterSetInfo(HANDLE, PERF_COUNTERSET_INFO *, ULONG);
ULONG WINAPI PerfStartProvider(GUID *, PERFLIBREQUEST, HANDLE *);
ULONG WINAPI PerfStartProviderEx(GUID *, PERF_PROVIDER_CONTEXT *, HANDLE *);
ULONG WINAPI PerfStopProvider(HANDLE);

ULONG WINAPI PerfAddCounters(HANDLE, PERF_COUNTER_IDENTIFIER *, DWORD);
ULONG WINAPI PerfCloseQueryHandle(HANDLE);
ULONG WINAPI PerfOpenQueryHandle(const WCHAR *, HANDLE *);
ULONG WINAPI PerfQueryCounterData(HANDLE, PERF_DATA_HEADER *, DWORD, DWORD *);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* _PERFLIB_H_ */
Loading

0 comments on commit a7dd615

Please sign in to comment.