minor corrections by M.Taguchi
[reactos.git] / os2 / lib / doscalls / misc / error.cpp
1 /* $Id: error.cpp,v 1.3 2003/01/07 16:23:11 robd Exp $
2 */
3 /*
4 *
5 * COPYRIGHT: See COPYING in the top level directory
6 * PROJECT: ReactOS OS/2 sub system
7 * PART: doscalls.dll
8 * FILE: error.cpp
9 * CONTAINS: Error related CP-functions.
10 * PURPOSE: Kernelservices for OS/2 apps
11 * PROGRAMMER: Robert K. nonvolatil@yahoo.de
12 * REVISION HISTORY:
13 * 13-03-2002 Created
14 * 25-07-2002 Work to make it compile
15 */
16
17
18 #define INCL_DOSPROCESS
19 #define INCL_DOSERRORS
20 #include "ros2.h"
21 // we need the extra definitions of this file
22 namespace NT {
23 #include <ddk/ntddbeep.h>
24 }
25
26
27 /*******************************************
28 DosBeep generates sound from the
29 speaker.
30
31 freq (ULONG) - input
32 Cycles per second (Hertz) in the range of 0x25 to
33 0x7FFF.
34
35 dur (ULONG) - input
36 The length of the sound in milliseconds.
37
38 ulrc (APIRET) - returns
39 Return Code.
40
41 DosBeep returns one of the following values:
42
43 0 NO_ERROR
44 395 ERROR_INVALID_FREQUENCY
45 *******************************************/
46 APIRET STDCALL DosBeep(ULONG freq, ULONG dur)
47 {
48 NT::BEEP_SET_PARAMETERS BeepSetParameters;
49 NT::HANDLE hBeep;
50 NT::IO_STATUS_BLOCK ComplStatus;
51 NT::UNICODE_STRING unistr;
52 NT::NTSTATUS stat;
53 NT::OBJECT_ATTRIBUTES oa = {sizeof oa, 0, &unistr, NT::OBJ_CASE_INSENSITIVE, 0, 0};
54
55 // init String still bevore use.
56 NT::RtlInitUnicodeString( &unistr, (NT::PWSTR)L"\\\\.\\Beep" );
57
58 if( freq<0x25 || freq>0x7FFF )
59 return ERROR_INVALID_FREQUENCY; //395; //
60
61 /* Set beep data */
62 BeepSetParameters.Frequency = freq;
63 BeepSetParameters.Duration = dur;
64
65 /* open the beep dirver */
66 stat = NT::ZwOpenFile( &hBeep,
67 FILE_READ_DATA | FILE_WRITE_DATA,
68 &oa,
69 &ComplStatus,
70 0, // no sharing
71 FILE_OPEN );
72
73 if ( stat<0 )
74 {
75 return ERROR_NOT_READY;
76 }
77
78 /* actually beep */
79 NT::ZwDeviceIoControlFile(hBeep, 0, // Event
80 0, // APC-routine
81 0, // UserAPCContext
82 &ComplStatus, IOCTL_BEEP_SET,
83 &BeepSetParameters,
84 sizeof(NT::BEEP_SET_PARAMETERS),
85 NULL,
86 0 );
87 NT::ZwClose(hBeep);
88
89 return NO_ERROR;
90 }
91
92
93 /******************************************
94 DosError disables or enables error
95 notification to end users.
96
97 error (ULONG) - input
98 Error and Exception pop-up flags.
99
100 The unused high-order bits are reserved, and must be zero. The following values can be specified
101 for this parameter. They can be combined using the "logical or" ( | ) operator.
102
103 FERR_DISABLEHARDERR (0x00000000)
104 Disable hard error pop-ups.
105
106 FERR_ENABLEHARDERR (0x00000001)
107 Enable hard error pop-ups.
108
109 FERR_ENABLEEXCEPTION (0x00000000)
110 Enable program exception and untrapped numeric-processor exception pop-ups.
111
112 FERR_DISABLEEXCEPTION (0x00000002)
113 Disable program exception and untrapped numeric-processor exception pop-ups.
114
115 ulrc (APIRET) - returns
116 Return Code.
117
118 DosError returns one of the following values:
119
120 0 NO_ERROR
121 87 ERROR_INVALID_PARAMETER
122 *******************************************/
123 APIRET DosError( ULONG error)
124 {
125 return ERROR_CALL_NOT_IMPLEMENTED;
126 }
127
128
129 /*******************************************
130 DosMove moves a file object to another
131 location, and changes its name.
132
133 pszOld (PSZ) - input
134 Address of the old path name of the file or
135 subdirectory to be moved.
136
137 pszNew (PSZ) - input
138 Address of the new path name of the file or
139 subdirectory.
140
141 ulrc (APIRET) - returns
142 Return Code.
143
144 DosMove returns the one of following values:
145
146 0 NO_ERROR
147 2 ERROR_FILE_NOT_FOUND
148 3 ERROR_PATH_NOT_FOUND
149 5 ERROR_ACCESS_DENIED
150 17 ERROR_NOT_SAME_DEVICE
151 26 ERROR_NOT_DOS_DISK
152 32 ERROR_SHARING_VIOLATION
153 36 ERROR_SHARING_BUFFER_EXCEEDED
154 87 ERROR_INVALID_PARAMETER
155 108 ERROR_DRIVE_LOCKED
156 206 ERROR_FILENAME_EXCED_RANGE
157 250 ERROR_CIRCULARITY_REQUESTED
158 251 ERROR_DIRECTORY_IN_CDS
159 *******************************************/
160 APIRET DosMove(PSZ pszOld, PSZ pszNew)
161 {
162 return ERROR_CALL_NOT_IMPLEMENTED;
163 }
164
165 /* EOF */