jscript: Added parser memory managment.
[wine] / dlls / setupapi / setupapi_private.h
1 /*
2  * Copyright 2001 Andreas Mohr
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #ifndef __SETUPAPI_PRIVATE_H
20 #define __SETUPAPI_PRIVATE_H
21
22 #define COPYFILEDLGORD  1000
23 #define SOURCESTRORD    500
24 #define DESTSTRORD      501
25 #define PROGRESSORD     502
26
27
28 #define REG_INSTALLEDFILES "System\\CurrentControlSet\\Control\\InstalledFiles"
29 #define REGPART_RENAME "\\Rename"
30 #define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
31
32 static inline WCHAR *strdupW( const WCHAR *str )
33 {
34     WCHAR *ret = NULL;
35     if (str)
36     {
37         int len = (lstrlenW(str) + 1) * sizeof(WCHAR);
38         if ((ret = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( ret, str, len );
39     }
40     return ret;
41 }
42
43 static inline char *strdupWtoA( const WCHAR *str )
44 {
45     char *ret = NULL;
46     if (str)
47     {
48         DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
49         if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
50             WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
51     }
52     return ret;
53 }
54
55 static inline WCHAR *strdupAtoW( const char *str )
56 {
57     WCHAR *ret = NULL;
58     if (str)
59     {
60         DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
61         if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
62             MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
63     }
64     return ret;
65 }
66
67 /* string substitutions */
68
69 struct inf_file;
70 extern const WCHAR *DIRID_get_string( int dirid );
71 extern unsigned int PARSER_string_substA( const struct inf_file *file, const WCHAR *text,
72                                           char *buffer, unsigned int size );
73 extern unsigned int PARSER_string_substW( const struct inf_file *file, const WCHAR *text,
74                                           WCHAR *buffer, unsigned int size );
75 extern const WCHAR *PARSER_get_inf_filename( HINF hinf );
76 extern WCHAR *PARSER_get_src_root( HINF hinf );
77 extern WCHAR *PARSER_get_dest_dir( INFCONTEXT *context );
78
79 /* support for Ascii queue callback functions */
80
81 struct callback_WtoA_context
82 {
83     void               *orig_context;
84     PSP_FILE_CALLBACK_A orig_handler;
85 };
86
87 UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification, UINT_PTR, UINT_PTR );
88
89 /* from msvcrt/sys/stat.h */
90 #define _S_IWRITE 0x0080
91 #define _S_IREAD  0x0100
92
93 extern OSVERSIONINFOW OsVersionInfo;
94
95 extern BOOL create_fake_dll( const WCHAR *name, const WCHAR *source );
96
97 #endif /* __SETUPAPI_PRIVATE_H */