user32: Make GetRegisteredRawInputDevices hotpatchable.
[wine/multimedia.git] / dlls / bcrypt / bcrypt_main.c
blob5ccb9f171441efafac228e09d260518d03bded4a
1 /*
2 * Copyright 2009 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "config.h"
22 #include <stdarg.h>
24 #include "ntstatus.h"
25 #define WIN32_NO_STATUS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "ntsecapi.h"
29 #include "bcrypt.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(bcrypt);
34 NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG dwAlgOperations, ULONG *pAlgCount,
35 BCRYPT_ALGORITHM_IDENTIFIER **ppAlgList, ULONG dwFlags)
37 FIXME("%08x, %p, %p, %08x - stub\n", dwAlgOperations, pAlgCount, ppAlgList, dwFlags);
39 *ppAlgList=NULL;
40 *pAlgCount=0;
42 return STATUS_NOT_IMPLEMENTED;
45 NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE algorithm, UCHAR *buffer, ULONG count, ULONG flags)
47 const DWORD supported_flags = BCRYPT_USE_SYSTEM_PREFERRED_RNG;
48 TRACE("%p, %p, %u, %08x - semi-stub\n", algorithm, buffer, count, flags);
50 if (!algorithm)
52 /* It's valid to call without an algorithm if BCRYPT_USE_SYSTEM_PREFERRED_RNG
53 * is set. In this case the preferred system RNG is used.
55 if (!(flags & BCRYPT_USE_SYSTEM_PREFERRED_RNG))
56 return STATUS_INVALID_HANDLE;
58 if (!buffer)
59 return STATUS_INVALID_PARAMETER;
61 if (flags & ~supported_flags)
62 FIXME("unsupported flags %08x\n", flags & ~supported_flags);
64 if (algorithm)
65 FIXME("ignoring selected algorithm\n");
67 /* When zero bytes are requested the function returns success too. */
68 if (!count)
69 return STATUS_SUCCESS;
71 if (flags & BCRYPT_USE_SYSTEM_PREFERRED_RNG)
73 if (RtlGenRandom(buffer, count))
74 return STATUS_SUCCESS;
77 FIXME("called with unsupported parameters, returning error\n");
78 return STATUS_NOT_IMPLEMENTED;
81 NTSTATUS WINAPI BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE *algorithm, LPCWSTR algorithmId,
82 LPCWSTR implementation, DWORD flags)
84 FIXME("%p, %s, %s, %08x - stub\n", algorithm, wine_dbgstr_w(algorithmId), wine_dbgstr_w(implementation), flags);
86 if (!algorithm)
87 return STATUS_INVALID_PARAMETER;
89 *algorithm = NULL;
91 return STATUS_NOT_IMPLEMENTED;
94 NTSTATUS WINAPI BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE algorithm, DWORD flags)
96 FIXME("%p, %08x - stub\n", algorithm, flags);
98 return STATUS_NOT_IMPLEMENTED;