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

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