Apache HTTPD
rand.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "apr.h"
18#include <rpc.h>
19#include <wincrypt.h>
20#include "apr_private.h"
21#include "apr_general.h"
22#include "apr_portable.h"
23#include "apr_arch_misc.h"
24
25
28{
31
32 /* 0x40 bit = CRYPT_SILENT, only introduced in more recent PSDKs
33 * and will only work for Win2K and later.
34 */
36 | ((apr_os_level >= APR_WIN_2000) ? 0x40 : 0);
37
39 return apr_get_os_error();
40 }
41 /* XXX: An ugly hack for Win64, randomness is such that noone should
42 * ever expect > 2^31 bytes of data at once without the prng
43 * coming to a complete halt.
44 */
47 }
49 return res;
50}
51
52
54{
55 /* Note: this call doesn't actually require CoInitialize() first
56 *
57 * XXX: we should scramble the bytes or some such to eliminate the
58 * possible misuse/abuse since uuid is based on the NIC address, and
59 * is therefore not only a uniqifier, but an identity (which might not
60 * be appropriate in all cases.
61 *
62 * Note that Win2000, XP and later no longer suffer from this problem,
63 * a scrambling fix is only needed for (apr_os_level < APR_WIN_2000)
64 */
66 return APR_EGENERAL;
67 }
68 return APR_SUCCESS;
69}
APR Miscellaneous library routines.
APR Portability Routines.
const unsigned char * buf
Definition util_md5.h:50
#define APR_EGENERAL
Definition apr_errno.h:313
int apr_off_t * length
apr_pool_t apr_dbd_t apr_dbd_results_t ** res
Definition apr_dbd.h:287
const char apr_ssize_t int flags
Definition apr_encode.h:168
const void apr_status_t(*) apr_status_t(* APR_DECLARE)(void) apr_pool_pre_cleanup_register(apr_pool_t *p
Definition apr_pools.h:646
apr_size_t size
#define APR_SUCCESS
Definition apr_errno.h:225
#define apr_get_os_error()
Definition apr_errno.h:1217
int apr_status_t
Definition apr_errno.h:44
return NULL
Definition mod_so.c:359
APR_DECLARE_DATA apr_oslevel_e apr_os_level
Definition misc.c:24
@ APR_WIN_2000
typedef DWORD(WINAPI *apr_winapi_fpt_GetCompressedFileSizeA)(IN LPCSTR lpFileName