63759ec22173e7dce138c5a27d59a534ed4ea78b
[reactos.git] / reactos / lib / kernel32 / misc / error.c
1 /* $Id$
2 *
3 * reactos/lib/kernel32/misc/error.c
4 *
5 */
6
7 #include <k32.h>
8
9 #define NDEBUG
10 #include "../include/debug.h"
11
12
13 /*
14 * @implemented
15 */
16 VOID
17 STDCALL
18 SetLastError (
19 DWORD dwErrorCode
20 )
21 {
22 NtCurrentTeb ()->LastErrorValue = (ULONG) dwErrorCode;
23 }
24
25
26 /*
27 * @implemented
28 */
29 DWORD
30 STDCALL
31 GetLastError (VOID)
32 {
33 return (DWORD) (NtCurrentTeb ()->LastErrorValue);
34 }
35
36
37 /*
38 * @implemented
39 */
40 BOOL
41 STDCALL
42 Beep (DWORD dwFreq, DWORD dwDuration)
43 {
44 HANDLE hBeep;
45 BEEP_SET_PARAMETERS BeepSetParameters;
46 DWORD dwReturned;
47
48 hBeep = CreateFileW(L"\\\\.\\Beep",
49 FILE_GENERIC_READ | FILE_GENERIC_WRITE,
50 0,
51 NULL,
52 OPEN_EXISTING,
53 0,
54 NULL);
55 if (hBeep == INVALID_HANDLE_VALUE)
56 return FALSE;
57
58 /* Set beep data */
59 BeepSetParameters.Frequency = dwFreq;
60 BeepSetParameters.Duration = dwDuration;
61
62 DeviceIoControl(hBeep,
63 IOCTL_BEEP_SET,
64 &BeepSetParameters,
65 sizeof(BEEP_SET_PARAMETERS),
66 NULL,
67 0,
68 &dwReturned,
69 NULL);
70
71 CloseHandle (hBeep);
72
73 return TRUE;
74 }
75
76 /* EOF */