Make crypt functions more robust in case of incorrect api usage.
[wine] / dlls / unicows / main.c
1 /*
2  * Implementation of the unicows dll
3  *
4  * Copyright (C) 2003 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include <stdarg.h>
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winreg.h"
26 #include "winnls.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "winver.h"
30 #include "winspool.h"
31 #include "commdlg.h"
32 #include "wincrypt.h"
33 #include "ddeml.h"
34 #include "wincon.h"
35 #include "oledlg.h"
36 #include "ras.h"
37 #include "sspi.h"
38 #include "mmsystem.h"
39 #include "shlobj.h"
40 #include "shellapi.h"
41 #include "vfw.h"
42 #include "winnetwk.h"
43 #include "sensapi.h"
44
45 /* Create a dummy reference to every function we need so that
46  * the linker will import them.
47  */
48 const void *dummy_references[] =
49 {
50     AcquireCredentialsHandleW,
51     AddAtomW,
52     AddFontResourceW,
53     AddJobW,
54     AddMonitorW,
55     AddPortW,
56     AddPrinterDriverW,
57     AddPrinterW,
58     AddPrintProcessorW,
59     AddPrintProvidorW,
60     AdvancedDocumentPropertiesW,
61     AppendMenuW,
62     BeginUpdateResourceA,
63     BeginUpdateResourceW,
64     BroadcastSystemMessageW,
65     BuildCommDCBAndTimeoutsW,
66     BuildCommDCBW,
67     CallMsgFilterW,
68     CallNamedPipeW,
69     CallWindowProcA,
70     CallWindowProcW,
71     ChangeDisplaySettingsExW,
72     ChangeDisplaySettingsW,
73     ChangeMenuW,
74     CharLowerBuffW,
75     CharLowerW,
76     CharNextW,
77     CharPrevW,
78     CharToOemBuffW,
79     CharToOemW,
80     CharUpperBuffW,
81     CharUpperW,
82     ChooseColorW,
83     ChooseFontW,
84     CommConfigDialogW,
85     CompareStringW,
86     ConfigurePortW,
87     CopyAcceleratorTableW,
88     CopyEnhMetaFileW,
89     CopyFileExW ,
90     CopyFileW,
91     CopyMetaFileW,
92     CreateAcceleratorTableW,
93     CreateColorSpaceW,
94     CreateDCW,
95     CreateDialogIndirectParamW,
96     CreateDialogParamW,
97     CreateDirectoryExW,
98     CreateDirectoryW,
99     CreateEnhMetaFileW,
100     CreateEventW,
101     CreateFileMappingW,
102     CreateFileW,
103     CreateFontIndirectW,
104     CreateFontW,
105     CreateICW,
106     CreateMDIWindowW,
107     CreateMailslotW,
108     CreateMetaFileW,
109     CreateMutexW,
110     CreateNamedPipeW,
111     CreateProcessW,
112     CreateScalableFontResourceW,
113     CreateSemaphoreW,
114     CreateWaitableTimerW,
115     CreateWindowExW,
116     CryptAcquireContextW,
117     CryptEnumProviderTypesW,
118     CryptEnumProvidersW,
119     CryptGetDefaultProviderW,
120     CryptSetProviderExW,
121     CryptSetProviderW,
122     CryptSignHashW,
123     CryptVerifySignatureW,
124     DdeConnect,
125     DdeConnectList,
126     DdeCreateStringHandleW,
127     DdeInitializeW,
128     DdeQueryConvInfo,
129     DdeQueryStringW,
130     DefDlgProcW,
131     DefFrameProcW,
132     DefMDIChildProcW,
133     DefWindowProcW,
134     DeleteFileW,
135     DeleteMonitorW,
136     DeletePortW,
137     DeletePrinterDriverW,
138     DeletePrintProcessorW,
139     DeletePrintProvidorW,
140     DeviceCapabilitiesW,
141     DialogBoxIndirectParamW,
142     DialogBoxParamW,
143     DispatchMessageW,
144     DlgDirListComboBoxW,
145     DlgDirListW,
146     DlgDirSelectComboBoxExW,
147     DlgDirSelectExW,
148     DocumentPropertiesW,
149     DragQueryFileW,
150     DrawStateW,
151     DrawTextExW,
152     DrawTextW,
153     EnableWindow,
154     EndUpdateResourceA,
155     EndUpdateResourceW,
156     EnumCalendarInfoExW,
157     EnumCalendarInfoW,
158     EnumClipboardFormats,
159     EnumDateFormatsExW,
160     EnumDateFormatsW,
161     EnumDisplayDevicesW,
162     EnumDisplaySettingsExW,
163     EnumDisplaySettingsW,
164     EnumFontFamiliesExW,
165     EnumFontFamiliesW,
166     EnumFontsW,
167     EnumICMProfilesW,
168     EnumMonitorsW,
169     EnumPortsW,
170     EnumPrintProcessorDatatypesW,
171     EnumPrintProcessorsW,
172     EnumPrinterDriversW,
173     EnumPrintersW,
174     EnumPropsA,
175     EnumPropsExA,
176     EnumPropsExW,
177     EnumPropsW,
178     EnumSystemCodePagesW,
179     EnumSystemLocalesW,
180     EnumTimeFormatsW,
181     EnumerateSecurityPackagesW,
182     ExpandEnvironmentStringsW,
183     ExtTextOutW,
184     ExtractIconExW,
185     ExtractIconW,
186     FatalAppExitW,
187     FillConsoleOutputCharacterW,
188     FindAtomW,
189     FindExecutableW,
190     FindFirstChangeNotificationW,
191     FindFirstFileW,
192     FindNextFileW,
193     FindResourceExW,
194     FindResourceW,
195     FindTextW,
196     FindWindowExW,
197     FindWindowW,
198     FormatMessageW,
199     FreeContextBuffer,
200     FreeEnvironmentStringsW,
201     GetAltTabInfoW,
202     GetAtomNameW,
203     GetCPInfo,
204     GetCPInfoExW,
205     GetCalendarInfoW,
206     GetCharABCWidthsFloatW,
207     GetCharABCWidthsW,
208     GetCharWidth32W,
209     GetCharWidthFloatW,
210     GetCharWidthW,
211     GetCharacterPlacementW,
212     GetClassInfoExW,
213     GetClassInfoW,
214     GetClassLongW,
215     GetClassNameW,
216     GetClipboardData,
217     GetClipboardFormatNameW,
218     GetComputerNameW,
219     GetConsoleTitleW,
220     GetCurrencyFormatW,
221     GetCurrentDirectoryW,
222     GetCurrentHwProfileW,
223     GetDateFormatW,
224     GetDefaultCommConfigW,
225     GetDiskFreeSpaceExW ,
226     GetDiskFreeSpaceW,
227     GetDlgItemTextW,
228     GetDriveTypeW,
229     GetEnhMetaFileDescriptionW,
230     GetEnhMetaFileW,
231     GetEnvironmentStringsW,
232     GetEnvironmentVariableW,
233     GetFileAttributesExW,
234     GetFileAttributesW,
235     GetFileTitleW,
236     GetFileVersionInfoSizeW,
237     GetFileVersionInfoW,
238     GetFullPathNameW,
239     GetGlyphOutlineW,
240     GetICMProfileW,
241     GetJobW,
242     GetKerningPairsW,
243     GetKeyNameTextW,
244     GetKeyboardLayoutNameW,
245     GetLocaleInfoW,
246     GetLogColorSpaceW,
247     GetLogicalDriveStringsW,
248     GetLongPathNameW ,
249     GetMenuItemInfoW,
250     GetMenuStringW,
251     GetMessageW,
252     GetMetaFileW,
253     GetModuleFileNameW,
254     GetModuleHandleW,
255     GetMonitorInfoW,
256     GetNamedPipeHandleStateW,
257     GetNumberFormatW,
258     GetObjectW,
259     GetOpenFileNamePreviewW,
260     GetOpenFileNameW,
261     GetOutlineTextMetricsW,
262     GetPrinterDataW,
263     GetPrinterDriverDirectoryW,
264     GetPrinterDriverW,
265     GetPrinterW,
266     GetPrintProcessorDirectoryW,
267     GetPrivateProfileIntW,
268     GetPrivateProfileSectionNamesW,
269     GetPrivateProfileSectionW,
270     GetPrivateProfileStringW,
271     GetPrivateProfileStructW,
272     GetProcAddress,
273     GetProfileIntW,
274     GetProfileSectionW,
275     GetProfileStringW,
276     GetPropA,
277     GetPropW,
278     GetSaveFileNamePreviewW,
279     GetSaveFileNameW,
280     GetShortPathNameW,
281     GetStartupInfoW,
282     GetStringTypeExW,
283     GetStringTypeW,
284     GetSystemDirectoryW,
285     GetSystemWindowsDirectoryW,
286     GetTabbedTextExtentW,
287     GetTempFileNameW,
288     GetTempPathW,
289     GetTextExtentExPointW,
290     GetTextExtentPoint32W,
291     GetTextExtentPointW,
292     GetTextFaceW,
293     GetTextMetricsW,
294     GetTimeFormatW,
295     GetUserNameW,
296     GetVersionExW,
297     GetVolumeInformationW,
298     GetWindowLongA,
299     GetWindowLongW,
300     GetWindowModuleFileNameW,
301     GetWindowTextLengthW,
302     GetWindowTextW,
303     GetWindowsDirectoryW,
304     GlobalAddAtomW,
305     GlobalFindAtomW,
306     GlobalGetAtomNameW,
307     GrayStringW,
308     InitSecurityInterfaceW,
309     InitializeSecurityContextW,
310     InsertMenuItemW,
311     InsertMenuW,
312     IsBadStringPtrW,
313     IsCharAlphaNumericW,
314     IsCharAlphaW,
315     IsCharLowerW,
316     IsCharUpperW,
317     IsClipboardFormatAvailable,
318     IsDestinationReachableW,
319     IsDialogMessageW,
320     IsTextUnicode,
321     IsValidCodePage,
322     IsWindowUnicode,
323     LCMapStringW,
324     LoadAcceleratorsW,
325     LoadBitmapW,
326     LoadCursorFromFileW,
327     LoadCursorW,
328     LoadIconW,
329     LoadImageW,
330     LoadKeyboardLayoutW,
331     LoadLibraryExW,
332     LoadLibraryW,
333     LoadMenuIndirectW,
334     LoadMenuW,
335     LoadStringW,
336     MCIWndCreateW,
337     MapVirtualKeyExW,
338     MapVirtualKeyW,
339     MessageBoxExW,
340     MessageBoxIndirectW,
341     MessageBoxW,
342     ModifyMenuW,
343     MoveFileW,
344     MultiByteToWideChar,
345     MultinetGetConnectionPerformanceW,
346     OemToCharBuffW,
347     OemToCharW,
348     OleUIAddVerbMenuW,
349     OleUIBusyW,
350     OleUIChangeIconW,
351     OleUIChangeSourceW,
352     OleUIConvertW,
353     OleUIEditLinksW,
354     OleUIInsertObjectW,
355     OleUIObjectPropertiesW,
356     OleUIPasteSpecialW,
357     OleUIPromptUserW,
358     OleUIUpdateLinksW,
359     OpenEventW,
360     OpenFileMappingW,
361     OpenMutexW,
362     OpenPrinterW,
363     OpenSemaphoreW,
364     OpenWaitableTimerW,
365     OutputDebugStringW,
366     PageSetupDlgW,
367     PeekConsoleInputW,
368     PeekMessageW,
369     PlaySoundW,
370     PolyTextOutW,
371     PostMessageW,
372     PostThreadMessageW,
373     PrintDlgW,
374     QueryContextAttributesW,
375     QueryCredentialsAttributesW,
376     QueryDosDeviceW,
377     QuerySecurityPackageInfoW,
378     RasConnectionNotificationW,
379     RasCreatePhonebookEntryW,
380     RasDeleteEntryW,
381     RasDeleteSubEntryW,
382     RasDialW,
383     RasEditPhonebookEntryW,
384     RasEnumConnectionsW,
385     RasEnumDevicesW,
386     RasEnumEntriesW,
387     RasGetConnectStatusW,
388     RasGetEntryDialParamsW,
389     RasGetEntryPropertiesW,
390     RasGetErrorStringW,
391     RasGetProjectionInfoW,
392     RasHangUpW,
393     RasRenameEntryW,
394     RasSetEntryDialParamsW,
395     RasSetEntryPropertiesW,
396     RasSetSubEntryPropertiesW,
397     RasValidateEntryNameW,
398     ReadConsoleInputW,
399     ReadConsoleOutputCharacterW,
400     ReadConsoleOutputW,
401     ReadConsoleW,
402     RegConnectRegistryW,
403     RegCreateKeyExW,
404     RegCreateKeyW,
405     RegDeleteKeyW,
406     RegDeleteValueW,
407     RegEnumKeyExW,
408     RegEnumKeyW,
409     RegEnumValueW,
410     RegLoadKeyW,
411     RegOpenKeyExW,
412     RegOpenKeyW,
413     RegQueryInfoKeyW,
414     RegQueryMultipleValuesW,
415     RegQueryValueExW,
416     RegQueryValueW,
417     RegReplaceKeyW,
418     RegSaveKeyW,
419     RegSetValueExW,
420     RegSetValueW,
421     RegUnLoadKeyW,
422     RegisterClassExW,
423     RegisterClassW,
424     RegisterClipboardFormatW,
425     RegisterDeviceNotificationW,
426     RegisterWindowMessageW,
427     RemoveDirectoryW,
428     RemoveFontResourceW,
429     RemovePropA,
430     RemovePropW,
431     ReplaceTextW,
432     ResetDCW,
433     ResetPrinterW,
434     SHBrowseForFolderW,
435     SHChangeNotify ,
436     SHFileOperationW,
437     SHGetFileInfoW,
438     SHGetNewLinkInfoW,
439     SHGetPathFromIDListW,
440     ScrollConsoleScreenBufferW,
441     SearchPathW,
442     SendDlgItemMessageW,
443     SendMessageCallbackW,
444     SendMessageTimeoutW,
445     SendMessageW,
446     SendNotifyMessageW,
447     SetCalendarInfoW,
448     SetClassLongW,
449     SetComputerNameW,
450     SetConsoleTitleW,
451     SetCurrentDirectoryW,
452     SetDefaultCommConfigW,
453     SetDlgItemTextW,
454     SetEnvironmentVariableW,
455     SetFileAttributesW,
456     SetICMProfileW,
457     SetJobW,
458     SetLocaleInfoW,
459     SetMenuItemInfoW,
460     SetPrinterDataW,
461     SetPrinterW,
462     SetPropA,
463     SetPropW,
464     SetVolumeLabelW,
465     SetWindowLongA,
466     SetWindowLongW,
467     SetWindowTextW,
468     SetWindowsHookExW,
469     SetWindowsHookW,
470     ShellAboutW,
471     ShellExecuteExW ,
472     ShellExecuteW ,
473     Shell_NotifyIconW,
474     StartDocPrinterW,
475     StartDocW,
476     SystemParametersInfoW,
477     TabbedTextOutW,
478     TextOutW,
479     TranslateAcceleratorW,
480     UnregisterClassW,
481     UpdateICMRegKeyW,
482     UpdateResourceA,
483     UpdateResourceW,
484     VerFindFileW,
485     VerInstallFileW,
486     VerLanguageNameW,
487     VerQueryValueW,
488     VkKeyScanExW,
489     VkKeyScanW,
490     WNetAddConnection2W,
491     WNetAddConnection3W,
492     WNetAddConnectionW,
493     WNetCancelConnection2W,
494     WNetCancelConnectionW,
495     WNetConnectionDialog1W,
496     WNetDisconnectDialog1W,
497     WNetEnumResourceW,
498     WNetGetConnectionW,
499     WNetGetLastErrorW,
500     WNetGetNetworkInformationW,
501     WNetGetProviderNameW,
502     WNetGetResourceInformationW,
503     WNetGetResourceParentW,
504     WNetGetUniversalNameW ,
505     WNetGetUserW,
506     WNetOpenEnumW,
507     WNetUseConnectionW,
508     WaitNamedPipeW ,
509     WideCharToMultiByte,
510     WinHelpW,
511     WriteConsoleInputW,
512     WriteConsoleOutputCharacterW,
513     WriteConsoleOutputW,
514     WriteConsoleW,
515     WritePrivateProfileSectionW,
516     WritePrivateProfileStringW,
517     WritePrivateProfileStructW,
518     WriteProfileSectionW,
519     WriteProfileStringW,
520     auxGetDevCapsW,
521     capCreateCaptureWindowW,
522     capGetDriverDescriptionW,
523     joyGetDevCapsW,
524     lstrcatW,
525     lstrcmpW,
526     lstrcmpiW,
527     lstrcpyW,
528     lstrcpynW,
529     lstrlenW,
530     mciGetDeviceIDW,
531     mciGetErrorStringW,
532     mciSendCommandW,
533     mciSendStringW,
534     midiInGetDevCapsW,
535     midiInGetErrorTextW,
536     midiOutGetDevCapsW,
537     midiOutGetErrorTextW,
538     mixerGetControlDetailsW,
539     mixerGetDevCapsW,
540     mixerGetLineControlsW,
541     mixerGetLineInfoW,
542     mmioInstallIOProcW,
543     mmioOpenW,
544     mmioRenameW,
545     mmioStringToFOURCCW,
546     sndPlaySoundW,
547     waveInGetDevCapsW,
548     waveInGetErrorTextW,
549     waveOutGetDevCapsW,
550     waveOutGetErrorTextW,
551     wsprintfW,
552     wvsprintfW
553 };