OpendTect-6_4  6.4
winutils.h
Go to the documentation of this file.
1 #ifndef winutils_h
2 #define winutils_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Lammertink
9  Date: 09-10-2003
10  Contents: Utilities for win32 support
11  RCS: $Id$
12 ________________________________________________________________________
13 
14 
15 -*/
16 
17 
18 #include "basicmod.h"
19 #include "gendefs.h"
20 
21 #ifdef __win__
22 # include "shlobj.h"
23 #endif
24 
25 extern "C"
26 {
27  mGlobal(Basic) const char* getCleanUnxPath( const char* path );
28  mGlobal(Basic) const char* getCleanWinPath( const char* path );
29  mGlobal(Basic) const char* GetSpecialFolderLocation(int csidl);
30 }
31 
32 #ifdef __win__
33 
34 mGlobal(Basic) bool winCopy(const char* from,const char* to,
35  bool isfile,bool ismove=false);
36 mGlobal(Basic) bool winRemoveDir(const char* dirnm);
37 
38 
39 mGlobal(Basic) bool executeWinProg(const char* comm,
40  const char* parm,
41  const char* runin=0);
42 mGlobal(Basic) bool execShellCmd(const char* comm,const char* parm,
43  const char* runin );
44 mGlobal(Basic) bool execProc(const char* comm,bool inconsole,
45  bool inbg,const char* runin);
46 
47 mGlobal(Basic) unsigned int getWinVersion();
48 mGlobal(Basic) const char* getFullWinVersion();
49 mGlobal(Basic) const char* getCygDir();
50 mGlobal(Basic) bool getDefaultBrowser(BufferString& cmd,
51  BufferString& errmsg);
52 
53 mGlobal(Basic) bool setRegKeyVal(const char* ky, const char* vanrnm,
54  const char *val);
55 mGlobal(Basic) bool removeRegKey(const char*);
56 
57 mGlobal(Basic) void disableAutoSleep();
58 mGlobal(Basic) void enableAutoSleep();
59 /*
60 For documentation of the CSIDL values, see:
61 
62 http://msdn.microsoft.com/library/default.asp?
63  url=/library/en-us/shellcc/platform/shell/reference/enums/csidl.asp
64 
65 
66  CSIDL
67  _________________________________________________________________
68 
69  CSIDL values provide a unique system-independent way to identify
70  special folders used frequently by applications, but which may not
71  have the same name or location on any given system. For example, the
72  system folder may be "C:\Windows" on one system and "C:\Winnt" on
73  another.
74 
75  Constants
76 
77  CSIDL_FLAG_CREATE (0x8000)
78  Version 5.0. Combine this CSIDL with any of the following
79  CSIDLs to force the creation of the associated folder.
80 
81  CSIDL_ADMINTOOLS (0x0030)
82  Version 5.0. The file system directory that is used to store
83  administrative tools for an individual user. The Microsoft
84  Management Console (MMC) will save customized consoles to this
85  directory, and it will roam with the user.
86 
87  CSIDL_ALTSTARTUP (0x001d)
88  The file system directory that corresponds to the user's
89  nonlocalized Startup program group.
90 
91  CSIDL_APPDATA (0x001a)
92  Version 4.71. The file system directory that serves as a common
93  repository for application-specific data. A typical path is
94  C:\Documents and Settings\username\Application Data. This CSIDL
95  is supported by the redistributable Shfolder.dll for systems
96  that do not have the Microsoft Internet Explorer 4.0
97  integrated Shell installed.
98 
99  CSIDL_BITBUCKET (0x000a)
100  The virtual folder containing the objects in the user's Recycle
101  Bin.
102 
103  CSIDL_CDBURN_AREA (0x003b)
104  Version 6.0. The file system directory acting as a staging area
105  for files waiting to be written to CD. A typical path is
106  C:\Documents and Settings\username\Local Settings\Application
107  Data\Microsoft\CD Burning.
108 
109  CSIDL_COMMON_ADMINTOOLS (0x002f)
110  Version 5.0. The file system directory containing
111  administrative tools for all users of the computer.
112 
113  CSIDL_COMMON_ALTSTARTUP (0x001e)
114  The file system directory that corresponds to the nonlocalized
115  Startup program group for all users. Valid only for Microsoft
116  Windows NT systems.
117 
118  CSIDL_COMMON_APPDATA (0x0023)
119  Version 5.0. The file system directory containing application
120  data for all users. A typical path is C:\Documents and
121  Settings\All Users\Application Data.
122 
123  CSIDL_COMMON_DESKTOPDIRECTORY (0x0019)
124  The file system directory that contains files and folders that
125  appear on the desktop for all users. A typical path is
126  C:\Documents and Settings\All Users\Desktop. Valid only for
127  Windows NT systems.
128 
129  CSIDL_COMMON_DOCUMENTS (0x002e)
130  The file system directory that contains documents that are
131  common to all users. A typical paths is C:\Documents and
132  Settings\All Users\Documents. Valid for Windows NT systems and
133  Microsoft Windows 95 and Windows 98 systems with Shfolder.dll
134  installed.
135 
136  CSIDL_COMMON_FAVORITES (0x001f)
137  The file system directory that serves as a common repository
138  for favorite items common to all users. Valid only for Windows
139  NT systems.
140 
141  CSIDL_COMMON_MUSIC (0x0035)
142  Version 6.0. The file system directory that serves as a
143  repository for music files common to all users. A typical path
144  is C:\Documents and Settings\All Users\Documents\My Music.
145 
146  CSIDL_COMMON_PICTURES (0x0036)
147  Version 6.0. The file system directory that serves as a
148  repository for image files common to all users. A typical path
149  is C:\Documents and Settings\All Users\Documents\My Pictures.
150 
151  CSIDL_COMMON_PROGRAMS (0x0017)
152  The file system directory that contains the directories for the
153  common program groups that appear on the Start menu for all
154  users. A typical path is C:\Documents and Settings\All
155  Users\Start Menu\Programs. Valid only for Windows NT systems.
156 
157  CSIDL_COMMON_STARTMENU (0x0016)
158  The file system directory that contains the programs and
159  folders that appear on the Start menu for all users. A typical
160  path is C:\Documents and Settings\All Users\Start Menu. Valid
161  only for Windows NT systems.
162 
163  CSIDL_COMMON_STARTUP (0x0018)
164  The file system directory that contains the programs that
165  appear in the Startup folder for all users. A typical path is
166  C:\Documents and Settings\All Users\Start
167  Menu\Programs\Startup. Valid only for Windows NT systems.
168 
169  CSIDL_COMMON_TEMPLATES (0x002d)
170  The file system directory that contains the templates that are
171  available to all users. A typical path is C:\Documents and
172  Settings\All Users\Templates. Valid only for Windows NT
173  systems.
174 
175  CSIDL_COMMON_VIDEO (0x0037)
176  Version 6.0. The file system directory that serves as a
177  repository for video files common to all users. A typical path
178  is C:\Documents and Settings\All Users\Documents\My Videos.
179 
180  CSIDL_CONTROLS (0x0003)
181  The virtual folder containing icons for the Control Panel
182  applications.
183 
184  CSIDL_COOKIES (0x0021)
185  The file system directory that serves as a common repository
186  for Internet cookies. A typical path is C:\Documents and
187  Settings\username\Cookies.
188 
189  CSIDL_DESKTOP (0x0000)
190  The virtual folder representing the Windows desktop, the root
191  of the namespace.
192 
193  CSIDL_DESKTOPDIRECTORY (0x0010)
194  The file system directory used to physically store file objects
195  on the desktop (not to be confused with the desktop folder
196  itself). A typical path is C:\Documents and
197  Settings\username\Desktop.
198 
199  CSIDL_DRIVES (0x0011)
200  The virtual folder representing My Computer, containing
201  everything on the local computer: storage devices, printers,
202  and Control Panel. The folder may also contain mapped network
203  drives.
204 
205  CSIDL_FAVORITES (0x0006)
206  The file system directory that serves as a common repository
207  for the user's favorite items. A typical path is C:\Documents
208  and Settings\username\Favorites.
209 
210  CSIDL_FONTS (0x0014)
211  A virtual folder containing fonts. A typical path is
212  C:\Windows\Fonts.
213 
214  CSIDL_HISTORY (0x0022)
215  The file system directory that serves as a common repository
216  for Internet history items.
217 
218  CSIDL_INTERNET (0x0001)
219  A virtual folder representing the Internet.
220 
221  CSIDL_INTERNET_CACHE (0x0020)
222  Version 4.72. The file system directory that serves as a common
223  repository for temporary Internet files. A typical path is
224  C:\Documents and Settings\username\Local Settings\Temporary
225  Internet Files.
226 
227  CSIDL_LOCAL_APPDATA (0x001c)
228  Version 5.0. The file system directory that serves as a data
229  repository for local (nonroaming) applications. A typical path
230  is C:\Documents and Settings\username\Local
231  Settings\Application Data.
232 
233  CSIDL_MYDOCUMENTS (0x000c)
234  Version 6.0. The virtual folder representing the My Documents
235  desktop item.
236 
237  CSIDL_MYMUSIC (0x000d)
238  The file system directory that serves as a common repository
239  for music files. A typical path is C:\Documents and
240  Settings\User\My Documents\My Music.
241 
242  CSIDL_MYPICTURES (0x0027)
243  Version 5.0. The file system directory that serves as a common
244  repository for image files. A typical path is C:\Documents and
245  Settings\username\My Documents\My Pictures.
246 
247  CSIDL_MYVIDEO (0x000e)
248  Version 6.0. The file system directory that serves as a common
249  repository for video files. A typical path is C:\Documents and
250  Settings\username\My Documents\My Videos.
251 
252  CSIDL_NETHOOD (0x0013)
253  A file system directory containing the link objects that may
254  exist in the My Network Places virtual folder. It is not the
255  same as CSIDL_NETWORK, which represents the network namespace
256  root. A typical path is C:\Documents and
257  Settings\username\NetHood.
258 
259  CSIDL_NETWORK (0x0012)
260  A virtual folder representing Network Neighborhood, the root of
261  the network namespace hierarchy.
262 
263  CSIDL_PERSONAL (0x0005)
264  Version 6.0. The virtual folder representing the My Documents
265  desktop item. This is equivalent to CSIDL_MYDOCUMENTS.
266 
267  Previous to Version 6.0. The file system directory used to
268  physically store a user's common repository of documents. A
269  typical path is C:\Documents and Settings\username\My
270  Documents. This should be distinguished from the virtual My
271  Documents folder in the namespace. To access that virtual
272  folder, use SHGetFolderLocation, which returns the ITEMIDLIST
273  for the virtual location, or refer to the technique described
274  in Managing the File System.
275 
276  CSIDL_PRINTERS (0x0004)
277  The virtual folder containing installed printers.
278 
279  CSIDL_PRINTHOOD (0x001b)
280  The file system directory that contains the link objects that
281  can exist in the Printers virtual folder. A typical path is
282  C:\Documents and Settings\username\PrintHood.
283 
284  CSIDL_PROFILE (0x0028)
285  Version 5.0. The user's profile folder. A typical path is
286  C:\Documents and Settings\username. Applications should not
287  create files or folders at this level; they should put their
288  data under the locations referred to by CSIDL_APPDATA or
289  CSIDL_LOCAL_APPDATA.
290 
291  CSIDL_PROFILES (0x003e)
292  Version 6.0. The file system directory containing user profile
293  folders. A typical path is C:\Documents and Settings.
294 
295  CSIDL_PROGRAM_FILES (0x0026)
296  Version 5.0. The Program Files folder. A typical path is
297  C:\Program Files.
298 
299  CSIDL_PROGRAM_FILES_COMMON (0x002b)
300  Version 5.0. A folder for components that are shared across
301  applications. A typical path is C:\Program Files\Common. Valid
302  only for Windows NT, Windows 2000, and Windows XP systems. Not
303  valid for Windows Millennium Edition (Windows Me).
304 
305  CSIDL_PROGRAMS (0x0002)
306  The file system directory that contains the user's program
307  groups (which are themselves file system directories). A
308  typical path is C:\Documents and Settings\username\Start
309  Menu\Programs.
310 
311  CSIDL_RECENT (0x0008)
312  The file system directory that contains shortcuts to the user's
313  most recently used documents. A typical path is C:\Documents
314  and Settings\username\My Recent Documents. To create a shortcut
315  in this folder, use SHAddToRecentDocs. In addition to creating
316  the shortcut, this function updates the Shell's list of recent
317  documents and adds the shortcut to the My Recent Documents
318  submenu of the Start menu.
319 
320  CSIDL_SENDTO (0x0009)
321  The file system directory that contains Send To menu items. A
322  typical path is C:\Documents and Settings\username\SendTo.
323 
324  CSIDL_STARTMENU (0x000b)
325  The file system directory containing Start menu items. A
326  typical path is C:\Documents and Settings\username\Start Menu.
327 
328  CSIDL_STARTUP (0x0007)
329  The file system directory that corresponds to the user's
330  Startup program group. The system starts these programs
331  whenever any user logs onto Windows NT or starts Windows 95. A
332  typical path is C:\Documents and Settings\username\Start
333  Menu\Programs\Startup.
334 
335  CSIDL_SYSTEM (0x0025)
336  Version 5.0. The Windows System folder. A typical path is
337  C:\Windows\System32.
338 
339  CSIDL_TEMPLATES (0x0015)
340  The file system directory that serves as a common repository
341  for document templates. A typical path is C:\Documents and
342  Settings\username\Templates.
343 
344  CSIDL_WINDOWS (0x0024)
345  Version 5.0. The Windows directory or SYSROOT. This corresponds
346  to the %windir% or %SYSTEMROOT% environment variables. A
347  typical path is C:\Windows.
348 
349  Remarks
350 
351  These values supersede the use of environment variables for this
352  purpose.
353 
354  A CSIDL is used in conjunction with one of four Shell functions,
355  SHGetFolderLocation, SHGetFolderPath, SHGetSpecialFolderLocation,
356  and SHGetSpecialFolderPath, to retrieve a special folder's path or
357  pointer to an item identifier list (PIDL).
358 
359  Combine CSIDL_FLAG_CREATE with any of the other CSIDLs to force the
360  creation of the associated folder. The remaining CSIDLs correspond
361  to either file system folders or virtual folders. Where the CSIDL
362  identifies a file system folder, a commonly used path is given as
363  an example. Other paths may be used. Some CSIDLs can be mapped to
364  an equivalent %VariableName% environment variable. CSIDLs are more
365  reliable, however, and should be used if possible.
366 
367 */
368 
369 #endif /* __win__ */
370 
371 #endif
T to(const F &fr)
Definition: convert.h:33
#define mGlobal(module)
Definition: commondefs.h:163
const char * getCleanUnxPath(const char *path)
const char * getCleanWinPath(const char *path)
const char * GetSpecialFolderLocation(int csidl)
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019