Skip to content

Commit aa36b83

Browse files
[RSAENH] import from wine-10.0
1 parent bbdbe76 commit aa36b83

13 files changed

Lines changed: 1954 additions & 1187 deletions

File tree

configure.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ if "%BUILD_ENVIRONMENT%" == "MinGW" (
203203
) else if %USE_CLANG_CL% == 1 (
204204
cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% -DUSE_CLANG_CL:BOOL=1 %CMAKE_PARAMS% "%REACTOS_SOURCE_DIR%"
205205
) else (
206-
cmake -G %CMAKE_GENERATOR% %CMAKE_ARCH% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% %CMAKE_PARAMS% "%REACTOS_SOURCE_DIR%"
206+
cmake -G %CMAKE_GENERATOR% %CMAKE_ARCH% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% %CMAKE_PARAMS% "%REACTOS_SOURCE_DIR%
207207
)
208208

209209
if %ERRORLEVEL% NEQ 0 (

dll/win32/rsaenh/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ add_library(rsaenh MODULE
2121
${CMAKE_CURRENT_BINARY_DIR}/rsaenh.def)
2222

2323
set_module_type(rsaenh win32dll)
24-
target_link_libraries(rsaenh wine)
24+
target_link_libraries(rsaenh wine wine_dll_register wine_dll_canunload)
2525
add_importlibs(rsaenh msvcrt crypt32 advapi32 kernel32 ntdll)
2626
add_pch(rsaenh tomcrypt.h SOURCE)
2727
add_cd_file(TARGET rsaenh DESTINATION reactos/system32 FOR all)
28-
set_wine_module(rsaenh)
28+
set_wine_module_FIXME(rsaenh)

dll/win32/rsaenh/handle.c

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,15 @@
2121
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
2222
*/
2323

24-
#define WIN32_NO_STATUS
25-
#define WIN32_LEAN_AND_MEAN
26-
27-
//#include <string.h>
24+
#include <string.h>
2825
#include <stdarg.h>
26+
#include <stdlib.h>
2927

30-
#include <windef.h>
31-
#include <winbase.h>
28+
#include "windef.h"
29+
#include "winbase.h"
3230
#include "handle.h"
3331

34-
#include <wine/debug.h>
32+
#include "wine/debug.h"
3533

3634
WINE_DEFAULT_DEBUG_CHANNEL(handle);
3735

@@ -57,7 +55,7 @@ void init_handle_table(struct handle_table *lpTable)
5755
lpTable->paEntries = NULL;
5856
lpTable->iEntries = 0;
5957
lpTable->iFirstFree = 0;
60-
InitializeCriticalSection(&lpTable->mutex);
58+
InitializeCriticalSectionEx(&lpTable->mutex, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO);
6159
lpTable->mutex.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": HANDLETABLE.mutex");
6260
}
6361

@@ -73,7 +71,7 @@ void destroy_handle_table(struct handle_table *lpTable)
7371
{
7472
TRACE("(lpTable=%p)\n", lpTable);
7573

76-
HeapFree(GetProcessHeap(), 0, lpTable->paEntries);
74+
free(lpTable->paEntries);
7775
lpTable->mutex.DebugInfo->Spare[0] = 0;
7876
DeleteCriticalSection(&lpTable->mutex);
7977
}
@@ -98,7 +96,7 @@ BOOL is_valid_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwTyp
9896
unsigned int index = HANDLE2INDEX(handle);
9997
BOOL ret = FALSE;
10098

101-
TRACE("(lpTable=%p, handle=%ld)\n", lpTable, handle);
99+
TRACE("(lpTable=%p, handle=%Id)\n", lpTable, handle);
102100

103101
EnterCriticalSection(&lpTable->mutex);
104102

@@ -142,14 +140,14 @@ static BOOL grow_handle_table(struct handle_table *lpTable)
142140

143141
newIEntries = lpTable->iEntries + TABLE_SIZE_INCREMENT;
144142

145-
newEntries = HeapAlloc(GetProcessHeap(), 0, sizeof(struct handle_table_entry)*newIEntries);
143+
newEntries = malloc(sizeof(struct handle_table_entry)*newIEntries);
146144
if (!newEntries)
147145
return FALSE;
148146

149147
if (lpTable->paEntries)
150148
{
151149
memcpy(newEntries, lpTable->paEntries, sizeof(struct handle_table_entry)*lpTable->iEntries);
152-
HeapFree(GetProcessHeap(), 0, lpTable->paEntries);
150+
free(lpTable->paEntries);
153151
}
154152

155153
for (i=lpTable->iEntries; i<newIEntries; i++)
@@ -233,7 +231,7 @@ BOOL release_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType
233231
OBJECTHDR *pObject;
234232
BOOL ret = FALSE;
235233

236-
TRACE("(lpTable=%p, handle=%ld)\n", lpTable, handle);
234+
TRACE("(lpTable=%p, handle=%Id)\n", lpTable, handle);
237235

238236
EnterCriticalSection(&lpTable->mutex);
239237

@@ -243,7 +241,7 @@ BOOL release_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType
243241
pObject = lpTable->paEntries[index].pObject;
244242
if (InterlockedDecrement(&pObject->refcount) == 0)
245243
{
246-
TRACE("destroying handle %ld\n", handle);
244+
TRACE("destroying handle %Id\n", handle);
247245
if (pObject->destructor)
248246
pObject->destructor(pObject);
249247
}
@@ -276,7 +274,7 @@ BOOL lookup_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType,
276274
{
277275
BOOL ret = FALSE;
278276

279-
TRACE("(lpTable=%p, handle=%ld, lplpObject=%p)\n", lpTable, handle, lplpObject);
277+
TRACE("(lpTable=%p, handle=%Id, lplpObject=%p)\n", lpTable, handle, lplpObject);
280278

281279
EnterCriticalSection(&lpTable->mutex);
282280
if (!is_valid_handle(lpTable, handle, dwType))
@@ -312,7 +310,7 @@ BOOL copy_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, H
312310
OBJECTHDR *pObject;
313311
BOOL ret;
314312

315-
TRACE("(lpTable=%p, handle=%ld, copy=%p)\n", lpTable, handle, copy);
313+
TRACE("(lpTable=%p, handle=%Id, copy=%p)\n", lpTable, handle, copy);
316314

317315
EnterCriticalSection(&lpTable->mutex);
318316
if (!lookup_handle(lpTable, handle, dwType, &pObject))
@@ -359,7 +357,7 @@ HCRYPTKEY new_object(struct handle_table *lpTable, size_t cbSize, DWORD dwType,
359357
if (ppObject)
360358
*ppObject = NULL;
361359

362-
pObject = HeapAlloc(GetProcessHeap(), 0, cbSize);
360+
pObject = malloc(cbSize);
363361
if (!pObject)
364362
return (HCRYPTKEY)INVALID_HANDLE_VALUE;
365363

@@ -368,7 +366,7 @@ HCRYPTKEY new_object(struct handle_table *lpTable, size_t cbSize, DWORD dwType,
368366
pObject->destructor = destructor;
369367

370368
if (!alloc_handle(lpTable, pObject, &hObject))
371-
HeapFree(GetProcessHeap(), 0, pObject);
369+
free(pObject);
372370
else
373371
if (ppObject)
374372
*ppObject = pObject;

dll/win32/rsaenh/handle.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#ifndef __WINE_HANDLE_H
2525
#define __WINE_HANDLE_H
2626

27-
#include <wincrypt.h>
27+
#include "wincrypt.h"
2828

2929
#ifdef __cplusplus
3030
extern "C" {
@@ -56,15 +56,15 @@ struct handle_table
5656
CRITICAL_SECTION mutex;
5757
};
5858

59-
void init_handle_table (struct handle_table *lpTable) DECLSPEC_HIDDEN;
60-
void destroy_handle_table(struct handle_table *lpTable) DECLSPEC_HIDDEN;
61-
BOOL release_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) DECLSPEC_HIDDEN;
62-
BOOL copy_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy) DECLSPEC_HIDDEN;
63-
BOOL lookup_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject) DECLSPEC_HIDDEN;
64-
BOOL is_valid_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) DECLSPEC_HIDDEN;
59+
void init_handle_table (struct handle_table *lpTable);
60+
void destroy_handle_table(struct handle_table *lpTable);
61+
BOOL release_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType);
62+
BOOL copy_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy);
63+
BOOL lookup_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject);
64+
BOOL is_valid_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType);
6565

6666
HCRYPTKEY new_object (struct handle_table *lpTable, size_t cbSize, DWORD dwType, DESTRUCTOR destructor,
67-
OBJECTHDR **ppObject) DECLSPEC_HIDDEN;
67+
OBJECTHDR **ppObject);
6868

6969
#ifdef __cplusplus
7070
}

0 commit comments

Comments
 (0)