1(*
2    Title:      Standard Basis Library: Windows signature and structure
3    Author:     David Matthews
4    Copyright   David Matthews 2000, 2005, 2012, 2018, 2019
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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19*)
20
21signature WINDOWS =
22sig
23    structure Key :
24    sig
25        include BIT_FLAGS
26        val allAccess : flags
27        val createLink : flags
28        val createSubKey : flags
29        val enumerateSubKeys : flags
30        val execute : flags
31        val notify : flags
32        val queryValue : flags
33        val read : flags
34        val setValue : flags
35        val write : flags
36    end
37    structure Reg :
38    sig
39        eqtype hkey
40        val classesRoot  : hkey
41        val currentUser  : hkey
42        val localMachine : hkey
43        val users        : hkey
44        val performanceData : hkey
45        val currentConfig : hkey
46        val dynData : hkey
47  
48        datatype create_result =
49              CREATED_NEW_KEY of hkey
50            | OPENED_EXISTING_KEY of hkey
51        val createKeyEx : hkey * string * Key.flags -> create_result
52        val openKeyEx : hkey * string * Key.flags -> hkey
53        val closeKey : hkey -> unit
54        val deleteKey : hkey * string -> unit
55        val deleteValue : hkey * string -> unit
56        val enumKeyEx : hkey * int -> string option
57        val enumValueEx : hkey * int -> string option
58        datatype value =
59              SZ of string
60            | DWORD of SysWord.word
61            | BINARY of Word8Vector.vector
62            | MULTI_SZ of string list
63            | EXPAND_SZ of string
64        val queryValueEx : hkey * string -> value option
65        val setValueEx : hkey * string * value -> unit
66    end
67
68    structure Config:
69    sig
70        val platformWin32s : SysWord.word
71        val platformWin32Windows : SysWord.word
72        val platformWin32NT : SysWord.word
73        val platformWin32CE : SysWord.word
74
75        val getVersionEx: unit ->
76            { majorVersion: SysWord.word, minorVersion: SysWord.word,
77              buildNumber: SysWord.word, platformId: SysWord.word,
78              csdVersion: string }
79
80        val getWindowsDirectory: unit -> string
81        val getSystemDirectory: unit -> string
82        val getComputerName: unit -> string
83        val getUserName: unit -> string
84    end
85
86    structure DDE :
87    sig
88        type info
89        val startDialog : string * string -> info
90        val executeString : info * string * int * Time.time -> unit
91        val stopDialog : info -> unit
92    end
93
94    val getVolumeInformation :
95                string -> {
96                            volumeName : string,
97                            systemName : string,
98                            serialNumber : SysWord.word,
99                            maximumComponentLength : int
100                          }
101
102    val findExecutable : string -> string option
103    val launchApplication : string * string -> unit
104    val openDocument : string -> unit
105    val simpleExecute : string * string -> OS.Process.status
106    type ('a,'b) proc
107    val execute : string * string -> ('a, 'b) proc
108    val textInstreamOf : (TextIO.instream, 'a) proc -> TextIO.instream
109    val binInstreamOf  : (BinIO.instream, 'a) proc -> BinIO.instream
110    val textOutstreamOf : ('a, TextIO.outstream) proc -> TextIO.outstream
111    val binOutstreamOf  : ('a, BinIO.outstream) proc -> BinIO.outstream
112    val reap : ('a, 'b) proc -> OS.Process.status
113
114    structure Status :
115    sig
116        type status = SysWord.word
117        val accessViolation        : status
118        val arrayBoundsExceeded    : status
119        val breakpoint             : status
120        val controlCExit           : status
121        val datatypeMisalignment   : status
122        val floatDenormalOperand   : status
123        val floatDivideByZero      : status
124        val floatInexactResult     : status
125        val floatInvalidOperation  : status
126        val floatOverflow          : status
127        val floatStackCheck        : status
128        val floatUnderflow         : status
129        val guardPageViolation     : status
130        val integerDivideByZero    : status
131        val integerOverflow        : status
132        val illegalInstruction     : status
133        val invalidDisposition     : status
134        val invalidHandle          : status
135        val inPageError            : status
136        val noncontinuableException: status
137        val pending                : status
138        val privilegedInstruction  : status
139        val singleStep             : status
140        val stackOverflow          : status
141        val timeout                : status
142        val userAPC                : status
143    end
144    val fromStatus : OS.Process.status -> Status.status
145    val exit : Status.status -> 'a
146
147end;
148
149(* Provide an empty version for bootstrapping.  It uses the FFI but that has changed. *)
150
151structure Windows = struct end;
152