1/*
2 * Copyright 2011 Jacek Caban for CodeWeavers
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#pragma makedep header
20
21import "oaidl.idl";
22cpp_quote("#undef ExpandEnvironmentStrings")
23
24[
25    helpstring("Windows Script Host Object Model"),
26    uuid(f935dc20-1cf0-11d0-adb9-00c04fd58a0b),
27    version(1.0)
28]
29library IWshRuntimeLibrary
30{
31    importlib("stdole2.tlb");
32
33    typedef enum {
34        WshRunning  = 0,
35        WshFinished,
36        WshFailed
37    } WshExecStatus;
38
39    typedef enum {
40        UnknownType = 0,
41        Removable,
42        Fixed,
43        Remote,
44        CDRom,
45        RamDisk
46    } DriveTypeConst;
47
48    typedef enum {
49        Normal     = 0x000,
50        ReadOnly   = 0x001,
51        Hidden     = 0x002,
52        System     = 0x004,
53        Volume     = 0x008,
54        Directory  = 0x010,
55        Archive    = 0x020,
56        Alias      = 0x400,
57        Compressed = 0x800
58    } FileAttribute;
59
60    typedef enum {
61        ForReading   = 0x1,
62        ForWriting   = 0x2,
63        ForAppending = 0x8
64    } IOMode;
65
66    typedef enum {
67        TristateTrue       = -1,
68        TristateFalse      =  0,
69        TristateUseDefault = -2,
70        TristateMixed      = -2
71    } Tristate;
72
73    interface IFolder;
74    interface IFolderCollection;
75
76    [
77        uuid(53bad8c1-e718-11cf-893d-00a0c9054228),
78        odl,
79        hidden,
80        dual,
81        nonextensible,
82        oleautomation
83    ]
84    interface ITextStream : IDispatch {
85        [id(0x2710), propget]
86        HRESULT Line([out, retval] long* Line);
87
88        [id(0xfffffdef), propget]
89        HRESULT Column([out, retval] long* Column);
90
91        [id(0x2712), propget]
92        HRESULT AtEndOfStream([out, retval] VARIANT_BOOL* EOS);
93
94        [id(0x2713), propget]
95        HRESULT AtEndOfLine([out, retval] VARIANT_BOOL* EOL);
96
97        [id(0x2714)]
98        HRESULT Read([in] long Characters, [out, retval] BSTR* Text);
99
100        [id(0x2715)]
101        HRESULT ReadLine([out, retval] BSTR* Text);
102
103        [id(0x2716)]
104        HRESULT ReadAll([out, retval] BSTR* Text);
105
106        [id(0x2717)]
107        HRESULT Write([in] BSTR Text);
108
109        [id(0x2718)]
110        HRESULT WriteLine([in, defaultvalue("")] BSTR Text);
111
112        [id(0x2719)]
113        HRESULT WriteBlankLines([in] long Lines);
114
115        [id(0x271a)]
116        HRESULT Skip([in] long Characters);
117
118        [id(0x271b)]
119        HRESULT SkipLine();
120
121        [id(0x271c)]
122        HRESULT Close();
123    };
124
125    [
126        uuid(c7c3f5a0-88a3-11d0-abcb-00a0c90fffc0),
127        odl,
128        hidden,
129        dual,
130        nonextensible,
131        oleautomation
132    ]
133    interface IDrive : IDispatch {
134        [id(DISPID_VALUE), propget]
135        HRESULT Path([out, retval] BSTR* path);
136
137        [id(0x2710), propget]
138        HRESULT DriveLetter([out, retval] BSTR* letter);
139
140        [id(0x2711), propget]
141        HRESULT ShareName([out, retval] BSTR* ShareName);
142
143        [id(0x2712), propget]
144        HRESULT DriveType([out, retval] DriveTypeConst* type);
145
146        [id(0x2713), propget]
147        HRESULT RootFolder([out, retval] IFolder** folder);
148
149        [id(0x2715), propget]
150        HRESULT AvailableSpace([out, retval] VARIANT* Avail);
151
152        [id(0x2714), propget]
153        HRESULT FreeSpace([out, retval] VARIANT* pFree);
154
155        [id(0x2716), propget]
156        HRESULT TotalSize([out, retval] VARIANT* Total);
157
158        [id(0x2717), propget]
159        HRESULT VolumeName([out, retval] BSTR* Name);
160
161        [id(0x2717), propput]
162        HRESULT VolumeName([in] BSTR Name);
163
164        [id(0x2718), propget]
165        HRESULT FileSystem([out, retval] BSTR* pFileSystem);
166
167        [id(0x2719), propget]
168        HRESULT SerialNumber([out, retval] long* SerialNumber);
169
170        [id(0x271a), propget]
171        HRESULT IsReady([out, retval] VARIANT_BOOL* pfReady);
172    };
173
174    [
175        uuid(c7c3f5a4-88a3-11d0-abcb-00a0c90fffc0),
176        odl,
177        hidden,
178        dual,
179        nonextensible,
180        oleautomation
181    ]
182    interface IFile : IDispatch {
183        [id(DISPID_VALUE), propget]
184        HRESULT Path([out, retval] BSTR* path);
185
186        [id(0x03e8), propget]
187        HRESULT Name([out, retval] BSTR* Name);
188
189        [id(0x03e8), propput]
190        HRESULT Name([in] BSTR Name);
191
192        [id(0x03ea), propget]
193        HRESULT ShortPath([out, retval] BSTR* path);
194
195        [id(0x03e9), propget]
196        HRESULT ShortName([out, retval] BSTR* Name);
197
198        [id(0x03ec), propget]
199        HRESULT Drive([out, retval] IDrive** drive);
200
201        [id(0x03ed), propget]
202        HRESULT ParentFolder([out, retval] IFolder** folder);
203
204        [id(0x03eb), propget]
205        HRESULT Attributes([out, retval] FileAttribute* attr);
206
207        [id(0x03eb), propput]
208        HRESULT Attributes([in] FileAttribute attr);
209
210        [id(0x03ee), propget]
211        HRESULT DateCreated([out, retval] DATE* date);
212
213        [id(0x03ef), propget]
214        HRESULT DateLastModified([out, retval] DATE* date);
215
216        [id(0x03f0), propget]
217        HRESULT DateLastAccessed([out, retval] DATE* date);
218
219        [id(0x03f1), propget]
220        HRESULT Size([out, retval] VARIANT* Size);
221
222        [id(0x03f2), propget]
223        HRESULT Type([out, retval] BSTR* Type);
224
225        [id(0x04b0)]
226        HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force);
227
228        [id(0x04b2)]
229        HRESULT Copy(
230                    [in] BSTR Destination,
231                    [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles);
232
233        [id(0x04b4)]
234        HRESULT Move([in] BSTR Destination);
235
236        [id(0x044c)]
237        HRESULT OpenAsTextStream(
238                    [in, defaultvalue(1)] IOMode IOMode,
239                    [in, defaultvalue(0)] Tristate Format,
240                    [out, retval] ITextStream** ppts);
241    };
242
243    [
244        uuid(c7c3f5a5-88a3-11d0-abcb-00a0c90fffc0),
245        odl,
246        hidden,
247        dual,
248        nonextensible,
249        oleautomation
250    ]
251    interface IFileCollection : IDispatch {
252        [id(DISPID_VALUE), propget]
253        HRESULT Item(
254                    [in] VARIANT Key,
255                    [out, retval] IFile** ppfile);
256        [id(DISPID_NEWENUM), propget, restricted, hidden]
257        HRESULT _NewEnum([out, retval] IUnknown** ppenum);
258        [id(1), propget]
259        HRESULT Count([out, retval] long* count);
260    };
261
262    [
263        uuid(c7c3f5a2-88a3-11d0-abcb-00a0c90fffc0),
264        odl,
265        hidden,
266        dual,
267        nonextensible,
268        oleautomation
269    ]
270    interface IFolder : IDispatch {
271        [id(DISPID_VALUE), propget]
272        HRESULT Path([out, retval] BSTR* path);
273
274        [id(0x03e8), propget]
275        HRESULT Name([out, retval] BSTR* name);
276
277        [id(0x03e8), propput]
278        HRESULT Name([in] BSTR name);
279
280        [id(0x03ea), propget]
281        HRESULT ShortPath([out, retval] BSTR* path);
282
283        [id(0x03e9), propget]
284        HRESULT ShortName([out, retval] BSTR* name);
285
286        [id(0x03ec), propget]
287        HRESULT Drive([out, retval] IDrive** drive);
288
289        [id(0x03ed), propget]
290        HRESULT ParentFolder([out, retval] IFolder** folder);
291
292        [id(0x03eb), propget]
293        HRESULT Attributes([out, retval] FileAttribute* attr);
294
295        [id(0x03eb), propput]
296        HRESULT Attributes([in] FileAttribute attr);
297
298        [id(0x03ee), propget]
299        HRESULT DateCreated([out, retval] DATE* date);
300
301        [id(0x03ef), propget]
302        HRESULT DateLastModified([out, retval] DATE* date);
303
304        [id(0x03f0), propget]
305        HRESULT DateLastAccessed([out, retval] DATE* date);
306
307        [id(0x03f2), propget]
308        HRESULT Type([out, retval] BSTR* type);
309
310        [id(0x04b1)]
311        HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL force);
312
313        [id(0x04b3)]
314        HRESULT Copy(
315                    [in] BSTR Destination,
316                    [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles);
317
318        [id(0x04b5)]
319        HRESULT Move([in] BSTR Destination);
320
321        [id(0x2710), propget]
322        HRESULT IsRootFolder([out, retval] VARIANT_BOOL* root);
323
324        [id(0x03f1), propget]
325        HRESULT Size([out, retval] VARIANT* size);
326
327        [id(0x2711), propget]
328        HRESULT SubFolders([out, retval] IFolderCollection** folders);
329
330        [id(0x2712), propget]
331        HRESULT Files([out, retval] IFileCollection** files);
332
333        [id(0x044d)]
334        HRESULT CreateTextFile(
335                    [in] BSTR FileName,
336                    [in, defaultvalue(-1)] VARIANT_BOOL Overwrite,
337                    [in, defaultvalue(0)] VARIANT_BOOL Unicode,
338                    [out, retval] ITextStream** ppts);
339    };
340
341    [
342        uuid(c7c3f5a3-88a3-11d0-abcb-00a0c90fffc0),
343        odl,
344        hidden,
345        dual,
346        nonextensible,
347        oleautomation
348    ]
349    interface IFolderCollection : IDispatch {
350        [id(2)]
351        HRESULT Add(
352                    [in] BSTR Name,
353                    [out, retval] IFolder** folder);
354
355        [id(DISPID_VALUE), propget]
356        HRESULT Item(
357                    [in] VARIANT Key,
358                    [out, retval] IFolder** folder);
359
360        [id(DISPID_NEWENUM), propget, restricted, hidden]
361        HRESULT _NewEnum([out, retval] IUnknown** ppenum);
362
363        [id(1), propget]
364        HRESULT Count([out, retval] long* count);
365    };
366
367    [
368        uuid(f935dc27-1cf0-11d0-adb9-00c04fd58a0b),
369        odl,
370        dual,
371        oleautomation
372    ]
373    interface IWshCollection : IDispatch {
374        [id(DISPID_VALUE)]
375        HRESULT Item(
376                [in] VARIANT *Index,
377                [out, retval] VARIANT *out_Value);
378
379        [id(1)]
380        HRESULT Count([out, retval] long *out_Count);
381
382        [id(2), propget]
383        HRESULT length([out, retval] long *out_Count);
384
385        [id(DISPID_NEWENUM)]
386        HRESULT _NewEnum([out, retval] IUnknown *out_Enum);
387    }
388
389    [
390        uuid(f935dc29-1cf0-11d0-adb9-00c04fd58a0b),
391        odl,
392        dual,
393        oleautomation
394    ]
395    interface IWshEnvironment : IDispatch {
396        [id(DISPID_VALUE), propget]
397        HRESULT Item(
398                [in] BSTR Name,
399                [out, retval] BSTR *out_Value);
400
401        [id(DISPID_VALUE), propput]
402        HRESULT Item(
403                [in] BSTR Name,
404                [in] BSTR Value);
405
406        [id(1)]
407        HRESULT Count([out, retval] long *out_Count);
408
409        [id(2), propget]
410        HRESULT length([out, retval] long *out_Count);
411
412        [id(DISPID_NEWENUM)]
413        HRESULT _NewEnum([out, retval] IUnknown **out_Enum);
414
415        [id(0x03e9)]
416        HRESULT Remove([in] BSTR Name);
417    }
418
419    [
420        uuid(08fed190-be19-11d3-a28b-00104bd35090),
421        odl,
422        dual,
423        oleautomation
424    ]
425    interface IWshExec : IDispatch {
426        [id(0x0001), propget]
427        HRESULT Status([out, retval] WshExecStatus* Status);
428
429        [id(0x0003), propget]
430        HRESULT StdIn([out, retval] ITextStream** stream);
431
432        [id(0x0004), propget]
433        HRESULT StdOut([out, retval] ITextStream** stream);
434
435        [id(0x0005), propget]
436        HRESULT StdErr([out, retval] ITextStream** stream);
437
438        [id(0x0006), propget]
439        HRESULT ProcessID([out, retval] DWORD *pid);
440
441        [id(0x0007), propget]
442        HRESULT ExitCode([out, retval] DWORD *code);
443
444        [id(0x0008)]
445        HRESULT Terminate();
446    };
447
448    [
449        uuid(f935dc23-1cf0-11d0-adb9-00c04fd58a0b),
450        odl,
451        dual,
452        oleautomation
453    ]
454    interface IWshShortcut : IDispatch {
455        [id(DISPID_VALUE), propget]
456        HRESULT FullName([out, retval] BSTR* name);
457
458        [id(0x03e8), propget]
459        HRESULT Arguments([out, retval] BSTR* Arguments);
460
461        [id(0x03e8), propput]
462        HRESULT Arguments([in] BSTR Arguments);
463
464        [id(0x03e9), propget]
465        HRESULT Description([out, retval] BSTR* Description);
466
467        [id(0x03e9), propput]
468        HRESULT Description([in] BSTR Description);
469
470        [id(0x03ea), propget]
471        HRESULT Hotkey([out, retval] BSTR* HotKey);
472
473        [id(0x03ea), propput]
474        HRESULT Hotkey([in] BSTR HotKey);
475
476        [id(0x03eb), propget]
477        HRESULT IconLocation([out, retval] BSTR* IconPath);
478
479        [id(0x03eb), propput]
480        HRESULT IconLocation([in] BSTR IconPath);
481
482        [id(0x03ec), propput]
483        HRESULT RelativePath([in] BSTR rhs);
484
485        [id(0x03ed), propget]
486        HRESULT TargetPath([out, retval] BSTR* Path);
487
488        [id(0x03ed), propput]
489        HRESULT TargetPath([in] BSTR Path);
490
491        [id(0x03ee), propget]
492        HRESULT WindowStyle([out, retval] int* ShowCmd);
493
494        [id(0x03ee), propput]
495        HRESULT WindowStyle([in] int ShowCmd);
496
497        [id(0x03ef), propget]
498        HRESULT WorkingDirectory([out, retval] BSTR* WorkingDirectory);
499
500        [id(0x03ef), propput]
501        HRESULT WorkingDirectory([in] BSTR WorkingDirectory);
502
503        [id(0x07d0), hidden]
504        HRESULT Load([in] BSTR PathLink);
505
506        [id(0x07d1)]
507        HRESULT Save();
508    };
509
510    [
511        uuid(f935dc21-1cf0-11d0-adb9-00c04fd58a0b),
512        odl,
513        dual,
514        oleautomation,
515        hidden
516    ]
517    interface IWshShell : IDispatch {
518        [id(0x0064), propget]
519        HRESULT SpecialFolders([out, retval] IWshCollection** out_Folders);
520
521        [id(0x00c8), propget]
522        HRESULT Environment(
523            [in, optional] VARIANT* Type,
524            [out, retval] IWshEnvironment** out_Env);
525
526        [id(0x03e8)]
527        HRESULT Run(
528            [in] BSTR Command,
529            [in, optional] VARIANT* WindowStyle,
530            [in, optional] VARIANT* WaitOnReturn,
531            [out, retval] DWORD* out_ExitCode);
532
533        [id(0x03e9)]
534        HRESULT Popup(
535            [in] BSTR Text,
536            [in, optional] VARIANT* SecondsToWait,
537            [in, optional] VARIANT* Title,
538            [in, optional] VARIANT* Type,
539            [out, retval] int* out_Button);
540
541        [id(0x03ea)]
542        HRESULT CreateShortcut(
543            [in] BSTR PathLink,
544            [out, retval] IDispatch** out_Shortcut);
545
546        [id(0x03ee)]
547        HRESULT ExpandEnvironmentStrings(
548            [in] BSTR Src,
549            [out, retval] BSTR* out_Dst);
550
551        [id(0x07d0)]
552        HRESULT RegRead(
553            [in] BSTR Name,
554            [out, retval] VARIANT* out_Value);
555
556        [id(0x07d1)]
557        HRESULT RegWrite(
558            [in] BSTR Name,
559            [in] VARIANT* Value,
560            [in, optional] VARIANT* Type);
561
562        [id(0x07d2)]
563        HRESULT RegDelete([in] BSTR Name);
564    };
565
566    [
567      uuid(24be5a30-edfe-11d2-b933-00104b365c9f),
568      odl,
569      dual,
570      oleautomation,
571      hidden
572    ]
573    interface IWshShell2 : IWshShell {
574        [id(0x0bb8)]
575        HRESULT LogEvent(
576            [in] VARIANT* Type,
577            [in] BSTR Message,
578            [in, defaultvalue("")] BSTR Target,
579            [out, retval] VARIANT_BOOL* out_Success);
580
581        [id(0x0bc2)]
582        HRESULT AppActivate(
583            [in] VARIANT* App,
584            [in, optional] VARIANT* Wait,
585            [out, retval] VARIANT_BOOL* out_Success);
586
587        [id(0x0bc3)]
588        HRESULT SendKeys(
589            [in] BSTR Keys,
590            [in, optional] VARIANT* Wait);
591    };
592
593    [
594        uuid(41904400-be18-11d3-a28b-00104bd35090),
595        odl,
596        dual,
597        oleautomation
598    ]
599    interface IWshShell3 : IWshShell2 {
600        [id(0x0bc4)]
601        HRESULT Exec(
602            [in] BSTR Command,
603            [out, retval] IWshExec** out_Exec);
604
605        [id(0x0bc5), propget]
606        HRESULT CurrentDirectory([out, retval] BSTR* out_Directory);
607
608        [id(0x0bc5), propput]
609        HRESULT CurrentDirectory([in] BSTR out_Directory);
610    };
611
612    [
613        uuid(24be5a31-edfe-11d2-b933-00104b365c9f),
614        odl,
615        dual,
616        oleautomation
617    ]
618    interface IWshNetwork2 : IDispatch {
619        [id(0x60020000), propget]
620        HRESULT UserDomain([out, retval] BSTR *out_UserDomain);
621    }
622
623    [
624        helpstring("Windows Script Host Shell Object"),
625        uuid(f935dc22-1cf0-11d0-adb9-00c04fd58a0b),
626        threading(apartment),
627        progid("WScript.Shell.1"),
628        vi_progid("WScript.Shell")
629    ]
630    coclass IWshShell_Class {
631        [default] interface IWshShell3;
632    }
633
634    [
635        helpstring("Windows Script Host Shell Object"),
636        uuid(72c24dd5-d70a-438b-8a42-98424b88afb8),
637        threading(apartment),
638        progid("WScript.Shell.1"),
639        vi_progid("WScript.Shell")
640    ]
641    coclass WshShell {
642        [default] interface IWshShell3;
643    }
644
645    [
646        helpstring("Windows Script Host Network Object"),
647        uuid(f935dc26-1cf0-11d0-adb9-00c04fd58a0b),
648        threading(apartment),
649        progid("WScript.Network.1"),
650        vi_progid("WScript.Network")
651    ]
652    coclass IWshNetwork_Class {
653        [default] interface IWshNetwork2;
654    }
655
656    [
657        helpstring("Windows Script Host Network Object"),
658        uuid(093ff999-1ea0-4079-9525-9614c3504b74),
659        threading(apartment),
660        progid("WScript.Network.1"),
661        vi_progid("WScript.Network")
662    ]
663    coclass WshNetwork {
664        [default] interface IWshNetwork2;
665    }
666
667    [
668        uuid(08fed191-be19-11d3-a28b-00104bd35090),
669        threading(apartment)
670    ]
671    coclass WshExec {
672        [default] interface IWshExec;
673    }
674}
675