fixed calls to NtDuplicateObject
[reactos.git] / reactos / lib / kernel32 / misc / actctx.c
1 #include <k32.h>
2
3 #define NDEBUG
4 #include "../include/debug.h"
5
6 /*
7 * @implemented
8 */
9 BOOL
10 STDCALL
11 FindActCtxSectionStringA(
12 DWORD dwFlags,
13 const GUID *lpExtensionGuid,
14 ULONG ulSectionId,
15 LPCSTR lpStringToFind,
16 PACTCTX_SECTION_KEYED_DATA ReturnedData
17 )
18 {
19 BOOL bRetVal;
20 LPWSTR lpStringToFindW;
21
22 /* Convert lpStringToFind */
23 if (lpStringToFind)
24 {
25 BasepAnsiStringToHeapUnicodeString(lpStringToFind,
26 (LPWSTR*) &lpStringToFindW);
27 }
28
29 /* Call the Unicode function */
30 bRetVal = FindActCtxSectionStringA(dwFlags,
31 lpExtensionGuid,
32 ulSectionId,
33 lpStringToFind,
34 ReturnedData);
35
36 /* Clean up */
37 RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) lpStringToFindW);
38
39 return bRetVal;
40 }
41
42
43 /*
44 * @implemented
45 */
46 HANDLE
47 STDCALL
48 CreateActCtxA(
49 PCACTCTXA pActCtx
50 )
51 {
52 ACTCTXW pActCtxW;
53 HANDLE hRetVal;
54
55 ZeroMemory(&pActCtxW, sizeof(pActCtxW));
56 pActCtxW.cbSize = sizeof(pActCtxW);
57 pActCtxW.dwFlags = pActCtx->dwFlags;
58 pActCtxW.wProcessorArchitecture = pActCtx->wProcessorArchitecture;
59 pActCtxW.dwFlags = pActCtx->wProcessorArchitecture;
60
61 pActCtxW.hModule = pActCtx->hModule;
62
63 /* Convert ActCtx Strings */
64 if (pActCtx->lpAssemblyDirectory)
65 {
66 BasepAnsiStringToHeapUnicodeString(pActCtx->lpSource,
67 (LPWSTR*) &pActCtxW.lpSource);
68 }
69
70 if (pActCtx->lpAssemblyDirectory)
71 {
72 BasepAnsiStringToHeapUnicodeString(pActCtx->lpAssemblyDirectory,
73 (LPWSTR*) &pActCtxW.lpAssemblyDirectory);
74 }
75 if (pActCtx->lpResourceName)
76 {
77 BasepAnsiStringToHeapUnicodeString(pActCtx->lpResourceName,
78 (LPWSTR*) &pActCtxW.lpResourceName);
79 }
80 if (pActCtx->lpApplicationName)
81 {
82 BasepAnsiStringToHeapUnicodeString(pActCtx->lpApplicationName,
83 (LPWSTR*) &pActCtxW.lpApplicationName);
84 }
85
86 /* Call the Unicode function */
87 hRetVal = CreateActCtxW(&pActCtxW);
88
89 /* Clean up */
90 RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) pActCtxW.lpSource);
91 RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) pActCtxW.lpAssemblyDirectory);
92 RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) pActCtxW.lpResourceName);
93 RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) pActCtxW.lpApplicationName);
94
95 return hRetVal;
96 }