@bun-win32/wtsapi32 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AI.md CHANGED
@@ -53,7 +53,7 @@ const text = new TextDecoder('utf-16').decode(buf).replace(/\0.*$/, '');
53
53
 
54
54
  - **Pointer** params (`LP*`, `P*`, `Pointer`): pass `buffer.ptr` from a caller-allocated `Buffer`.
55
55
  - **Handle** params (`HANDLE`, `HWND`, etc.): pass a `bigint` value.
56
- - **Out-parameters**: allocate a `Buffer`, pass `.ptr`, read the result after the call.
56
+ - **Out-parameters** carry a direction suffix on the parameter **name** — `_out` for an `_Out_` param (the function writes through it), `_in_out` for `_Inout_` (you seed it, the function updates it); an `_In_` param is bare. Allocate a `Buffer`, pass `.ptr`, read the result after the call.
57
57
 
58
58
  ```ts
59
59
  const out = Buffer.alloc(4);
@@ -63,9 +63,11 @@ const value = out.readUInt32LE(0);
63
63
 
64
64
  ### Nullability
65
65
 
66
- - `| NULL` in a signature -> pass `null` (optional pointer).
67
- - `| 0n` in a signature -> pass `0n` (optional handle).
66
+ Nullability is encoded in the **type** via two representation-aware markers — the null sentinel is derived from `T` (`null` for pointer types `LP*`/`P*`, `0n` for handles and by-value addresses):
68
67
 
68
+ - `OPTIONAL<T>` — the parameter is formally optional (SAL `_*opt_` / `[*, optional]` / `_Reserved_` that still takes a value). Pass a value, or the null sentinel to omit.
69
+ - `NULLABLE<T>` — a plain `[in]`/`[out]` param whose docs say it can be NULL ("This parameter can be NULL" / "Specify NULL to …", including sizing-call buffers).
70
+ - A **required** param is bare; a **must-be-null reserved** param is typed `NULL`. A by-value **scalar** (`DWORD`/`ULONG`/`UINT`/`BOOL`) is never wrapped — its "optional" means pass `0`/a default.
69
71
  ## Errors and Cleanup
70
72
 
71
73
  Return values are raw. If the Win32 function uses last-error semantics, read via `GetLastError()`. Resource cleanup is your responsibility - same as raw Win32.
package/README.md CHANGED
@@ -79,3 +79,4 @@ bun run example:session-monitor
79
79
 
80
80
  - Either rely on lazy binding or call `Wtsapi32.Preload()`.
81
81
  - Windows only. Bun runtime required.
82
+ - **SAL types & naming:** nullability is in the **type** — `OPTIONAL<T>` (formally optional, SAL `_*opt_`) and `NULLABLE<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
- "author": "Stev Peifer <stev@bell.net>",
2
+ "author": "Stev Peifer <stev.p@outlook.com>",
3
3
  "bugs": {
4
4
  "url": "https://github.com/ObscuritySRL/bun-win32/issues"
5
5
  },
6
6
  "dependencies": {
7
- "@bun-win32/core": "1.1.2"
7
+ "@bun-win32/core": "2.0.0"
8
8
  },
9
9
  "description": "Zero-dependency, zero-overhead Win32 WTSAPI32 bindings for Bun (FFI) on Windows.",
10
10
  "devDependencies": {
@@ -27,7 +27,7 @@
27
27
  "directory": "packages/wtsapi32"
28
28
  },
29
29
  "type": "module",
30
- "version": "1.0.0",
30
+ "version": "2.0.0",
31
31
  "main": "./index.ts",
32
32
  "keywords": [
33
33
  "bun",
@@ -13,6 +13,7 @@ import type {
13
13
  LPSTR,
14
14
  LPWSTR,
15
15
  NULL,
16
+ OPTIONAL,
16
17
  PBOOL,
17
18
  PBYTE,
18
19
  PCHAR,
@@ -143,12 +144,12 @@ class Wtsapi32 extends Win32 {
143
144
  }
144
145
 
145
146
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtscreatelistenera
146
- public static WTSCreateListenerA(hServer: HANDLE, pReserved: PVOID | NULL, Reserved: DWORD, pListenerName: LPSTR, pBuffer: PWTSLISTENERCONFIGA, flag: DWORD): BOOL {
147
+ public static WTSCreateListenerA(hServer: HANDLE, pReserved: NULL, Reserved: DWORD, pListenerName: LPSTR, pBuffer: PWTSLISTENERCONFIGA, flag: DWORD): BOOL {
147
148
  return Wtsapi32.Load('WTSCreateListenerA')(hServer, pReserved, Reserved, pListenerName, pBuffer, flag);
148
149
  }
149
150
 
150
151
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtscreatelistenerw
151
- public static WTSCreateListenerW(hServer: HANDLE, pReserved: PVOID | NULL, Reserved: DWORD, pListenerName: LPWSTR, pBuffer: PWTSLISTENERCONFIGW, flag: DWORD): BOOL {
152
+ public static WTSCreateListenerW(hServer: HANDLE, pReserved: NULL, Reserved: DWORD, pListenerName: LPWSTR, pBuffer: PWTSLISTENERCONFIGW, flag: DWORD): BOOL {
152
153
  return Wtsapi32.Load('WTSCreateListenerW')(hServer, pReserved, Reserved, pListenerName, pBuffer, flag);
153
154
  }
154
155
 
@@ -163,63 +164,63 @@ class Wtsapi32 extends Win32 {
163
164
  }
164
165
 
165
166
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumeratelistenersa
166
- public static WTSEnumerateListenersA(hServer: HANDLE, pReserved: PVOID | NULL, Reserved: DWORD, pListeners: PWTSLISTENERNAMEA | NULL, pCount: LPDWORD): BOOL {
167
- return Wtsapi32.Load('WTSEnumerateListenersA')(hServer, pReserved, Reserved, pListeners, pCount);
167
+ public static WTSEnumerateListenersA(hServer: HANDLE, pReserved: NULL, Reserved: DWORD, pListeners_out: OPTIONAL<PWTSLISTENERNAMEA>, pCount_in_out: LPDWORD): BOOL {
168
+ return Wtsapi32.Load('WTSEnumerateListenersA')(hServer, pReserved, Reserved, pListeners_out, pCount_in_out);
168
169
  }
169
170
 
170
171
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumeratelistenersw
171
- public static WTSEnumerateListenersW(hServer: HANDLE, pReserved: PVOID | NULL, Reserved: DWORD, pListeners: PWTSLISTENERNAMEW | NULL, pCount: LPDWORD): BOOL {
172
- return Wtsapi32.Load('WTSEnumerateListenersW')(hServer, pReserved, Reserved, pListeners, pCount);
172
+ public static WTSEnumerateListenersW(hServer: HANDLE, pReserved: NULL, Reserved: DWORD, pListeners_out: OPTIONAL<PWTSLISTENERNAMEW>, pCount_in_out: LPDWORD): BOOL {
173
+ return Wtsapi32.Load('WTSEnumerateListenersW')(hServer, pReserved, Reserved, pListeners_out, pCount_in_out);
173
174
  }
174
175
 
175
176
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumerateprocessesa
176
- public static WTSEnumerateProcessesA(hServer: HANDLE, Reserved: DWORD, Version: DWORD, ppProcessInfo: PVOID, pCount: LPDWORD): BOOL {
177
- return Wtsapi32.Load('WTSEnumerateProcessesA')(hServer, Reserved, Version, ppProcessInfo, pCount);
177
+ public static WTSEnumerateProcessesA(hServer: HANDLE, Reserved: DWORD, Version: DWORD, ppProcessInfo_out: PVOID, pCount_out: LPDWORD): BOOL {
178
+ return Wtsapi32.Load('WTSEnumerateProcessesA')(hServer, Reserved, Version, ppProcessInfo_out, pCount_out);
178
179
  }
179
180
 
180
181
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumerateprocessesexa
181
- public static WTSEnumerateProcessesExA(hServer: HANDLE, pLevel: LPDWORD, SessionId: DWORD, ppProcessInfo: PVOID, pCount: LPDWORD): BOOL {
182
- return Wtsapi32.Load('WTSEnumerateProcessesExA')(hServer, pLevel, SessionId, ppProcessInfo, pCount);
182
+ public static WTSEnumerateProcessesExA(hServer: HANDLE, pLevel_in_out: LPDWORD, SessionId: DWORD, ppProcessInfo_out: PVOID, pCount_out: LPDWORD): BOOL {
183
+ return Wtsapi32.Load('WTSEnumerateProcessesExA')(hServer, pLevel_in_out, SessionId, ppProcessInfo_out, pCount_out);
183
184
  }
184
185
 
185
186
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumerateprocessesexw
186
- public static WTSEnumerateProcessesExW(hServer: HANDLE, pLevel: LPDWORD, SessionId: DWORD, ppProcessInfo: PVOID, pCount: LPDWORD): BOOL {
187
- return Wtsapi32.Load('WTSEnumerateProcessesExW')(hServer, pLevel, SessionId, ppProcessInfo, pCount);
187
+ public static WTSEnumerateProcessesExW(hServer: HANDLE, pLevel_in_out: LPDWORD, SessionId: DWORD, ppProcessInfo_out: PVOID, pCount_out: LPDWORD): BOOL {
188
+ return Wtsapi32.Load('WTSEnumerateProcessesExW')(hServer, pLevel_in_out, SessionId, ppProcessInfo_out, pCount_out);
188
189
  }
189
190
 
190
191
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumerateprocessesw
191
- public static WTSEnumerateProcessesW(hServer: HANDLE, Reserved: DWORD, Version: DWORD, ppProcessInfo: PVOID, pCount: LPDWORD): BOOL {
192
- return Wtsapi32.Load('WTSEnumerateProcessesW')(hServer, Reserved, Version, ppProcessInfo, pCount);
192
+ public static WTSEnumerateProcessesW(hServer: HANDLE, Reserved: DWORD, Version: DWORD, ppProcessInfo_out: PVOID, pCount_out: LPDWORD): BOOL {
193
+ return Wtsapi32.Load('WTSEnumerateProcessesW')(hServer, Reserved, Version, ppProcessInfo_out, pCount_out);
193
194
  }
194
195
 
195
196
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumerateserversa
196
- public static WTSEnumerateServersA(pDomainName: LPSTR | NULL, Reserved: DWORD, Version: DWORD, ppServerInfo: PVOID, pCount: LPDWORD): BOOL {
197
- return Wtsapi32.Load('WTSEnumerateServersA')(pDomainName, Reserved, Version, ppServerInfo, pCount);
197
+ public static WTSEnumerateServersA(pDomainName: NULL, Reserved: DWORD, Version: DWORD, ppServerInfo_out: PVOID, pCount_out: LPDWORD): BOOL {
198
+ return Wtsapi32.Load('WTSEnumerateServersA')(pDomainName, Reserved, Version, ppServerInfo_out, pCount_out);
198
199
  }
199
200
 
200
201
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumerateserversw
201
- public static WTSEnumerateServersW(pDomainName: LPWSTR | NULL, Reserved: DWORD, Version: DWORD, ppServerInfo: PVOID, pCount: LPDWORD): BOOL {
202
- return Wtsapi32.Load('WTSEnumerateServersW')(pDomainName, Reserved, Version, ppServerInfo, pCount);
202
+ public static WTSEnumerateServersW(pDomainName: NULL, Reserved: DWORD, Version: DWORD, ppServerInfo_out: PVOID, pCount_out: LPDWORD): BOOL {
203
+ return Wtsapi32.Load('WTSEnumerateServersW')(pDomainName, Reserved, Version, ppServerInfo_out, pCount_out);
203
204
  }
204
205
 
205
206
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumeratesessionsa
206
- public static WTSEnumerateSessionsA(hServer: HANDLE, Reserved: DWORD, Version: DWORD, ppSessionInfo: PVOID, pCount: LPDWORD): BOOL {
207
- return Wtsapi32.Load('WTSEnumerateSessionsA')(hServer, Reserved, Version, ppSessionInfo, pCount);
207
+ public static WTSEnumerateSessionsA(hServer: HANDLE, Reserved: DWORD, Version: DWORD, ppSessionInfo_out: PVOID, pCount_out: LPDWORD): BOOL {
208
+ return Wtsapi32.Load('WTSEnumerateSessionsA')(hServer, Reserved, Version, ppSessionInfo_out, pCount_out);
208
209
  }
209
210
 
210
211
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumeratesessionsexa
211
- public static WTSEnumerateSessionsExA(hServer: HANDLE, pLevel: LPDWORD, Filter: DWORD, ppSessionInfo: PVOID, pCount: LPDWORD): BOOL {
212
- return Wtsapi32.Load('WTSEnumerateSessionsExA')(hServer, pLevel, Filter, ppSessionInfo, pCount);
212
+ public static WTSEnumerateSessionsExA(hServer: HANDLE, pLevel_in_out: LPDWORD, Filter: DWORD, ppSessionInfo_out: PVOID, pCount_out: LPDWORD): BOOL {
213
+ return Wtsapi32.Load('WTSEnumerateSessionsExA')(hServer, pLevel_in_out, Filter, ppSessionInfo_out, pCount_out);
213
214
  }
214
215
 
215
216
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumeratesessionsexw
216
- public static WTSEnumerateSessionsExW(hServer: HANDLE, pLevel: LPDWORD, Filter: DWORD, ppSessionInfo: PVOID, pCount: LPDWORD): BOOL {
217
- return Wtsapi32.Load('WTSEnumerateSessionsExW')(hServer, pLevel, Filter, ppSessionInfo, pCount);
217
+ public static WTSEnumerateSessionsExW(hServer: HANDLE, pLevel_in_out: LPDWORD, Filter: DWORD, ppSessionInfo_out: PVOID, pCount_out: LPDWORD): BOOL {
218
+ return Wtsapi32.Load('WTSEnumerateSessionsExW')(hServer, pLevel_in_out, Filter, ppSessionInfo_out, pCount_out);
218
219
  }
219
220
 
220
221
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumeratesessionsw
221
- public static WTSEnumerateSessionsW(hServer: HANDLE, Reserved: DWORD, Version: DWORD, ppSessionInfo: PVOID, pCount: LPDWORD): BOOL {
222
- return Wtsapi32.Load('WTSEnumerateSessionsW')(hServer, Reserved, Version, ppSessionInfo, pCount);
222
+ public static WTSEnumerateSessionsW(hServer: HANDLE, Reserved: DWORD, Version: DWORD, ppSessionInfo_out: PVOID, pCount_out: LPDWORD): BOOL {
223
+ return Wtsapi32.Load('WTSEnumerateSessionsW')(hServer, Reserved, Version, ppSessionInfo_out, pCount_out);
223
224
  }
224
225
 
225
226
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsfreememory
@@ -238,41 +239,41 @@ class Wtsapi32 extends Win32 {
238
239
  }
239
240
 
240
241
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsgetchildsessionid
241
- public static WTSGetChildSessionId(pSessionId: PULONG): BOOL {
242
- return Wtsapi32.Load('WTSGetChildSessionId')(pSessionId);
242
+ public static WTSGetChildSessionId(pSessionId_out: PULONG): BOOL {
243
+ return Wtsapi32.Load('WTSGetChildSessionId')(pSessionId_out);
243
244
  }
244
245
 
245
246
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsgetlistenersecuritya
246
247
  public static WTSGetListenerSecurityA(
247
248
  hServer: HANDLE,
248
- pReserved: PVOID | NULL,
249
+ pReserved: NULL,
249
250
  Reserved: DWORD,
250
251
  pListenerName: LPSTR,
251
252
  SecurityInformation: SECURITY_INFORMATION,
252
- pSecurityDescriptor: PSECURITY_DESCRIPTOR | NULL,
253
+ pSecurityDescriptor_out: OPTIONAL<PSECURITY_DESCRIPTOR>,
253
254
  nLength: DWORD,
254
- lpnLengthNeeded: LPDWORD,
255
+ lpnLengthNeeded_out: LPDWORD,
255
256
  ): BOOL {
256
- return Wtsapi32.Load('WTSGetListenerSecurityA')(hServer, pReserved, Reserved, pListenerName, SecurityInformation, pSecurityDescriptor, nLength, lpnLengthNeeded);
257
+ return Wtsapi32.Load('WTSGetListenerSecurityA')(hServer, pReserved, Reserved, pListenerName, SecurityInformation, pSecurityDescriptor_out, nLength, lpnLengthNeeded_out);
257
258
  }
258
259
 
259
260
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsgetlistenersecurityw
260
261
  public static WTSGetListenerSecurityW(
261
262
  hServer: HANDLE,
262
- pReserved: PVOID | NULL,
263
+ pReserved: NULL,
263
264
  Reserved: DWORD,
264
265
  pListenerName: LPWSTR,
265
266
  SecurityInformation: SECURITY_INFORMATION,
266
- pSecurityDescriptor: PSECURITY_DESCRIPTOR | NULL,
267
+ pSecurityDescriptor_out: OPTIONAL<PSECURITY_DESCRIPTOR>,
267
268
  nLength: DWORD,
268
- lpnLengthNeeded: LPDWORD,
269
+ lpnLengthNeeded_out: LPDWORD,
269
270
  ): BOOL {
270
- return Wtsapi32.Load('WTSGetListenerSecurityW')(hServer, pReserved, Reserved, pListenerName, SecurityInformation, pSecurityDescriptor, nLength, lpnLengthNeeded);
271
+ return Wtsapi32.Load('WTSGetListenerSecurityW')(hServer, pReserved, Reserved, pListenerName, SecurityInformation, pSecurityDescriptor_out, nLength, lpnLengthNeeded_out);
271
272
  }
272
273
 
273
274
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsischildsessionsenabled
274
- public static WTSIsChildSessionsEnabled(pbEnabled: PBOOL): BOOL {
275
- return Wtsapi32.Load('WTSIsChildSessionsEnabled')(pbEnabled);
275
+ public static WTSIsChildSessionsEnabled(pbEnabled_out: PBOOL): BOOL {
276
+ return Wtsapi32.Load('WTSIsChildSessionsEnabled')(pbEnabled_out);
276
277
  }
277
278
 
278
279
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtslogoffsession
@@ -301,38 +302,38 @@ class Wtsapi32 extends Win32 {
301
302
  }
302
303
 
303
304
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsquerylistenerconfiga
304
- public static WTSQueryListenerConfigA(hServer: HANDLE, pReserved: PVOID | NULL, Reserved: DWORD, pListenerName: LPSTR, pBuffer: PWTSLISTENERCONFIGA): BOOL {
305
- return Wtsapi32.Load('WTSQueryListenerConfigA')(hServer, pReserved, Reserved, pListenerName, pBuffer);
305
+ public static WTSQueryListenerConfigA(hServer: HANDLE, pReserved: NULL, Reserved: DWORD, pListenerName: LPSTR, pBuffer_out: PWTSLISTENERCONFIGA): BOOL {
306
+ return Wtsapi32.Load('WTSQueryListenerConfigA')(hServer, pReserved, Reserved, pListenerName, pBuffer_out);
306
307
  }
307
308
 
308
309
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsquerylistenerconfigw
309
- public static WTSQueryListenerConfigW(hServer: HANDLE, pReserved: PVOID | NULL, Reserved: DWORD, pListenerName: LPWSTR, pBuffer: PWTSLISTENERCONFIGW): BOOL {
310
- return Wtsapi32.Load('WTSQueryListenerConfigW')(hServer, pReserved, Reserved, pListenerName, pBuffer);
310
+ public static WTSQueryListenerConfigW(hServer: HANDLE, pReserved: NULL, Reserved: DWORD, pListenerName: LPWSTR, pBuffer_out: PWTSLISTENERCONFIGW): BOOL {
311
+ return Wtsapi32.Load('WTSQueryListenerConfigW')(hServer, pReserved, Reserved, pListenerName, pBuffer_out);
311
312
  }
312
313
 
313
314
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsquerysessioninformationa
314
- public static WTSQuerySessionInformationA(hServer: HANDLE, SessionId: DWORD, WTSInfoClass: WTS_INFO_CLASS, ppBuffer: PVOID, pBytesReturned: LPDWORD): BOOL {
315
- return Wtsapi32.Load('WTSQuerySessionInformationA')(hServer, SessionId, WTSInfoClass, ppBuffer, pBytesReturned);
315
+ public static WTSQuerySessionInformationA(hServer: HANDLE, SessionId: DWORD, WTSInfoClass: WTS_INFO_CLASS, ppBuffer_out: PVOID, pBytesReturned_out: LPDWORD): BOOL {
316
+ return Wtsapi32.Load('WTSQuerySessionInformationA')(hServer, SessionId, WTSInfoClass, ppBuffer_out, pBytesReturned_out);
316
317
  }
317
318
 
318
319
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsquerysessioninformationw
319
- public static WTSQuerySessionInformationW(hServer: HANDLE, SessionId: DWORD, WTSInfoClass: WTS_INFO_CLASS, ppBuffer: PVOID, pBytesReturned: LPDWORD): BOOL {
320
- return Wtsapi32.Load('WTSQuerySessionInformationW')(hServer, SessionId, WTSInfoClass, ppBuffer, pBytesReturned);
320
+ public static WTSQuerySessionInformationW(hServer: HANDLE, SessionId: DWORD, WTSInfoClass: WTS_INFO_CLASS, ppBuffer_out: PVOID, pBytesReturned_out: LPDWORD): BOOL {
321
+ return Wtsapi32.Load('WTSQuerySessionInformationW')(hServer, SessionId, WTSInfoClass, ppBuffer_out, pBytesReturned_out);
321
322
  }
322
323
 
323
324
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsqueryuserconfiga
324
- public static WTSQueryUserConfigA(pServerName: LPSTR, pUserName: LPSTR, WTSConfigClass: WTS_CONFIG_CLASS, ppBuffer: PVOID, pBytesReturned: LPDWORD): BOOL {
325
- return Wtsapi32.Load('WTSQueryUserConfigA')(pServerName, pUserName, WTSConfigClass, ppBuffer, pBytesReturned);
325
+ public static WTSQueryUserConfigA(pServerName: NULL, pUserName: LPSTR, WTSConfigClass: WTS_CONFIG_CLASS, ppBuffer_out: PVOID, pBytesReturned_out: LPDWORD): BOOL {
326
+ return Wtsapi32.Load('WTSQueryUserConfigA')(pServerName, pUserName, WTSConfigClass, ppBuffer_out, pBytesReturned_out);
326
327
  }
327
328
 
328
329
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsqueryuserconfigw
329
- public static WTSQueryUserConfigW(pServerName: LPWSTR, pUserName: LPWSTR, WTSConfigClass: WTS_CONFIG_CLASS, ppBuffer: PVOID, pBytesReturned: LPDWORD): BOOL {
330
- return Wtsapi32.Load('WTSQueryUserConfigW')(pServerName, pUserName, WTSConfigClass, ppBuffer, pBytesReturned);
330
+ public static WTSQueryUserConfigW(pServerName: NULL, pUserName: LPWSTR, WTSConfigClass: WTS_CONFIG_CLASS, ppBuffer_out: PVOID, pBytesReturned_out: LPDWORD): BOOL {
331
+ return Wtsapi32.Load('WTSQueryUserConfigW')(pServerName, pUserName, WTSConfigClass, ppBuffer_out, pBytesReturned_out);
331
332
  }
332
333
 
333
334
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsqueryusertoken
334
- public static WTSQueryUserToken(SessionId: ULONG, phToken: PHANDLE): BOOL {
335
- return Wtsapi32.Load('WTSQueryUserToken')(SessionId, phToken);
335
+ public static WTSQueryUserToken(SessionId: ULONG, phToken_out: PHANDLE): BOOL {
336
+ return Wtsapi32.Load('WTSQueryUserToken')(SessionId, phToken_out);
336
337
  }
337
338
 
338
339
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsregistersessionnotification
@@ -346,28 +347,28 @@ class Wtsapi32 extends Win32 {
346
347
  }
347
348
 
348
349
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtssendmessagea
349
- public static WTSSendMessageA(hServer: HANDLE, SessionId: DWORD, pTitle: LPSTR, TitleLength: DWORD, pMessage: LPSTR, MessageLength: DWORD, Style: DWORD, Timeout: DWORD, pResponse: LPDWORD, bWait: BOOL): BOOL {
350
- return Wtsapi32.Load('WTSSendMessageA')(hServer, SessionId, pTitle, TitleLength, pMessage, MessageLength, Style, Timeout, pResponse, bWait);
350
+ public static WTSSendMessageA(hServer: HANDLE, SessionId: DWORD, pTitle: LPSTR, TitleLength: DWORD, pMessage: LPSTR, MessageLength: DWORD, Style: DWORD, Timeout: DWORD, pResponse_out: LPDWORD, bWait: BOOL): BOOL {
351
+ return Wtsapi32.Load('WTSSendMessageA')(hServer, SessionId, pTitle, TitleLength, pMessage, MessageLength, Style, Timeout, pResponse_out, bWait);
351
352
  }
352
353
 
353
354
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtssendmessagew
354
- public static WTSSendMessageW(hServer: HANDLE, SessionId: DWORD, pTitle: LPWSTR, TitleLength: DWORD, pMessage: LPWSTR, MessageLength: DWORD, Style: DWORD, Timeout: DWORD, pResponse: LPDWORD, bWait: BOOL): BOOL {
355
- return Wtsapi32.Load('WTSSendMessageW')(hServer, SessionId, pTitle, TitleLength, pMessage, MessageLength, Style, Timeout, pResponse, bWait);
355
+ public static WTSSendMessageW(hServer: HANDLE, SessionId: DWORD, pTitle: LPWSTR, TitleLength: DWORD, pMessage: LPWSTR, MessageLength: DWORD, Style: DWORD, Timeout: DWORD, pResponse_out: LPDWORD, bWait: BOOL): BOOL {
356
+ return Wtsapi32.Load('WTSSendMessageW')(hServer, SessionId, pTitle, TitleLength, pMessage, MessageLength, Style, Timeout, pResponse_out, bWait);
356
357
  }
357
358
 
358
359
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtssetlistenersecuritya
359
- public static WTSSetListenerSecurityA(hServer: HANDLE, pReserved: PVOID | NULL, Reserved: DWORD, pListenerName: LPSTR, SecurityInformation: SECURITY_INFORMATION, pSecurityDescriptor: PSECURITY_DESCRIPTOR): BOOL {
360
+ public static WTSSetListenerSecurityA(hServer: HANDLE, pReserved: NULL, Reserved: DWORD, pListenerName: LPSTR, SecurityInformation: SECURITY_INFORMATION, pSecurityDescriptor: PSECURITY_DESCRIPTOR): BOOL {
360
361
  return Wtsapi32.Load('WTSSetListenerSecurityA')(hServer, pReserved, Reserved, pListenerName, SecurityInformation, pSecurityDescriptor);
361
362
  }
362
363
 
363
364
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtssetlistenersecurityw
364
- public static WTSSetListenerSecurityW(hServer: HANDLE, pReserved: PVOID | NULL, Reserved: DWORD, pListenerName: LPWSTR, SecurityInformation: SECURITY_INFORMATION, pSecurityDescriptor: PSECURITY_DESCRIPTOR): BOOL {
365
+ public static WTSSetListenerSecurityW(hServer: HANDLE, pReserved: NULL, Reserved: DWORD, pListenerName: LPWSTR, SecurityInformation: SECURITY_INFORMATION, pSecurityDescriptor: PSECURITY_DESCRIPTOR): BOOL {
365
366
  return Wtsapi32.Load('WTSSetListenerSecurityW')(hServer, pReserved, Reserved, pListenerName, SecurityInformation, pSecurityDescriptor);
366
367
  }
367
368
 
368
369
  // https://learn.microsoft.com/en-us/windows/win32/api/wtshintapi/nf-wtshintapi-wtssetrenderhint
369
- public static WTSSetRenderHint(pRenderHintID: PVOID, hwndOwner: HWND, renderHintType: DWORD, cbHintDataLength: DWORD, pHintData: PBYTE | NULL): HRESULT {
370
- return Wtsapi32.Load('WTSSetRenderHint')(pRenderHintID, hwndOwner, renderHintType, cbHintDataLength, pHintData);
370
+ public static WTSSetRenderHint(pRenderHintID_in_out: PVOID, hwndOwner: HWND, renderHintType: DWORD, cbHintDataLength: DWORD, pHintData: OPTIONAL<PBYTE>): HRESULT {
371
+ return Wtsapi32.Load('WTSSetRenderHint')(pRenderHintID_in_out, hwndOwner, renderHintType, cbHintDataLength, pHintData);
371
372
  }
372
373
 
373
374
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtssetsessioninformationa
@@ -381,12 +382,12 @@ class Wtsapi32 extends Win32 {
381
382
  }
382
383
 
383
384
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtssetuserconfiga
384
- public static WTSSetUserConfigA(pServerName: LPSTR, pUserName: LPSTR, WTSConfigClass: WTS_CONFIG_CLASS, pBuffer: LPSTR, DataLength: DWORD): BOOL {
385
+ public static WTSSetUserConfigA(pServerName: NULL, pUserName: LPSTR, WTSConfigClass: WTS_CONFIG_CLASS, pBuffer: LPSTR, DataLength: DWORD): BOOL {
385
386
  return Wtsapi32.Load('WTSSetUserConfigA')(pServerName, pUserName, WTSConfigClass, pBuffer, DataLength);
386
387
  }
387
388
 
388
389
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtssetuserconfigw
389
- public static WTSSetUserConfigW(pServerName: LPWSTR, pUserName: LPWSTR, WTSConfigClass: WTS_CONFIG_CLASS, pBuffer: LPWSTR, DataLength: DWORD): BOOL {
390
+ public static WTSSetUserConfigW(pServerName: NULL, pUserName: LPWSTR, WTSConfigClass: WTS_CONFIG_CLASS, pBuffer: LPWSTR, DataLength: DWORD): BOOL {
390
391
  return Wtsapi32.Load('WTSSetUserConfigW')(pServerName, pUserName, WTSConfigClass, pBuffer, DataLength);
391
392
  }
392
393
 
@@ -451,23 +452,23 @@ class Wtsapi32 extends Win32 {
451
452
  }
452
453
 
453
454
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsvirtualchannelquery
454
- public static WTSVirtualChannelQuery(hChannelHandle: HANDLE, WTSVirtualClass: WTS_VIRTUAL_CLASS, ppBuffer: PVOID, pBytesReturned: LPDWORD): BOOL {
455
- return Wtsapi32.Load('WTSVirtualChannelQuery')(hChannelHandle, WTSVirtualClass, ppBuffer, pBytesReturned);
455
+ public static WTSVirtualChannelQuery(hChannelHandle: HANDLE, WTSVirtualClass: WTS_VIRTUAL_CLASS, ppBuffer_out: PVOID, pBytesReturned_out: LPDWORD): BOOL {
456
+ return Wtsapi32.Load('WTSVirtualChannelQuery')(hChannelHandle, WTSVirtualClass, ppBuffer_out, pBytesReturned_out);
456
457
  }
457
458
 
458
459
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsvirtualchannelread
459
- public static WTSVirtualChannelRead(hChannelHandle: HANDLE, TimeOut: ULONG, Buffer: PCHAR, BufferSize: ULONG, pBytesRead: PULONG): BOOL {
460
- return Wtsapi32.Load('WTSVirtualChannelRead')(hChannelHandle, TimeOut, Buffer, BufferSize, pBytesRead);
460
+ public static WTSVirtualChannelRead(hChannelHandle: HANDLE, TimeOut: ULONG, Buffer_out: PCHAR, BufferSize: ULONG, pBytesRead_out: PULONG): BOOL {
461
+ return Wtsapi32.Load('WTSVirtualChannelRead')(hChannelHandle, TimeOut, Buffer_out, BufferSize, pBytesRead_out);
461
462
  }
462
463
 
463
464
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsvirtualchannelwrite
464
- public static WTSVirtualChannelWrite(hChannelHandle: HANDLE, Buffer: PCHAR, Length: ULONG, pBytesWritten: PULONG): BOOL {
465
- return Wtsapi32.Load('WTSVirtualChannelWrite')(hChannelHandle, Buffer, Length, pBytesWritten);
465
+ public static WTSVirtualChannelWrite(hChannelHandle: HANDLE, Buffer: PCHAR, Length: ULONG, pBytesWritten_out: PULONG): BOOL {
466
+ return Wtsapi32.Load('WTSVirtualChannelWrite')(hChannelHandle, Buffer, Length, pBytesWritten_out);
466
467
  }
467
468
 
468
469
  // https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtswaitsystemevent
469
- public static WTSWaitSystemEvent(hServer: HANDLE, EventMask: DWORD, pEventFlags: LPDWORD): BOOL {
470
- return Wtsapi32.Load('WTSWaitSystemEvent')(hServer, EventMask, pEventFlags);
470
+ public static WTSWaitSystemEvent(hServer: HANDLE, EventMask: DWORD, pEventFlags_out: LPDWORD): BOOL {
471
+ return Wtsapi32.Load('WTSWaitSystemEvent')(hServer, EventMask, pEventFlags_out);
471
472
  }
472
473
  }
473
474
 
package/types/Wtsapi32.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Pointer } from 'bun:ffi';
2
2
 
3
3
  import type { DWORD, HANDLE } from '@bun-win32/core';
4
- export type { BOOL, BYTE, DWORD, HANDLE, HRESULT, HWND, LPDWORD, LPSTR, LPWSTR, NULL, PBYTE, PHANDLE, PULONG, PVOID, ULONG, USHORT } from '@bun-win32/core';
4
+ export type { BOOL, BYTE, DWORD, HANDLE, HRESULT, HWND, LPDWORD, LPSTR, LPWSTR, NULL, OPTIONAL, PBYTE, PHANDLE, PULONG, PVOID, ULONG, USHORT } from '@bun-win32/core';
5
5
 
6
6
  export const WTS_ANY_SESSION: DWORD = 0xffff_fffe;
7
7
  export const WTS_CHANNEL_OPTION_DYNAMIC: DWORD = 0x0000_0001;