Kitxuuu commited on
Commit
ff6b910
·
verified ·
1 Parent(s): 68fe942

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. local-test-freerdp-delta-01/afc-freerdp/libfreerdp/cache/bitmap.c +617 -0
  2. local-test-freerdp-delta-01/afc-freerdp/libfreerdp/cache/brush.h +57 -0
  3. local-test-freerdp-delta-01/afc-freerdp/libfreerdp/cache/cache.c +152 -0
  4. local-test-freerdp-delta-01/afc-freerdp/libfreerdp/cache/cache.h +73 -0
  5. local-test-freerdp-delta-01/afc-freerdp/libfreerdp/cache/persistent.c +376 -0
  6. local-test-freerdp-delta-01/afc-freerdp/libfreerdp/common/assistance.c +1503 -0
  7. local-test-freerdp-delta-01/afc-freerdp/libfreerdp/common/settings_str.h +629 -0
  8. local-test-freerdp-delta-01/afc-freerdp/libfreerdp/core/security.c +1002 -0
  9. local-test-freerdp-delta-01/afc-freerdp/libfreerdp/utils/drdynvc.c +50 -0
  10. local-test-freerdp-delta-01/afc-freerdp/libfreerdp/utils/helpers.c +61 -0
  11. local-test-sqlite3-delta-02/afc-sqlite3/ext/jni/src/c/sqlite3-jni.h +2461 -0
  12. local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/SQLTester/index.html +125 -0
  13. local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/SQLTester/touint8array.c +29 -0
  14. local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/api/post-js-header.js +28 -0
  15. local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js +1457 -0
  16. local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js +346 -0
  17. local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/common/SqliteTestUtil.js +235 -0
  18. local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/common/testing.css +102 -0
  19. local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/fiddle/fiddle.js +822 -0
  20. local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/tests/opfs/concurrency/index.html +52 -0
local-test-freerdp-delta-01/afc-freerdp/libfreerdp/cache/bitmap.c ADDED
@@ -0,0 +1,617 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * FreeRDP: A Remote Desktop Protocol Implementation
3
+ * Bitmap Cache V2
4
+ *
5
+ * Copyright 2011 Marc-Andre Moreau <[email protected]>
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ #include <freerdp/config.h>
21
+
22
+ #include <stdio.h>
23
+
24
+ #include <winpr/crt.h>
25
+ #include <winpr/assert.h>
26
+ #include <winpr/cast.h>
27
+
28
+ #include <freerdp/freerdp.h>
29
+ #include <freerdp/constants.h>
30
+ #include <winpr/stream.h>
31
+
32
+ #include <freerdp/log.h>
33
+ #include <freerdp/gdi/bitmap.h>
34
+
35
+ #include "../gdi/gdi.h"
36
+ #include "../core/graphics.h"
37
+
38
+ #include "bitmap.h"
39
+ #include "cache.h"
40
+
41
+ #define TAG FREERDP_TAG("cache.bitmap")
42
+
43
+ static rdpBitmap* bitmap_cache_get(rdpBitmapCache* bitmapCache, UINT32 id, UINT32 index);
44
+ static BOOL bitmap_cache_put(rdpBitmapCache* bitmapCache, UINT32 id, UINT32 index,
45
+ rdpBitmap* bitmap);
46
+
47
+ static BOOL update_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
48
+ {
49
+ rdpBitmap* bitmap = NULL;
50
+ rdpCache* cache = NULL;
51
+
52
+ cache = context->cache;
53
+
54
+ if (memblt->cacheId == 0xFF)
55
+ bitmap = offscreen_cache_get(cache->offscreen, memblt->cacheIndex);
56
+ else
57
+ bitmap = bitmap_cache_get(cache->bitmap, (BYTE)memblt->cacheId, memblt->cacheIndex);
58
+
59
+ /* XP-SP2 servers sometimes ask for cached bitmaps they've never defined. */
60
+ if (bitmap == NULL)
61
+ return TRUE;
62
+
63
+ memblt->bitmap = bitmap;
64
+ return IFCALLRESULT(TRUE, cache->bitmap->MemBlt, context, memblt);
65
+ }
66
+
67
+ static BOOL update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
68
+ {
69
+ rdpBitmap* bitmap = NULL;
70
+ rdpCache* cache = context->cache;
71
+ rdpBrush* brush = &mem3blt->brush;
72
+ BOOL ret = TRUE;
73
+
74
+ if (mem3blt->cacheId == 0xFF)
75
+ bitmap = offscreen_cache_get(cache->offscreen, mem3blt->cacheIndex);
76
+ else
77
+ bitmap = bitmap_cache_get(cache->bitmap, (BYTE)mem3blt->cacheId, mem3blt->cacheIndex);
78
+
79
+ /* XP-SP2 servers sometimes ask for cached bitmaps they've never defined. */
80
+ if (!bitmap)
81
+ return TRUE;
82
+
83
+ const BYTE style = WINPR_ASSERTING_INT_CAST(UINT8, brush->style);
84
+
85
+ if (brush->style & CACHED_BRUSH)
86
+ {
87
+ brush->data = brush_cache_get(cache->brush, brush->index, &brush->bpp);
88
+
89
+ if (!brush->data)
90
+ return FALSE;
91
+
92
+ brush->style = 0x03;
93
+ }
94
+
95
+ mem3blt->bitmap = bitmap;
96
+ IFCALLRET(cache->bitmap->Mem3Blt, ret, context, mem3blt);
97
+ brush->style = style;
98
+ return ret;
99
+ }
100
+
101
+ static BOOL update_gdi_cache_bitmap(rdpContext* context, const CACHE_BITMAP_ORDER* cacheBitmap)
102
+ {
103
+ rdpBitmap* bitmap = NULL;
104
+ rdpBitmap* prevBitmap = NULL;
105
+ rdpCache* cache = context->cache;
106
+ bitmap = Bitmap_Alloc(context);
107
+
108
+ if (!bitmap)
109
+ return FALSE;
110
+
111
+ if (!Bitmap_SetDimensions(bitmap, WINPR_ASSERTING_INT_CAST(UINT16, cacheBitmap->bitmapWidth),
112
+ WINPR_ASSERTING_INT_CAST(UINT16, cacheBitmap->bitmapHeight)))
113
+ goto fail;
114
+
115
+ if (!bitmap->Decompress(context, bitmap, cacheBitmap->bitmapDataStream,
116
+ cacheBitmap->bitmapWidth, cacheBitmap->bitmapHeight,
117
+ cacheBitmap->bitmapBpp, cacheBitmap->bitmapLength,
118
+ cacheBitmap->compressed, RDP_CODEC_ID_NONE))
119
+ goto fail;
120
+
121
+ if (!bitmap->New(context, bitmap))
122
+ goto fail;
123
+
124
+ prevBitmap = bitmap_cache_get(cache->bitmap, cacheBitmap->cacheId, cacheBitmap->cacheIndex);
125
+ Bitmap_Free(context, prevBitmap);
126
+ return bitmap_cache_put(cache->bitmap, cacheBitmap->cacheId, cacheBitmap->cacheIndex, bitmap);
127
+
128
+ fail:
129
+ Bitmap_Free(context, bitmap);
130
+ return FALSE;
131
+ }
132
+
133
+ static BOOL update_gdi_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cacheBitmapV2)
134
+
135
+ {
136
+ rdpBitmap* prevBitmap = NULL;
137
+ rdpCache* cache = context->cache;
138
+ rdpSettings* settings = context->settings;
139
+ rdpBitmap* bitmap = Bitmap_Alloc(context);
140
+
141
+ if (!bitmap)
142
+ return FALSE;
143
+
144
+ const UINT32 ColorDepth = freerdp_settings_get_uint32(settings, FreeRDP_ColorDepth);
145
+ bitmap->key64 = ((UINT64)cacheBitmapV2->key1 | (((UINT64)cacheBitmapV2->key2) << 32));
146
+
147
+ if (!cacheBitmapV2->bitmapBpp)
148
+ cacheBitmapV2->bitmapBpp = ColorDepth;
149
+
150
+ if ((ColorDepth == 15) && (cacheBitmapV2->bitmapBpp == 16))
151
+ cacheBitmapV2->bitmapBpp = ColorDepth;
152
+
153
+ if (!Bitmap_SetDimensions(bitmap, WINPR_ASSERTING_INT_CAST(UINT16, cacheBitmapV2->bitmapWidth),
154
+ WINPR_ASSERTING_INT_CAST(UINT16, cacheBitmapV2->bitmapHeight)))
155
+ goto fail;
156
+
157
+ if (!bitmap->Decompress(context, bitmap, cacheBitmapV2->bitmapDataStream,
158
+ cacheBitmapV2->bitmapWidth, cacheBitmapV2->bitmapHeight,
159
+ cacheBitmapV2->bitmapBpp, cacheBitmapV2->bitmapLength,
160
+ cacheBitmapV2->compressed, RDP_CODEC_ID_NONE))
161
+ goto fail;
162
+
163
+ prevBitmap = bitmap_cache_get(cache->bitmap, cacheBitmapV2->cacheId, cacheBitmapV2->cacheIndex);
164
+
165
+ if (!bitmap->New(context, bitmap))
166
+ goto fail;
167
+
168
+ Bitmap_Free(context, prevBitmap);
169
+ return bitmap_cache_put(cache->bitmap, cacheBitmapV2->cacheId, cacheBitmapV2->cacheIndex,
170
+ bitmap);
171
+
172
+ fail:
173
+ Bitmap_Free(context, bitmap);
174
+ return FALSE;
175
+ }
176
+
177
+ static BOOL update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cacheBitmapV3)
178
+ {
179
+ rdpBitmap* bitmap = NULL;
180
+ rdpBitmap* prevBitmap = NULL;
181
+ BOOL compressed = TRUE;
182
+ rdpCache* cache = context->cache;
183
+ rdpSettings* settings = context->settings;
184
+ BITMAP_DATA_EX* bitmapData = &cacheBitmapV3->bitmapData;
185
+ bitmap = Bitmap_Alloc(context);
186
+
187
+ if (!bitmap)
188
+ return FALSE;
189
+
190
+ const UINT32 ColorDepth = freerdp_settings_get_uint32(settings, FreeRDP_ColorDepth);
191
+ bitmap->key64 = ((UINT64)cacheBitmapV3->key1 | (((UINT64)cacheBitmapV3->key2) << 32));
192
+
193
+ if (!cacheBitmapV3->bpp)
194
+ cacheBitmapV3->bpp = ColorDepth;
195
+
196
+ compressed = (bitmapData->codecID != RDP_CODEC_ID_NONE);
197
+
198
+ if (!Bitmap_SetDimensions(bitmap, WINPR_ASSERTING_INT_CAST(UINT16, bitmapData->width),
199
+ WINPR_ASSERTING_INT_CAST(UINT16, bitmapData->height)))
200
+ goto fail;
201
+
202
+ if (!bitmap->Decompress(context, bitmap, bitmapData->data, bitmapData->width,
203
+ bitmapData->height, bitmapData->bpp, bitmapData->length, compressed,
204
+ bitmapData->codecID))
205
+ goto fail;
206
+
207
+ if (!bitmap->New(context, bitmap))
208
+ goto fail;
209
+
210
+ prevBitmap = bitmap_cache_get(cache->bitmap, cacheBitmapV3->cacheId, cacheBitmapV3->cacheIndex);
211
+ Bitmap_Free(context, prevBitmap);
212
+ return bitmap_cache_put(cache->bitmap, cacheBitmapV3->cacheId, cacheBitmapV3->cacheIndex,
213
+ bitmap);
214
+
215
+ fail:
216
+ Bitmap_Free(context, bitmap);
217
+ return FALSE;
218
+ }
219
+
220
+ rdpBitmap* bitmap_cache_get(rdpBitmapCache* bitmapCache, UINT32 id, UINT32 index)
221
+ {
222
+ rdpBitmap* bitmap = NULL;
223
+
224
+ if (id >= bitmapCache->maxCells)
225
+ {
226
+ WLog_ERR(TAG, "get invalid bitmap cell id: %" PRIu32 "", id);
227
+ return NULL;
228
+ }
229
+
230
+ if (index == BITMAP_CACHE_WAITING_LIST_INDEX)
231
+ {
232
+ index = bitmapCache->cells[id].number;
233
+ }
234
+ else if (index > bitmapCache->cells[id].number)
235
+ {
236
+ WLog_ERR(TAG, "get invalid bitmap index %" PRIu32 " in cell id: %" PRIu32 "", index, id);
237
+ return NULL;
238
+ }
239
+
240
+ bitmap = bitmapCache->cells[id].entries[index];
241
+ return bitmap;
242
+ }
243
+
244
+ BOOL bitmap_cache_put(rdpBitmapCache* bitmapCache, UINT32 id, UINT32 index, rdpBitmap* bitmap)
245
+ {
246
+ if (id > bitmapCache->maxCells)
247
+ {
248
+ WLog_ERR(TAG, "put invalid bitmap cell id: %" PRIu32 "", id);
249
+ return FALSE;
250
+ }
251
+
252
+ if (index == BITMAP_CACHE_WAITING_LIST_INDEX)
253
+ {
254
+ index = bitmapCache->cells[id].number;
255
+ }
256
+ else if (index > bitmapCache->cells[id].number)
257
+ {
258
+ WLog_ERR(TAG, "put invalid bitmap index %" PRIu32 " in cell id: %" PRIu32 "", index, id);
259
+ return FALSE;
260
+ }
261
+
262
+ bitmapCache->cells[id].entries[index] = bitmap;
263
+ return TRUE;
264
+ }
265
+
266
+ void bitmap_cache_register_callbacks(rdpUpdate* update)
267
+ {
268
+ rdpCache* cache = NULL;
269
+
270
+ WINPR_ASSERT(update);
271
+ WINPR_ASSERT(update->context);
272
+ WINPR_ASSERT(update->context->cache);
273
+
274
+ cache = update->context->cache;
275
+ WINPR_ASSERT(cache);
276
+
277
+ if (!freerdp_settings_get_bool(update->context->settings, FreeRDP_DeactivateClientDecoding))
278
+ {
279
+ cache->bitmap->MemBlt = update->primary->MemBlt;
280
+ cache->bitmap->Mem3Blt = update->primary->Mem3Blt;
281
+ update->primary->MemBlt = update_gdi_memblt;
282
+ update->primary->Mem3Blt = update_gdi_mem3blt;
283
+ update->secondary->CacheBitmap = update_gdi_cache_bitmap;
284
+ update->secondary->CacheBitmapV2 = update_gdi_cache_bitmap_v2;
285
+ update->secondary->CacheBitmapV3 = update_gdi_cache_bitmap_v3;
286
+ update->BitmapUpdate = gdi_bitmap_update;
287
+ }
288
+ }
289
+
290
+ static int bitmap_cache_save_persistent(rdpBitmapCache* bitmapCache)
291
+ {
292
+ rdpContext* context = bitmapCache->context;
293
+ rdpSettings* settings = context->settings;
294
+
295
+ const UINT32 version = freerdp_settings_get_uint32(settings, FreeRDP_BitmapCacheVersion);
296
+
297
+ if (version != 2)
298
+ return 0; /* persistent bitmap cache already saved in egfx channel */
299
+
300
+ if (!freerdp_settings_get_bool(settings, FreeRDP_BitmapCachePersistEnabled))
301
+ return 0;
302
+
303
+ const char* BitmapCachePersistFile =
304
+ freerdp_settings_get_string(settings, FreeRDP_BitmapCachePersistFile);
305
+ if (!BitmapCachePersistFile)
306
+ return 0;
307
+
308
+ rdpPersistentCache* persistent = persistent_cache_new();
309
+
310
+ if (!persistent)
311
+ return -1;
312
+
313
+ int status = persistent_cache_open(persistent, BitmapCachePersistFile, TRUE, version);
314
+
315
+ if (status < 1)
316
+ goto end;
317
+
318
+ if (bitmapCache->cells)
319
+ {
320
+ for (UINT32 i = 0; i < bitmapCache->maxCells; i++)
321
+ {
322
+ BITMAP_V2_CELL* cell = &bitmapCache->cells[i];
323
+ for (UINT32 j = 0; j < cell->number + 1 && cell->entries; j++)
324
+ {
325
+ PERSISTENT_CACHE_ENTRY cacheEntry = { 0 };
326
+ rdpBitmap* bitmap = cell->entries[j];
327
+
328
+ if (!bitmap || !bitmap->key64)
329
+ continue;
330
+
331
+ cacheEntry.key64 = bitmap->key64;
332
+
333
+ cacheEntry.width = WINPR_ASSERTING_INT_CAST(UINT16, bitmap->width);
334
+ cacheEntry.height = WINPR_ASSERTING_INT_CAST(UINT16, bitmap->height);
335
+ const UINT64 size = 4ULL * bitmap->width * bitmap->height;
336
+ if (size > UINT32_MAX)
337
+ continue;
338
+ cacheEntry.size = (UINT32)size;
339
+ cacheEntry.flags = 0;
340
+ cacheEntry.data = bitmap->data;
341
+
342
+ if (persistent_cache_write_entry(persistent, &cacheEntry) < 1)
343
+ {
344
+ status = -1;
345
+ goto end;
346
+ }
347
+ }
348
+ }
349
+ }
350
+
351
+ status = 1;
352
+
353
+ end:
354
+ persistent_cache_free(persistent);
355
+ return status;
356
+ }
357
+
358
+ rdpBitmapCache* bitmap_cache_new(rdpContext* context)
359
+ {
360
+ rdpSettings* settings = NULL;
361
+ rdpBitmapCache* bitmapCache = NULL;
362
+
363
+ WINPR_ASSERT(context);
364
+
365
+ settings = context->settings;
366
+ WINPR_ASSERT(settings);
367
+
368
+ bitmapCache = (rdpBitmapCache*)calloc(1, sizeof(rdpBitmapCache));
369
+
370
+ if (!bitmapCache)
371
+ return NULL;
372
+
373
+ const UINT32 BitmapCacheV2NumCells =
374
+ freerdp_settings_get_uint32(settings, FreeRDP_BitmapCacheV2NumCells);
375
+ bitmapCache->context = context;
376
+ bitmapCache->cells = (BITMAP_V2_CELL*)calloc(BitmapCacheV2NumCells, sizeof(BITMAP_V2_CELL));
377
+
378
+ if (!bitmapCache->cells)
379
+ goto fail;
380
+ bitmapCache->maxCells = BitmapCacheV2NumCells;
381
+
382
+ for (UINT32 i = 0; i < bitmapCache->maxCells; i++)
383
+ {
384
+ const BITMAP_CACHE_V2_CELL_INFO* info =
385
+ freerdp_settings_get_pointer_array(settings, FreeRDP_BitmapCacheV2CellInfo, i);
386
+ BITMAP_V2_CELL* cell = &bitmapCache->cells[i];
387
+ UINT32 nr = info->numEntries;
388
+ /* allocate an extra entry for BITMAP_CACHE_WAITING_LIST_INDEX */
389
+ cell->entries = (rdpBitmap**)calloc((nr + 1), sizeof(rdpBitmap*));
390
+
391
+ if (!cell->entries)
392
+ goto fail;
393
+ cell->number = nr;
394
+ }
395
+
396
+ return bitmapCache;
397
+ fail:
398
+ WINPR_PRAGMA_DIAG_PUSH
399
+ WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
400
+ bitmap_cache_free(bitmapCache);
401
+ WINPR_PRAGMA_DIAG_POP
402
+ return NULL;
403
+ }
404
+
405
+ void bitmap_cache_free(rdpBitmapCache* bitmapCache)
406
+ {
407
+ if (!bitmapCache)
408
+ return;
409
+
410
+ bitmap_cache_save_persistent(bitmapCache);
411
+
412
+ if (bitmapCache->cells)
413
+ {
414
+ for (UINT32 i = 0; i < bitmapCache->maxCells; i++)
415
+ {
416
+ UINT32 j = 0;
417
+ BITMAP_V2_CELL* cell = &bitmapCache->cells[i];
418
+
419
+ if (!cell->entries)
420
+ continue;
421
+
422
+ for (j = 0; j < cell->number + 1; j++)
423
+ {
424
+ rdpBitmap* bitmap = cell->entries[j];
425
+ Bitmap_Free(bitmapCache->context, bitmap);
426
+ }
427
+
428
+ free((void*)cell->entries);
429
+ }
430
+
431
+ free(bitmapCache->cells);
432
+ }
433
+
434
+ persistent_cache_free(bitmapCache->persistent);
435
+
436
+ free(bitmapCache);
437
+ }
438
+
439
+ static void free_bitmap_data(BITMAP_DATA* data, size_t count)
440
+ {
441
+ if (!data)
442
+ return;
443
+
444
+ for (size_t x = 0; x < count; x++)
445
+ free(data[x].bitmapDataStream);
446
+
447
+ free(data);
448
+ }
449
+
450
+ static BITMAP_DATA* copy_bitmap_data(const BITMAP_DATA* data, size_t count)
451
+ {
452
+ BITMAP_DATA* dst = (BITMAP_DATA*)calloc(count, sizeof(BITMAP_DATA));
453
+
454
+ if (!dst)
455
+ goto fail;
456
+
457
+ for (size_t x = 0; x < count; x++)
458
+ {
459
+ dst[x] = data[x];
460
+
461
+ if (data[x].bitmapLength > 0)
462
+ {
463
+ dst[x].bitmapDataStream = malloc(data[x].bitmapLength);
464
+
465
+ if (!dst[x].bitmapDataStream)
466
+ goto fail;
467
+
468
+ memcpy(dst[x].bitmapDataStream, data[x].bitmapDataStream, data[x].bitmapLength);
469
+ }
470
+ }
471
+
472
+ return dst;
473
+ fail:
474
+ free_bitmap_data(dst, count);
475
+ return NULL;
476
+ }
477
+
478
+ void free_bitmap_update(rdpContext* context, BITMAP_UPDATE* pointer)
479
+ {
480
+ if (!pointer)
481
+ return;
482
+
483
+ free_bitmap_data(pointer->rectangles, pointer->number);
484
+ free(pointer);
485
+ }
486
+
487
+ BITMAP_UPDATE* copy_bitmap_update(rdpContext* context, const BITMAP_UPDATE* pointer)
488
+ {
489
+ BITMAP_UPDATE* dst = calloc(1, sizeof(BITMAP_UPDATE));
490
+
491
+ if (!dst || !pointer)
492
+ goto fail;
493
+
494
+ *dst = *pointer;
495
+ dst->rectangles = copy_bitmap_data(pointer->rectangles, pointer->number);
496
+
497
+ if (!dst->rectangles)
498
+ goto fail;
499
+
500
+ return dst;
501
+ fail:
502
+ WINPR_PRAGMA_DIAG_PUSH
503
+ WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
504
+ free_bitmap_update(context, dst);
505
+ WINPR_PRAGMA_DIAG_POP
506
+ return NULL;
507
+ }
508
+
509
+ CACHE_BITMAP_ORDER* copy_cache_bitmap_order(rdpContext* context, const CACHE_BITMAP_ORDER* order)
510
+ {
511
+ CACHE_BITMAP_ORDER* dst = calloc(1, sizeof(CACHE_BITMAP_ORDER));
512
+
513
+ if (!dst || !order)
514
+ goto fail;
515
+
516
+ *dst = *order;
517
+
518
+ if (order->bitmapLength > 0)
519
+ {
520
+ dst->bitmapDataStream = malloc(order->bitmapLength);
521
+
522
+ if (!dst->bitmapDataStream)
523
+ goto fail;
524
+
525
+ memcpy(dst->bitmapDataStream, order->bitmapDataStream, order->bitmapLength);
526
+ }
527
+
528
+ return dst;
529
+ fail:
530
+ WINPR_PRAGMA_DIAG_PUSH
531
+ WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
532
+ free_cache_bitmap_order(context, dst);
533
+ WINPR_PRAGMA_DIAG_POP
534
+ return NULL;
535
+ }
536
+
537
+ void free_cache_bitmap_order(rdpContext* context, CACHE_BITMAP_ORDER* order)
538
+ {
539
+ if (order)
540
+ free(order->bitmapDataStream);
541
+
542
+ free(order);
543
+ }
544
+
545
+ CACHE_BITMAP_V2_ORDER* copy_cache_bitmap_v2_order(rdpContext* context,
546
+ const CACHE_BITMAP_V2_ORDER* order)
547
+ {
548
+ CACHE_BITMAP_V2_ORDER* dst = calloc(1, sizeof(CACHE_BITMAP_V2_ORDER));
549
+
550
+ if (!dst || !order)
551
+ goto fail;
552
+
553
+ *dst = *order;
554
+
555
+ if (order->bitmapLength > 0)
556
+ {
557
+ dst->bitmapDataStream = malloc(order->bitmapLength);
558
+
559
+ if (!dst->bitmapDataStream)
560
+ goto fail;
561
+
562
+ memcpy(dst->bitmapDataStream, order->bitmapDataStream, order->bitmapLength);
563
+ }
564
+
565
+ return dst;
566
+ fail:
567
+ WINPR_PRAGMA_DIAG_PUSH
568
+ WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
569
+ free_cache_bitmap_v2_order(context, dst);
570
+ WINPR_PRAGMA_DIAG_POP
571
+ return NULL;
572
+ }
573
+
574
+ void free_cache_bitmap_v2_order(rdpContext* context, CACHE_BITMAP_V2_ORDER* order)
575
+ {
576
+ if (order)
577
+ free(order->bitmapDataStream);
578
+
579
+ free(order);
580
+ }
581
+
582
+ CACHE_BITMAP_V3_ORDER* copy_cache_bitmap_v3_order(rdpContext* context,
583
+ const CACHE_BITMAP_V3_ORDER* order)
584
+ {
585
+ CACHE_BITMAP_V3_ORDER* dst = calloc(1, sizeof(CACHE_BITMAP_V3_ORDER));
586
+
587
+ if (!dst || !order)
588
+ goto fail;
589
+
590
+ *dst = *order;
591
+
592
+ if (order->bitmapData.length > 0)
593
+ {
594
+ dst->bitmapData.data = malloc(order->bitmapData.length);
595
+
596
+ if (!dst->bitmapData.data)
597
+ goto fail;
598
+
599
+ memcpy(dst->bitmapData.data, order->bitmapData.data, order->bitmapData.length);
600
+ }
601
+
602
+ return dst;
603
+ fail:
604
+ WINPR_PRAGMA_DIAG_PUSH
605
+ WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
606
+ free_cache_bitmap_v3_order(context, dst);
607
+ WINPR_PRAGMA_DIAG_POP
608
+ return NULL;
609
+ }
610
+
611
+ void free_cache_bitmap_v3_order(rdpContext* context, CACHE_BITMAP_V3_ORDER* order)
612
+ {
613
+ if (order)
614
+ free(order->bitmapData.data);
615
+
616
+ free(order);
617
+ }
local-test-freerdp-delta-01/afc-freerdp/libfreerdp/cache/brush.h ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * FreeRDP: A Remote Desktop Protocol Implementation
3
+ * Brush Cache
4
+ *
5
+ * Copyright 2011 Marc-Andre Moreau <[email protected]>
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ #ifndef FREERDP_LIB_BRUSH_CACHE_H
21
+ #define FREERDP_LIB_BRUSH_CACHE_H
22
+
23
+ #include <freerdp/api.h>
24
+ #include <freerdp/types.h>
25
+ #include <freerdp/freerdp.h>
26
+ #include <freerdp/update.h>
27
+
28
+ #include <winpr/stream.h>
29
+
30
+ typedef struct rdp_brush_cache rdpBrushCache;
31
+
32
+ #ifdef __cplusplus
33
+ extern "C"
34
+ {
35
+ #endif
36
+
37
+ FREERDP_LOCAL void* brush_cache_get(rdpBrushCache* brush, UINT32 index, UINT32* bpp);
38
+ FREERDP_LOCAL void brush_cache_put(rdpBrushCache* brush, UINT32 index, void* entry, UINT32 bpp);
39
+
40
+ FREERDP_LOCAL void brush_cache_register_callbacks(rdpUpdate* update);
41
+
42
+ FREERDP_LOCAL void brush_cache_free(rdpBrushCache* brush);
43
+
44
+ WINPR_ATTR_MALLOC(brush_cache_free, 1)
45
+ FREERDP_LOCAL rdpBrushCache* brush_cache_new(rdpContext* context);
46
+
47
+ FREERDP_LOCAL void free_cache_brush_order(rdpContext* context, CACHE_BRUSH_ORDER* order);
48
+
49
+ WINPR_ATTR_MALLOC(free_cache_brush_order, 1)
50
+ FREERDP_LOCAL CACHE_BRUSH_ORDER* copy_cache_brush_order(rdpContext* context,
51
+ const CACHE_BRUSH_ORDER* order);
52
+
53
+ #ifdef __cplusplus
54
+ }
55
+ #endif
56
+
57
+ #endif /* FREERDP_LIB_BRUSH_CACHE_H */
local-test-freerdp-delta-01/afc-freerdp/libfreerdp/cache/cache.c ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * FreeRDP: A Remote Desktop Protocol Implementation
3
+ * RDP Caches
4
+ *
5
+ * Copyright 2011 Marc-Andre Moreau <[email protected]>
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ #include <freerdp/config.h>
21
+
22
+ #include <winpr/crt.h>
23
+
24
+ #include <winpr/stream.h>
25
+
26
+ #include "cache.h"
27
+
28
+ rdpCache* cache_new(rdpContext* context)
29
+ {
30
+ rdpCache* cache = NULL;
31
+
32
+ WINPR_ASSERT(context);
33
+
34
+ cache = (rdpCache*)calloc(1, sizeof(rdpCache));
35
+
36
+ if (!cache)
37
+ return NULL;
38
+
39
+ cache->glyph = glyph_cache_new(context);
40
+
41
+ if (!cache->glyph)
42
+ goto error;
43
+
44
+ cache->brush = brush_cache_new(context);
45
+
46
+ if (!cache->brush)
47
+ goto error;
48
+
49
+ cache->pointer = pointer_cache_new(context);
50
+
51
+ if (!cache->pointer)
52
+ goto error;
53
+
54
+ cache->bitmap = bitmap_cache_new(context);
55
+
56
+ if (!cache->bitmap)
57
+ goto error;
58
+
59
+ cache->offscreen = offscreen_cache_new(context);
60
+
61
+ if (!cache->offscreen)
62
+ goto error;
63
+
64
+ cache->palette = palette_cache_new(context);
65
+
66
+ if (!cache->palette)
67
+ goto error;
68
+
69
+ cache->nine_grid = nine_grid_cache_new(context);
70
+
71
+ if (!cache->nine_grid)
72
+ goto error;
73
+
74
+ return cache;
75
+ error:
76
+ WINPR_PRAGMA_DIAG_PUSH
77
+ WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
78
+ cache_free(cache);
79
+ WINPR_PRAGMA_DIAG_POP
80
+ return NULL;
81
+ }
82
+
83
+ void cache_free(rdpCache* cache)
84
+ {
85
+ if (cache != NULL)
86
+ {
87
+ glyph_cache_free(cache->glyph);
88
+ brush_cache_free(cache->brush);
89
+ pointer_cache_free(cache->pointer);
90
+ bitmap_cache_free(cache->bitmap);
91
+ offscreen_cache_free(cache->offscreen);
92
+ palette_cache_free(cache->palette);
93
+ nine_grid_cache_free(cache->nine_grid);
94
+ free(cache);
95
+ }
96
+ }
97
+
98
+ CACHE_COLOR_TABLE_ORDER* copy_cache_color_table_order(rdpContext* context,
99
+ const CACHE_COLOR_TABLE_ORDER* order)
100
+ {
101
+ CACHE_COLOR_TABLE_ORDER* dst = calloc(1, sizeof(CACHE_COLOR_TABLE_ORDER));
102
+
103
+ if (!dst || !order)
104
+ goto fail;
105
+
106
+ *dst = *order;
107
+ return dst;
108
+ fail:
109
+ WINPR_PRAGMA_DIAG_PUSH
110
+ WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
111
+ free_cache_color_table_order(context, dst);
112
+ WINPR_PRAGMA_DIAG_POP
113
+ return NULL;
114
+ }
115
+
116
+ void free_cache_color_table_order(rdpContext* context, CACHE_COLOR_TABLE_ORDER* order)
117
+ {
118
+ free(order);
119
+ }
120
+
121
+ SURFACE_BITS_COMMAND* copy_surface_bits_command(rdpContext* context,
122
+ const SURFACE_BITS_COMMAND* order)
123
+ {
124
+ SURFACE_BITS_COMMAND* dst = calloc(1, sizeof(SURFACE_BITS_COMMAND));
125
+ if (!dst || !order)
126
+ goto fail;
127
+
128
+ *dst = *order;
129
+
130
+ dst->bmp.bitmapData = (BYTE*)malloc(order->bmp.bitmapDataLength);
131
+
132
+ if (!dst->bmp.bitmapData)
133
+ goto fail;
134
+
135
+ CopyMemory(dst->bmp.bitmapData, order->bmp.bitmapData, order->bmp.bitmapDataLength);
136
+
137
+ return dst;
138
+
139
+ fail:
140
+ WINPR_PRAGMA_DIAG_PUSH
141
+ WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
142
+ free_surface_bits_command(context, dst);
143
+ WINPR_PRAGMA_DIAG_POP
144
+ return NULL;
145
+ }
146
+
147
+ void free_surface_bits_command(rdpContext* context, SURFACE_BITS_COMMAND* order)
148
+ {
149
+ if (order)
150
+ free(order->bmp.bitmapData);
151
+ free(order);
152
+ }
local-test-freerdp-delta-01/afc-freerdp/libfreerdp/cache/cache.h ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * FreeRDP: A Remote Desktop Protocol Implementation
3
+ *
4
+ * Copyright 2018 Armin Novak <[email protected]>
5
+ * Copyright 2018 Thincast Technologies GmbH
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ #ifndef FREERDP_LIB_CACHE_CACHE_H
21
+ #define FREERDP_LIB_CACHE_CACHE_H
22
+
23
+ #include <freerdp/api.h>
24
+ #include <freerdp/freerdp.h>
25
+ #include <freerdp/pointer.h>
26
+
27
+ #include "glyph.h"
28
+ #include "brush.h"
29
+ #include "pointer.h"
30
+ #include "bitmap.h"
31
+ #include "nine_grid.h"
32
+ #include "offscreen.h"
33
+ #include "palette.h"
34
+
35
+ struct rdp_cache
36
+ {
37
+ rdpGlyphCache* glyph; /* 0 */
38
+ rdpBrushCache* brush; /* 1 */
39
+ rdpPointerCache* pointer; /* 2 */
40
+ rdpBitmapCache* bitmap; /* 3 */
41
+ rdpOffscreenCache* offscreen; /* 4 */
42
+ rdpPaletteCache* palette; /* 5 */
43
+ rdpNineGridCache* nine_grid; /* 6 */
44
+ };
45
+
46
+ #ifdef __cplusplus
47
+ extern "C"
48
+ {
49
+ #endif
50
+
51
+ FREERDP_LOCAL void cache_free(rdpCache* cache);
52
+
53
+ WINPR_ATTR_MALLOC(cache_free, 1)
54
+ FREERDP_LOCAL rdpCache* cache_new(rdpContext* context);
55
+
56
+ FREERDP_LOCAL void free_cache_color_table_order(rdpContext* context,
57
+ CACHE_COLOR_TABLE_ORDER* order);
58
+
59
+ WINPR_ATTR_MALLOC(free_cache_color_table_order, 2)
60
+ FREERDP_LOCAL CACHE_COLOR_TABLE_ORDER*
61
+ copy_cache_color_table_order(rdpContext* context, const CACHE_COLOR_TABLE_ORDER* order);
62
+
63
+ FREERDP_LOCAL void free_surface_bits_command(rdpContext* context, SURFACE_BITS_COMMAND* order);
64
+
65
+ WINPR_ATTR_MALLOC(free_surface_bits_command, 2)
66
+ FREERDP_LOCAL SURFACE_BITS_COMMAND*
67
+ copy_surface_bits_command(rdpContext* context, const SURFACE_BITS_COMMAND* order);
68
+
69
+ #ifdef __cplusplus
70
+ }
71
+ #endif
72
+
73
+ #endif /* FREERDP_LIB_CACHE_CACHE_H */
local-test-freerdp-delta-01/afc-freerdp/libfreerdp/cache/persistent.c ADDED
@@ -0,0 +1,376 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * FreeRDP: A Remote Desktop Protocol Implementation
3
+ * Persistent Bitmap Cache
4
+ *
5
+ * Copyright 2016 Marc-Andre Moreau <[email protected]>
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ #include <freerdp/config.h>
21
+
22
+ #include <winpr/crt.h>
23
+ #include <winpr/stream.h>
24
+ #include <winpr/assert.h>
25
+
26
+ #include <freerdp/freerdp.h>
27
+ #include <freerdp/constants.h>
28
+
29
+ #include <freerdp/cache/persistent.h>
30
+
31
+ struct rdp_persistent_cache
32
+ {
33
+ FILE* fp;
34
+ BOOL write;
35
+ int version;
36
+ int count;
37
+ char* filename;
38
+ BYTE* bmpData;
39
+ UINT32 bmpSize;
40
+ };
41
+
42
+ static const char sig_str[] = "RDP8bmp";
43
+
44
+ int persistent_cache_get_version(rdpPersistentCache* persistent)
45
+ {
46
+ WINPR_ASSERT(persistent);
47
+ return persistent->version;
48
+ }
49
+
50
+ int persistent_cache_get_count(rdpPersistentCache* persistent)
51
+ {
52
+ WINPR_ASSERT(persistent);
53
+ return persistent->count;
54
+ }
55
+
56
+ static int persistent_cache_read_entry_v2(rdpPersistentCache* persistent,
57
+ PERSISTENT_CACHE_ENTRY* entry)
58
+ {
59
+ PERSISTENT_CACHE_ENTRY_V2 entry2 = { 0 };
60
+
61
+ WINPR_ASSERT(persistent);
62
+ WINPR_ASSERT(entry);
63
+
64
+ if (fread((void*)&entry2, sizeof(entry2), 1, persistent->fp) != 1)
65
+ return -1;
66
+
67
+ entry->key64 = entry2.key64;
68
+ entry->width = entry2.width;
69
+ entry->height = entry2.height;
70
+ entry->size = entry2.width * entry2.height * 4;
71
+ entry->flags = entry2.flags;
72
+
73
+ entry->data = persistent->bmpData;
74
+
75
+ if (fread((void*)entry->data, 0x4000, 1, persistent->fp) != 1)
76
+ return -1;
77
+
78
+ return 1;
79
+ }
80
+
81
+ static int persistent_cache_write_entry_v2(rdpPersistentCache* persistent,
82
+ const PERSISTENT_CACHE_ENTRY* entry)
83
+ {
84
+ PERSISTENT_CACHE_ENTRY_V2 entry2 = { 0 };
85
+
86
+ WINPR_ASSERT(persistent);
87
+ WINPR_ASSERT(entry);
88
+ entry2.key64 = entry->key64;
89
+ entry2.width = entry->width;
90
+ entry2.height = entry->height;
91
+ entry2.size = entry->size;
92
+ entry2.flags = entry->flags;
93
+
94
+ if (!entry2.flags)
95
+ entry2.flags = 0x00000011;
96
+
97
+ if (fwrite(&entry2, sizeof(entry2), 1, persistent->fp) != 1)
98
+ return -1;
99
+
100
+ if (fwrite(entry->data, entry->size, 1, persistent->fp) != 1)
101
+ return -1;
102
+
103
+ if (0x4000 > entry->size)
104
+ {
105
+ const size_t padding = 0x4000 - entry->size;
106
+
107
+ if (fwrite(persistent->bmpData, padding, 1, persistent->fp) != 1)
108
+ return -1;
109
+ }
110
+
111
+ persistent->count++;
112
+
113
+ return 1;
114
+ }
115
+
116
+ static int persistent_cache_read_v2(rdpPersistentCache* persistent)
117
+ {
118
+ WINPR_ASSERT(persistent);
119
+ while (1)
120
+ {
121
+ PERSISTENT_CACHE_ENTRY_V2 entry = { 0 };
122
+
123
+ if (fread((void*)&entry, sizeof(entry), 1, persistent->fp) != 1)
124
+ break;
125
+
126
+ if (fseek(persistent->fp, 0x4000, SEEK_CUR) != 0)
127
+ break;
128
+
129
+ persistent->count++;
130
+ }
131
+
132
+ return 1;
133
+ }
134
+
135
+ static int persistent_cache_read_entry_v3(rdpPersistentCache* persistent,
136
+ PERSISTENT_CACHE_ENTRY* entry)
137
+ {
138
+ PERSISTENT_CACHE_ENTRY_V3 entry3 = { 0 };
139
+
140
+ WINPR_ASSERT(persistent);
141
+ WINPR_ASSERT(entry);
142
+
143
+ if (fread(&entry3, sizeof(entry3), 1, persistent->fp) != 1)
144
+ return -1;
145
+
146
+ entry->key64 = entry3.key64;
147
+ entry->width = entry3.width;
148
+ entry->height = entry3.height;
149
+ const UINT64 size = 4ull * entry3.width * entry3.height;
150
+ if (size > UINT32_MAX)
151
+ return -1;
152
+ entry->size = (UINT32)size;
153
+ entry->flags = 0;
154
+
155
+ if (entry->size > persistent->bmpSize)
156
+ {
157
+ persistent->bmpSize = entry->size;
158
+ BYTE* bmpData = (BYTE*)winpr_aligned_recalloc(persistent->bmpData, persistent->bmpSize,
159
+ sizeof(BYTE), 32);
160
+
161
+ if (!bmpData)
162
+ return -1;
163
+
164
+ persistent->bmpData = bmpData;
165
+ }
166
+
167
+ entry->data = persistent->bmpData;
168
+
169
+ if (fread((void*)entry->data, entry->size, 1, persistent->fp) != 1)
170
+ return -1;
171
+
172
+ return 1;
173
+ }
174
+
175
+ static int persistent_cache_write_entry_v3(rdpPersistentCache* persistent,
176
+ const PERSISTENT_CACHE_ENTRY* entry)
177
+ {
178
+ PERSISTENT_CACHE_ENTRY_V3 entry3 = { 0 };
179
+
180
+ WINPR_ASSERT(persistent);
181
+ WINPR_ASSERT(entry);
182
+
183
+ entry3.key64 = entry->key64;
184
+ entry3.width = entry->width;
185
+ entry3.height = entry->height;
186
+
187
+ if (fwrite((void*)&entry3, sizeof(entry3), 1, persistent->fp) != 1)
188
+ return -1;
189
+
190
+ if (fwrite((void*)entry->data, entry->size, 1, persistent->fp) != 1)
191
+ return -1;
192
+
193
+ persistent->count++;
194
+
195
+ return 1;
196
+ }
197
+
198
+ static int persistent_cache_read_v3(rdpPersistentCache* persistent)
199
+ {
200
+ WINPR_ASSERT(persistent);
201
+ while (1)
202
+ {
203
+ PERSISTENT_CACHE_ENTRY_V3 entry = { 0 };
204
+
205
+ if (fread((void*)&entry, sizeof(entry), 1, persistent->fp) != 1)
206
+ break;
207
+
208
+ if (_fseeki64(persistent->fp, (4LL * entry.width * entry.height), SEEK_CUR) != 0)
209
+ break;
210
+
211
+ persistent->count++;
212
+ }
213
+
214
+ return 1;
215
+ }
216
+
217
+ int persistent_cache_read_entry(rdpPersistentCache* persistent, PERSISTENT_CACHE_ENTRY* entry)
218
+ {
219
+ WINPR_ASSERT(persistent);
220
+ WINPR_ASSERT(entry);
221
+
222
+ if (persistent->version == 3)
223
+ return persistent_cache_read_entry_v3(persistent, entry);
224
+ else if (persistent->version == 2)
225
+ return persistent_cache_read_entry_v2(persistent, entry);
226
+
227
+ return -1;
228
+ }
229
+
230
+ int persistent_cache_write_entry(rdpPersistentCache* persistent,
231
+ const PERSISTENT_CACHE_ENTRY* entry)
232
+ {
233
+ WINPR_ASSERT(persistent);
234
+ WINPR_ASSERT(entry);
235
+
236
+ if (persistent->version == 3)
237
+ return persistent_cache_write_entry_v3(persistent, entry);
238
+ else if (persistent->version == 2)
239
+ return persistent_cache_write_entry_v2(persistent, entry);
240
+
241
+ return -1;
242
+ }
243
+
244
+ static int persistent_cache_open_read(rdpPersistentCache* persistent)
245
+ {
246
+ BYTE sig[8] = { 0 };
247
+ int status = 1;
248
+ long offset = 0;
249
+
250
+ WINPR_ASSERT(persistent);
251
+ persistent->fp = winpr_fopen(persistent->filename, "rb");
252
+
253
+ if (!persistent->fp)
254
+ return -1;
255
+
256
+ if (fread(sig, 8, 1, persistent->fp) != 1)
257
+ return -1;
258
+
259
+ if (memcmp(sig, sig_str, sizeof(sig_str)) == 0)
260
+ persistent->version = 3;
261
+ else
262
+ persistent->version = 2;
263
+
264
+ (void)fseek(persistent->fp, 0, SEEK_SET);
265
+
266
+ if (persistent->version == 3)
267
+ {
268
+ PERSISTENT_CACHE_HEADER_V3 header;
269
+
270
+ if (fread(&header, sizeof(header), 1, persistent->fp) != 1)
271
+ return -1;
272
+
273
+ status = persistent_cache_read_v3(persistent);
274
+ offset = sizeof(header);
275
+ }
276
+ else
277
+ {
278
+ status = persistent_cache_read_v2(persistent);
279
+ offset = 0;
280
+ }
281
+
282
+ (void)fseek(persistent->fp, offset, SEEK_SET);
283
+
284
+ return status;
285
+ }
286
+
287
+ static int persistent_cache_open_write(rdpPersistentCache* persistent)
288
+ {
289
+ WINPR_ASSERT(persistent);
290
+
291
+ persistent->fp = winpr_fopen(persistent->filename, "w+b");
292
+
293
+ if (!persistent->fp)
294
+ return -1;
295
+
296
+ if (persistent->version == 3)
297
+ {
298
+ PERSISTENT_CACHE_HEADER_V3 header = { 0 };
299
+ memcpy(header.sig, sig_str, MIN(sizeof(header.sig), sizeof(sig_str)));
300
+ header.flags = 0x00000006;
301
+
302
+ if (fwrite(&header, sizeof(header), 1, persistent->fp) != 1)
303
+ return -1;
304
+ }
305
+
306
+ ZeroMemory(persistent->bmpData, persistent->bmpSize);
307
+
308
+ return 1;
309
+ }
310
+
311
+ int persistent_cache_open(rdpPersistentCache* persistent, const char* filename, BOOL write,
312
+ UINT32 version)
313
+ {
314
+ WINPR_ASSERT(persistent);
315
+ WINPR_ASSERT(filename);
316
+ persistent->write = write;
317
+
318
+ persistent->filename = _strdup(filename);
319
+
320
+ if (!persistent->filename)
321
+ return -1;
322
+
323
+ if (persistent->write)
324
+ {
325
+ WINPR_ASSERT(version <= INT32_MAX);
326
+ persistent->version = (int)version;
327
+ return persistent_cache_open_write(persistent);
328
+ }
329
+
330
+ return persistent_cache_open_read(persistent);
331
+ }
332
+
333
+ int persistent_cache_close(rdpPersistentCache* persistent)
334
+ {
335
+ WINPR_ASSERT(persistent);
336
+ if (persistent->fp)
337
+ {
338
+ (void)fclose(persistent->fp);
339
+ persistent->fp = NULL;
340
+ }
341
+
342
+ return 1;
343
+ }
344
+
345
+ rdpPersistentCache* persistent_cache_new(void)
346
+ {
347
+ rdpPersistentCache* persistent = calloc(1, sizeof(rdpPersistentCache));
348
+
349
+ if (!persistent)
350
+ return NULL;
351
+
352
+ persistent->bmpSize = 0x4000;
353
+ persistent->bmpData = calloc(1, persistent->bmpSize);
354
+
355
+ if (!persistent->bmpData)
356
+ {
357
+ free(persistent);
358
+ return NULL;
359
+ }
360
+
361
+ return persistent;
362
+ }
363
+
364
+ void persistent_cache_free(rdpPersistentCache* persistent)
365
+ {
366
+ if (!persistent)
367
+ return;
368
+
369
+ persistent_cache_close(persistent);
370
+
371
+ free(persistent->filename);
372
+
373
+ winpr_aligned_free(persistent->bmpData);
374
+
375
+ free(persistent);
376
+ }
local-test-freerdp-delta-01/afc-freerdp/libfreerdp/common/assistance.c ADDED
@@ -0,0 +1,1503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * FreeRDP: A Remote Desktop Protocol Implementation
3
+ * Remote Assistance
4
+ *
5
+ * Copyright 2014 Marc-Andre Moreau <[email protected]>
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ #include <freerdp/config.h>
21
+
22
+ #include <errno.h>
23
+
24
+ #include <winpr/wtypes.h>
25
+ #include <winpr/collections.h>
26
+ #include <winpr/string.h>
27
+ #include <winpr/crt.h>
28
+ #include <winpr/crypto.h>
29
+ #include <winpr/print.h>
30
+ #include <winpr/windows.h>
31
+ #include <winpr/ssl.h>
32
+ #include <winpr/file.h>
33
+
34
+ #include <freerdp/log.h>
35
+ #include <freerdp/client/file.h>
36
+ #include <freerdp/client/cmdline.h>
37
+
38
+ #include <freerdp/assistance.h>
39
+
40
+ #include "../core/settings.h"
41
+
42
+ #define TAG FREERDP_TAG("common")
43
+
44
+ struct rdp_assistance_file
45
+ {
46
+ UINT32 Type;
47
+
48
+ char* Username;
49
+ char* LHTicket;
50
+ char* RCTicket;
51
+ char* PassStub;
52
+ UINT32 DtStart;
53
+ UINT32 DtLength;
54
+ BOOL LowSpeed;
55
+ BOOL RCTicketEncrypted;
56
+
57
+ char* ConnectionString1;
58
+ char* ConnectionString2;
59
+
60
+ BYTE* EncryptedPassStub;
61
+ size_t EncryptedPassStubLength;
62
+
63
+ BYTE* EncryptedLHTicket;
64
+ size_t EncryptedLHTicketLength;
65
+
66
+ wArrayList* MachineAddresses;
67
+ wArrayList* MachinePorts;
68
+ wArrayList* MachineUris;
69
+
70
+ char* RASessionId;
71
+ char* RASpecificParams;
72
+ char* RASpecificParams2;
73
+
74
+ char* filename;
75
+ char* password;
76
+ };
77
+
78
+ static const char* strrstr(const char* haystack, size_t len, const char* needle)
79
+ {
80
+ if (*needle == '\0')
81
+ return haystack;
82
+
83
+ char* result = NULL;
84
+ for (;;)
85
+ {
86
+ char* p = strstr(haystack, needle);
87
+ if (p == NULL)
88
+ break;
89
+ if (p > haystack + len)
90
+ return NULL;
91
+
92
+ result = p;
93
+ haystack = p + 1;
94
+ }
95
+
96
+ return result;
97
+ }
98
+
99
+ static BOOL update_option(char** opt, const char* val, size_t len)
100
+ {
101
+ WINPR_ASSERT(opt);
102
+ free(*opt);
103
+ *opt = NULL;
104
+
105
+ if (!val && (len != 0))
106
+ return FALSE;
107
+ else if (!val && (len == 0))
108
+ return TRUE;
109
+ *opt = strndup(val, len);
110
+ return *opt != NULL;
111
+ }
112
+
113
+ static BOOL update_name(rdpAssistanceFile* file, const char* name)
114
+ {
115
+ WINPR_ASSERT(file);
116
+
117
+ if (!name)
118
+ {
119
+ WLog_ERR(TAG, "ASSISTANCE file %s invalid name", name);
120
+ return FALSE;
121
+ }
122
+
123
+ free(file->filename);
124
+ file->filename = _strdup(name);
125
+ return file->filename != NULL;
126
+ }
127
+
128
+ static BOOL update_password(rdpAssistanceFile* file, const char* password)
129
+ {
130
+ WINPR_ASSERT(file);
131
+ free(file->password);
132
+ file->password = NULL;
133
+ if (!password)
134
+ return TRUE;
135
+ file->password = _strdup(password);
136
+ return file->password != NULL;
137
+ }
138
+
139
+ static BOOL update_connectionstring2_nocopy(rdpAssistanceFile* file, char* str)
140
+ {
141
+ WINPR_ASSERT(file);
142
+ free(file->ConnectionString2);
143
+ file->ConnectionString2 = NULL;
144
+ if (!str)
145
+ return TRUE;
146
+ file->ConnectionString2 = str;
147
+ return file->ConnectionString2 != NULL;
148
+ }
149
+
150
+ static BOOL update_connectionstring2(rdpAssistanceFile* file, const char* str, size_t len)
151
+ {
152
+ char* strc = NULL;
153
+ if (!str && (len != 0))
154
+ return FALSE;
155
+
156
+ if (str && (len > 0))
157
+ {
158
+ strc = strndup(str, len);
159
+ if (!strc)
160
+ return FALSE;
161
+ }
162
+ return update_connectionstring2_nocopy(file, strc);
163
+ }
164
+
165
+ static BOOL update_connectionstring2_wchar(rdpAssistanceFile* file, const WCHAR* str, size_t len)
166
+ {
167
+ char* strc = NULL;
168
+
169
+ if (!str && (len != 0))
170
+ return FALSE;
171
+
172
+ if (str && (len > 0))
173
+ {
174
+ strc = ConvertWCharNToUtf8Alloc(str, len, NULL);
175
+ if (!strc)
176
+ return FALSE;
177
+ }
178
+ return update_connectionstring2_nocopy(file, strc);
179
+ }
180
+
181
+ /**
182
+ * Password encryption in establishing a remote assistance session of type 1:
183
+ * http://blogs.msdn.com/b/openspecification/archive/2011/10/31/password-encryption-in-establishing-a-remote-assistance-session-of-type-1.aspx
184
+ *
185
+ * Creation of PassStub for the Remote Assistance Ticket:
186
+ * http://social.msdn.microsoft.com/Forums/en-US/6316c3f4-ea09-4343-a4a1-9cca46d70d28/creation-of-passstub-for-the-remote-assistance-ticket?forum=os_windowsprotocols
187
+ */
188
+
189
+ /**
190
+ * CryptDeriveKey Function:
191
+ * http://msdn.microsoft.com/en-us/library/windows/desktop/aa379916/
192
+ *
193
+ * Let n be the required derived key length, in bytes.
194
+ * The derived key is the first n bytes of the hash value after the hash computation
195
+ * has been completed by CryptDeriveKey. If the hash is not a member of the SHA-2
196
+ * family and the required key is for either 3DES or AES, the key is derived as follows:
197
+ *
198
+ * Form a 64-byte buffer by repeating the constant 0x36 64 times.
199
+ * Let k be the length of the hash value that is represented by the input parameter hBaseData.
200
+ * Set the first k bytes of the buffer to the result of an XOR operation of the first k bytes
201
+ * of the buffer with the hash value that is represented by the input parameter hBaseData.
202
+ *
203
+ * Form a 64-byte buffer by repeating the constant 0x5C 64 times.
204
+ * Set the first k bytes of the buffer to the result of an XOR operation of the first k bytes
205
+ * of the buffer with the hash value that is represented by the input parameter hBaseData.
206
+ *
207
+ * Hash the result of step 1 by using the same hash algorithm as that used to compute the hash
208
+ * value that is represented by the hBaseData parameter.
209
+ *
210
+ * Hash the result of step 2 by using the same hash algorithm as that used to compute the hash
211
+ * value that is represented by the hBaseData parameter.
212
+ *
213
+ * Concatenate the result of step 3 with the result of step 4.
214
+ * Use the first n bytes of the result of step 5 as the derived key.
215
+ */
216
+
217
+ static BOOL freerdp_assistance_crypt_derive_key_sha1(const BYTE* hash, size_t hashLength, BYTE* key,
218
+ size_t keyLength)
219
+ {
220
+ BOOL rc = FALSE;
221
+ BYTE pad1[64] = { 0 };
222
+ BYTE pad2[64] = { 0 };
223
+
224
+ if (hashLength == 0)
225
+ return FALSE;
226
+
227
+ memset(pad1, 0x36, sizeof(pad1));
228
+ memset(pad2, 0x5C, sizeof(pad2));
229
+
230
+ for (size_t i = 0; i < hashLength; i++)
231
+ {
232
+ pad1[i] ^= hash[i];
233
+ pad2[i] ^= hash[i];
234
+ }
235
+
236
+ BYTE* buffer = (BYTE*)calloc(hashLength, 2);
237
+
238
+ if (!buffer)
239
+ goto fail;
240
+
241
+ if (!winpr_Digest(WINPR_MD_SHA1, pad1, 64, buffer, hashLength))
242
+ goto fail;
243
+
244
+ if (!winpr_Digest(WINPR_MD_SHA1, pad2, 64, &buffer[hashLength], hashLength))
245
+ goto fail;
246
+
247
+ CopyMemory(key, buffer, keyLength);
248
+ rc = TRUE;
249
+ fail:
250
+ free(buffer);
251
+ return rc;
252
+ }
253
+
254
+ static BOOL append_address_to_list(wArrayList* MachineAddresses, const char* str, size_t len)
255
+ {
256
+ char* copy = NULL;
257
+ if (len > 0)
258
+ copy = strndup(str, len);
259
+ if (!copy)
260
+ return FALSE;
261
+
262
+ const BOOL rc = ArrayList_Append(MachineAddresses, copy);
263
+ if (!rc)
264
+ free(copy);
265
+ // NOLINTNEXTLINE(clang-analyzer-unix.Malloc): ArrayList_Append takes ownership of copy
266
+ return rc;
267
+ }
268
+
269
+ static BOOL append_address(rdpAssistanceFile* file, const char* host, const char* port)
270
+ {
271
+ WINPR_ASSERT(file);
272
+
273
+ errno = 0;
274
+ unsigned long p = strtoul(port, NULL, 0);
275
+
276
+ if ((errno != 0) || (p == 0) || (p > UINT16_MAX))
277
+ {
278
+ WLog_ERR(TAG, "Failed to parse ASSISTANCE file: ConnectionString2 invalid port value %s",
279
+ port);
280
+ return FALSE;
281
+ }
282
+
283
+ if (!append_address_to_list(file->MachineAddresses, host, host ? strlen(host) : 0))
284
+ return FALSE;
285
+ return ArrayList_Append(file->MachinePorts, (void*)(uintptr_t)p);
286
+ }
287
+
288
+ static BOOL freerdp_assistance_parse_address_list(rdpAssistanceFile* file, char* list)
289
+ {
290
+ WINPR_ASSERT(file);
291
+
292
+ WLog_DBG(TAG, "freerdp_assistance_parse_address_list list=%s", list);
293
+
294
+ BOOL rc = FALSE;
295
+
296
+ if (!list)
297
+ return FALSE;
298
+
299
+ char* strp = list;
300
+ char* s = ";";
301
+
302
+ // get the first token
303
+ char* saveptr = NULL;
304
+ char* token = strtok_s(strp, s, &saveptr);
305
+
306
+ // walk through other tokens
307
+ while (token != NULL)
308
+ {
309
+ char* port = strchr(token, ':');
310
+ if (!port)
311
+ goto out;
312
+ *port = '\0';
313
+ port++;
314
+
315
+ if (!append_address(file, token, port))
316
+ goto out;
317
+
318
+ token = strtok_s(NULL, s, &saveptr);
319
+ }
320
+ rc = TRUE;
321
+ out:
322
+ return rc;
323
+ }
324
+
325
+ static BOOL freerdp_assistance_parse_connection_string1(rdpAssistanceFile* file)
326
+ {
327
+ char* tokens[8] = { 0 };
328
+ BOOL rc = FALSE;
329
+
330
+ WINPR_ASSERT(file);
331
+
332
+ if (!file->RCTicket)
333
+ return FALSE;
334
+
335
+ /**
336
+ * <ProtocolVersion>,<protocolType>,<machineAddressList>,<assistantAccountPwd>,
337
+ * <RASessionID>,<RASessionName>,<RASessionPwd>,<protocolSpecificParms>
338
+ */
339
+ char* str = _strdup(file->RCTicket);
340
+
341
+ if (!str)
342
+ goto error;
343
+
344
+ const size_t length = strlen(str);
345
+
346
+ int count = 1;
347
+ for (size_t i = 0; i < length; i++)
348
+ {
349
+ if (str[i] == ',')
350
+ count++;
351
+ }
352
+
353
+ if (count != 8)
354
+ goto error;
355
+
356
+ count = 0;
357
+ tokens[count++] = str;
358
+
359
+ for (size_t i = 0; i < length; i++)
360
+ {
361
+ if (str[i] == ',')
362
+ {
363
+ str[i] = '\0';
364
+ tokens[count++] = &str[i + 1];
365
+ }
366
+ }
367
+
368
+ if (strcmp(tokens[0], "65538") != 0)
369
+ goto error;
370
+
371
+ if (strcmp(tokens[1], "1") != 0)
372
+ goto error;
373
+
374
+ if (strcmp(tokens[3], "*") != 0)
375
+ goto error;
376
+
377
+ if (strcmp(tokens[5], "*") != 0)
378
+ goto error;
379
+
380
+ if (strcmp(tokens[6], "*") != 0)
381
+ goto error;
382
+
383
+ file->RASessionId = _strdup(tokens[4]);
384
+
385
+ if (!file->RASessionId)
386
+ goto error;
387
+
388
+ file->RASpecificParams = _strdup(tokens[7]);
389
+
390
+ if (!file->RASpecificParams)
391
+ goto error;
392
+
393
+ if (!freerdp_assistance_parse_address_list(file, tokens[2]))
394
+ goto error;
395
+
396
+ rc = TRUE;
397
+ error:
398
+ free(str);
399
+ return rc;
400
+ }
401
+
402
+ /**
403
+ * Decrypted Connection String 2:
404
+ *
405
+ * <E>
406
+ * <A KH="BNRjdu97DyczQSRuMRrDWoue+HA="
407
+ * ID="+ULZ6ifjoCa6cGPMLQiGHRPwkg6VyJqGwxMnO6GcelwUh9a6/FBq3It5ADSndmLL"/> <C> <T ID="1" SID="0"> <L
408
+ * P="49228" N="fe80::1032:53d9:5a01:909b%3"/> <L P="49229" N="fe80::3d8f:9b2d:6b4e:6aa%6"/> <L
409
+ * P="49230" N="192.168.1.200"/> <L P="49231" N="169.254.6.170"/>
410
+ * </T>
411
+ * </C>
412
+ * </E>
413
+ */
414
+
415
+ static BOOL freerdp_assistance_parse_attr(const char** opt, size_t* plength, const char* key,
416
+ const char* tag)
417
+ {
418
+ WINPR_ASSERT(opt);
419
+ WINPR_ASSERT(plength);
420
+ WINPR_ASSERT(key);
421
+
422
+ *opt = NULL;
423
+ *plength = 0;
424
+ if (!tag)
425
+ return FALSE;
426
+
427
+ char bkey[128] = { 0 };
428
+ const int rc = _snprintf(bkey, sizeof(bkey), "%s=\"", key);
429
+ WINPR_ASSERT(rc > 0);
430
+ WINPR_ASSERT((size_t)rc < sizeof(bkey));
431
+ if ((rc <= 0) || ((size_t)rc >= sizeof(bkey)))
432
+ return FALSE;
433
+
434
+ char* p = strstr(tag, bkey);
435
+ if (!p)
436
+ return TRUE;
437
+
438
+ p += strlen(bkey);
439
+ char* q = strchr(p, '"');
440
+
441
+ if (!q)
442
+ {
443
+ WLog_ERR(TAG, "Failed to parse ASSISTANCE file: ConnectionString2 invalid field '%s=%s'",
444
+ key, p);
445
+ return FALSE;
446
+ }
447
+
448
+ if (p > q)
449
+ {
450
+ WLog_ERR(TAG,
451
+ "Failed to parse ASSISTANCE file: ConnectionString2 invalid field "
452
+ "order for '%s'",
453
+ key);
454
+ return FALSE;
455
+ }
456
+ const size_t length = WINPR_ASSERTING_INT_CAST(size_t, q - p);
457
+ *opt = p;
458
+ *plength = length;
459
+
460
+ return TRUE;
461
+ }
462
+
463
+ static BOOL freerdp_assistance_parse_attr_str(char** opt, const char* key, const char* tag)
464
+ {
465
+ const char* copt = NULL;
466
+ size_t size = 0;
467
+ if (!freerdp_assistance_parse_attr(&copt, &size, key, tag))
468
+ return FALSE;
469
+ return update_option(opt, copt, size);
470
+ }
471
+
472
+ static BOOL freerdp_assistance_parse_attr_bool(BOOL* opt, const char* key, const char* tag)
473
+ {
474
+ const char* copt = NULL;
475
+ size_t size = 0;
476
+
477
+ WINPR_ASSERT(opt);
478
+ *opt = FALSE;
479
+
480
+ if (!freerdp_assistance_parse_attr(&copt, &size, key, tag))
481
+ return FALSE;
482
+ if (size != 1)
483
+ return TRUE;
484
+
485
+ *opt = (copt[0] == '1');
486
+ return TRUE;
487
+ }
488
+
489
+ static BOOL freerdp_assistance_parse_attr_uint32(UINT32* opt, const char* key, const char* tag)
490
+ {
491
+ const char* copt = NULL;
492
+ size_t size = 0;
493
+
494
+ WINPR_ASSERT(opt);
495
+ *opt = 0;
496
+
497
+ if (!freerdp_assistance_parse_attr(&copt, &size, key, tag))
498
+ return FALSE;
499
+
500
+ char buffer[64] = { 0 };
501
+ if ((!copt && (size > 0)) || (size >= sizeof(buffer)))
502
+ {
503
+ WLog_WARN(TAG, "Invalid UINT32 string '%s' [%" PRIuz "]", copt, size);
504
+ return FALSE;
505
+ }
506
+
507
+ if (size > 0)
508
+ strncpy(buffer, copt, size);
509
+
510
+ errno = 0;
511
+ unsigned long val = strtoul(buffer, NULL, 0);
512
+
513
+ if ((errno != 0) || (val > UINT32_MAX))
514
+ {
515
+ WLog_ERR(TAG, "Failed to parse ASSISTANCE file: Invalid value %s", buffer);
516
+ return FALSE;
517
+ }
518
+
519
+ *opt = (UINT32)val;
520
+
521
+ return TRUE;
522
+ }
523
+
524
+ static char* freerdp_assistance_contains_element(char* input, size_t ilen, const char* key,
525
+ size_t* plen, char** pdata, size_t* pdlen)
526
+ {
527
+ WINPR_ASSERT(input);
528
+ WINPR_ASSERT(key);
529
+ WINPR_ASSERT(plen);
530
+
531
+ char bkey[128] = { 0 };
532
+ const int rc = _snprintf(bkey, sizeof(bkey), "<%s", key);
533
+ WINPR_ASSERT(rc > 0);
534
+ WINPR_ASSERT((size_t)rc < sizeof(bkey));
535
+ if ((rc < 0) || ((size_t)rc >= sizeof(bkey)))
536
+ return NULL;
537
+
538
+ char* tag = strstr(input, bkey);
539
+ if (!tag || (tag > input + ilen))
540
+ return NULL;
541
+
542
+ char* data = tag + strnlen(bkey, sizeof(bkey));
543
+
544
+ /* Ensure there is a valid delimiter following our token */
545
+ switch (data[0])
546
+ {
547
+ case '>':
548
+ case '/':
549
+ case ' ':
550
+ case '\t':
551
+ break;
552
+ default:
553
+ WLog_ERR(TAG,
554
+ "Failed to parse ASSISTANCE file: ConnectionString2 missing delimiter after "
555
+ "field %s",
556
+ bkey);
557
+ return NULL;
558
+ }
559
+
560
+ char* start = strstr(tag, ">");
561
+
562
+ if (!start || (start > input + ilen))
563
+ {
564
+ WLog_ERR(TAG, "Failed to parse ASSISTANCE file: ConnectionString2 missing field %s", bkey);
565
+ return NULL;
566
+ }
567
+
568
+ const char* end = start;
569
+ const char* dend = start - 1;
570
+ if (*dend != '/')
571
+ {
572
+ char ekey[128] = { 0 };
573
+ const int erc = _snprintf(ekey, sizeof(ekey), "</%s>", key);
574
+ WINPR_ASSERT(erc > 0);
575
+ WINPR_ASSERT((size_t)erc < sizeof(ekey));
576
+ if ((erc <= 0) || ((size_t)erc >= sizeof(ekey)))
577
+ return NULL;
578
+ const size_t offset = WINPR_ASSERTING_INT_CAST(size_t, start - tag);
579
+ dend = end = strrstr(start, ilen - offset, ekey);
580
+ if (end)
581
+ end += strnlen(ekey, sizeof(ekey));
582
+ }
583
+
584
+ if (!end)
585
+ {
586
+ WLog_ERR(TAG,
587
+ "Failed to parse ASSISTANCE file: ConnectionString2 missing end tag for field %s",
588
+ key);
589
+ return NULL;
590
+ }
591
+ if (plen)
592
+ *plen = WINPR_ASSERTING_INT_CAST(size_t, end - tag);
593
+
594
+ if (pdata)
595
+ *pdata = data;
596
+ if (pdlen)
597
+ *pdlen = WINPR_ASSERTING_INT_CAST(size_t, dend - data);
598
+ return tag;
599
+ }
600
+
601
+ /**! \brief this function returns a XML element identified by \b key
602
+ * The input string will be manipulated, so that the element found is '\0' terminated.
603
+ *
604
+ * This function can not find multiple elements on the same level as the input string is changed!
605
+ */
606
+ static BOOL freerdp_assistance_consume_input_and_get_element(char* input, const char* key,
607
+ char** element, size_t* elen)
608
+ {
609
+ WINPR_ASSERT(input);
610
+ WINPR_ASSERT(key);
611
+ WINPR_ASSERT(element);
612
+ WINPR_ASSERT(elen);
613
+
614
+ size_t len = 0;
615
+ size_t dlen = 0;
616
+ char* data = NULL;
617
+ char* tag = freerdp_assistance_contains_element(input, strlen(input), key, &len, &data, &dlen);
618
+ if (!tag)
619
+ return FALSE;
620
+
621
+ char* end = data + dlen;
622
+ *tag = '\0';
623
+ *end = '\0';
624
+ *element = data;
625
+ *elen = dlen + 1;
626
+ return TRUE;
627
+ }
628
+
629
+ static BOOL freerdp_assistance_get_element(char* input, size_t ilen, const char* key,
630
+ char** element, size_t* elen)
631
+ {
632
+ WINPR_ASSERT(input);
633
+ WINPR_ASSERT(key);
634
+ WINPR_ASSERT(element);
635
+ WINPR_ASSERT(elen);
636
+
637
+ size_t len = 0;
638
+ size_t dlen = 0;
639
+ char* data = NULL;
640
+ char* tag = freerdp_assistance_contains_element(input, ilen, key, &len, &data, &dlen);
641
+ if (!tag)
642
+ return FALSE;
643
+
644
+ if (tag + len > input + ilen)
645
+ return FALSE;
646
+
647
+ char* end = tag + len;
648
+ *element = data;
649
+ *elen = WINPR_ASSERTING_INT_CAST(size_t, end - data + 1);
650
+ return TRUE;
651
+ }
652
+
653
+ static BOOL freerdp_assistance_parse_all_elements_of(rdpAssistanceFile* file, char* data,
654
+ size_t len, const char* key,
655
+ BOOL (*fkt)(rdpAssistanceFile* file,
656
+ char* data, size_t len))
657
+ {
658
+ char* val = NULL;
659
+ size_t vlen = 0;
660
+
661
+ while (freerdp_assistance_get_element(data, len, key, &val, &vlen))
662
+ {
663
+ data = val + vlen;
664
+ len = strnlen(data, len);
665
+ if (vlen > 0)
666
+ {
667
+ val[vlen - 1] = '\0';
668
+
669
+ if (!fkt(file, val, vlen))
670
+ return FALSE;
671
+ }
672
+ }
673
+
674
+ return TRUE;
675
+ }
676
+
677
+ static BOOL freerdp_assistance_parse_all_elements_of_l(rdpAssistanceFile* file, char* data,
678
+ size_t len)
679
+ {
680
+ UINT32 p = 0;
681
+ const char* n = NULL;
682
+ const char* u = NULL;
683
+ size_t nlen = 0;
684
+ size_t ulen = 0;
685
+ if (!freerdp_assistance_parse_attr_uint32(&p, "P", data))
686
+ return FALSE;
687
+ if (!freerdp_assistance_parse_attr(&n, &nlen, "N", data))
688
+ return FALSE;
689
+ if (!freerdp_assistance_parse_attr(&u, &ulen, "U", data))
690
+ return FALSE;
691
+
692
+ if (n && (nlen > 0))
693
+ {
694
+ if (!append_address_to_list(file->MachineAddresses, n, nlen))
695
+ return FALSE;
696
+ if (!ArrayList_Append(file->MachinePorts, (void*)(uintptr_t)p))
697
+ return FALSE;
698
+ }
699
+ if (u && (ulen > 0))
700
+ {
701
+ if (!append_address_to_list(file->MachineAddresses, u, ulen))
702
+ return FALSE;
703
+ if (!ArrayList_Append(file->MachinePorts, (void*)(uintptr_t)p))
704
+ return FALSE;
705
+ }
706
+ return TRUE;
707
+ }
708
+
709
+ static BOOL freerdp_assistance_parse_all_elements_of_t(rdpAssistanceFile* file, char* data,
710
+ size_t len)
711
+ {
712
+ UINT32 id = 0;
713
+ UINT32 sid = 0;
714
+ if (!freerdp_assistance_parse_attr_uint32(&id, "ID", data))
715
+ return FALSE;
716
+ if (!freerdp_assistance_parse_attr_uint32(&sid, "SID", data))
717
+ return FALSE;
718
+ WLog_DBG(TAG, "transport id=%" PRIu32 ", sid=%" PRIu32, id, sid);
719
+ return freerdp_assistance_parse_all_elements_of(file, data, len, "L",
720
+ freerdp_assistance_parse_all_elements_of_l);
721
+ }
722
+
723
+ static BOOL freerdp_assistance_parse_all_elements_of_c(rdpAssistanceFile* file, char* data,
724
+ size_t len)
725
+ {
726
+ return freerdp_assistance_parse_all_elements_of(file, data, len, "T",
727
+ freerdp_assistance_parse_all_elements_of_t);
728
+ }
729
+
730
+ static BOOL freerdp_assistance_parse_find_elements_of_c(rdpAssistanceFile* file, char* data,
731
+ size_t len)
732
+ {
733
+ return freerdp_assistance_parse_all_elements_of(file, data, len, "C",
734
+ freerdp_assistance_parse_all_elements_of_c);
735
+ }
736
+
737
+ static BOOL freerdp_assistance_parse_connection_string2(rdpAssistanceFile* file)
738
+ {
739
+ BOOL rc = FALSE;
740
+
741
+ WINPR_ASSERT(file);
742
+
743
+ if (!file->ConnectionString2)
744
+ return FALSE;
745
+
746
+ char* str = _strdup(file->ConnectionString2);
747
+ if (!str)
748
+ goto out_fail;
749
+
750
+ char* e = NULL;
751
+ size_t elen = 0;
752
+ if (!freerdp_assistance_consume_input_and_get_element(str, "E", &e, &elen))
753
+ goto out_fail;
754
+
755
+ if (!e || (elen == 0))
756
+ goto out_fail;
757
+
758
+ char* a = NULL;
759
+ size_t alen = 0;
760
+ if (!freerdp_assistance_get_element(e, elen, "A", &a, &alen))
761
+ goto out_fail;
762
+
763
+ if (!a || (alen == 0))
764
+ goto out_fail;
765
+
766
+ if (!freerdp_assistance_parse_find_elements_of_c(file, e, elen))
767
+ goto out_fail;
768
+
769
+ /* '\0' terminate the detected XML elements so
770
+ * the parser can continue with terminated strings
771
+ */
772
+ a[alen] = '\0';
773
+ if (!freerdp_assistance_parse_attr_str(&file->RASpecificParams, "KH", a))
774
+ goto out_fail;
775
+
776
+ if (!freerdp_assistance_parse_attr_str(&file->RASpecificParams2, "KH2", a))
777
+ goto out_fail;
778
+
779
+ if (!freerdp_assistance_parse_attr_str(&file->RASessionId, "ID", a))
780
+ goto out_fail;
781
+
782
+ rc = TRUE;
783
+ out_fail:
784
+ free(str);
785
+ return rc;
786
+ }
787
+
788
+ char* freerdp_assistance_construct_expert_blob(const char* name, const char* pass)
789
+ {
790
+ if (!name || !pass)
791
+ return NULL;
792
+
793
+ const size_t nameLength = strlen(name) + strlen("NAME=");
794
+ const size_t passLength = strlen(pass) + strlen("PASS=");
795
+ const size_t size = nameLength + passLength + 64;
796
+ char* ExpertBlob = (char*)calloc(1, size);
797
+
798
+ if (!ExpertBlob)
799
+ return NULL;
800
+
801
+ (void)sprintf_s(ExpertBlob, size, "%" PRIuz ";NAME=%s%" PRIuz ";PASS=%s", nameLength, name,
802
+ passLength, pass);
803
+ return ExpertBlob;
804
+ }
805
+
806
+ char* freerdp_assistance_generate_pass_stub(DWORD flags)
807
+ {
808
+ UINT32 nums[14];
809
+ char* passStub = NULL;
810
+ char set1[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789*_";
811
+ char set2[12] = "!@#$&^*()-+=";
812
+ char set3[10] = "0123456789";
813
+ char set4[26] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
814
+ char set5[26] = "abcdefghijklmnopqrstuvwxyz";
815
+ passStub = (char*)malloc(15);
816
+
817
+ if (!passStub)
818
+ return NULL;
819
+
820
+ /**
821
+ * PassStub generation:
822
+ *
823
+ * Characters 0 and 5-13 are from the set A-Z a-z 0-9 * _
824
+ * Character 1 is from the set !@#$&^*()-+=
825
+ * Character 2 is from the set 0-9
826
+ * Character 3 is from the set A-Z
827
+ * Character 4 is from the set a-z
828
+ *
829
+ * Example: WB^6HsrIaFmEpi
830
+ */
831
+ winpr_RAND(nums, sizeof(nums));
832
+ passStub[0] = set1[nums[0] % sizeof(set1)]; /* character 0 */
833
+ passStub[1] = set2[nums[1] % sizeof(set2)]; /* character 1 */
834
+ passStub[2] = set3[nums[2] % sizeof(set3)]; /* character 2 */
835
+ passStub[3] = set4[nums[3] % sizeof(set4)]; /* character 3 */
836
+ passStub[4] = set5[nums[4] % sizeof(set5)]; /* character 4 */
837
+ passStub[5] = set1[nums[5] % sizeof(set1)]; /* character 5 */
838
+ passStub[6] = set1[nums[6] % sizeof(set1)]; /* character 6 */
839
+ passStub[7] = set1[nums[7] % sizeof(set1)]; /* character 7 */
840
+ passStub[8] = set1[nums[8] % sizeof(set1)]; /* character 8 */
841
+ passStub[9] = set1[nums[9] % sizeof(set1)]; /* character 9 */
842
+ passStub[10] = set1[nums[10] % sizeof(set1)]; /* character 10 */
843
+ passStub[11] = set1[nums[11] % sizeof(set1)]; /* character 11 */
844
+ passStub[12] = set1[nums[12] % sizeof(set1)]; /* character 12 */
845
+ passStub[13] = set1[nums[13] % sizeof(set1)]; /* character 13 */
846
+ passStub[14] = '\0';
847
+ return passStub;
848
+ }
849
+
850
+ BYTE* freerdp_assistance_encrypt_pass_stub(const char* password, const char* passStub,
851
+ size_t* pEncryptedSize)
852
+ {
853
+ BOOL rc = 0;
854
+ size_t cbPasswordW = 0;
855
+ size_t cbPassStubW = 0;
856
+ BYTE PasswordHash[WINPR_MD5_DIGEST_LENGTH] = { 0 };
857
+ WINPR_RC4_CTX* rc4Ctx = NULL;
858
+ BYTE* pbIn = NULL;
859
+ BYTE* pbOut = NULL;
860
+ BYTE* res = NULL;
861
+ WCHAR* PasswordW = ConvertUtf8ToWCharAlloc(password, &cbPasswordW);
862
+ WCHAR* PassStubW = ConvertUtf8ToWCharAlloc(passStub, &cbPassStubW);
863
+
864
+ cbPasswordW = (cbPasswordW) * sizeof(WCHAR);
865
+ cbPassStubW = (cbPassStubW) * sizeof(WCHAR);
866
+ const size_t EncryptedSize = cbPassStubW + 4;
867
+
868
+ if (!PasswordW || !PassStubW)
869
+ goto fail;
870
+
871
+ if (!winpr_Digest(WINPR_MD_MD5, (BYTE*)PasswordW, cbPasswordW, (BYTE*)PasswordHash,
872
+ sizeof(PasswordHash)))
873
+ goto fail;
874
+
875
+ pbIn = (BYTE*)calloc(1, EncryptedSize);
876
+ pbOut = (BYTE*)calloc(1, EncryptedSize);
877
+
878
+ if (!pbIn || !pbOut)
879
+ goto fail;
880
+
881
+ WINPR_ASSERT(cbPasswordW <= UINT32_MAX);
882
+ winpr_Data_Write_UINT32(pbIn, (UINT32)cbPassStubW);
883
+ CopyMemory(&pbIn[4], PassStubW, cbPassStubW);
884
+ rc4Ctx = winpr_RC4_New(PasswordHash, sizeof(PasswordHash));
885
+
886
+ if (!rc4Ctx)
887
+ {
888
+ WLog_ERR(TAG, "winpr_Cipher_New failure");
889
+ goto fail;
890
+ }
891
+
892
+ rc = winpr_RC4_Update(rc4Ctx, EncryptedSize, pbIn, pbOut);
893
+
894
+ if (!rc)
895
+ {
896
+ WLog_ERR(TAG, "winpr_Cipher_Update failure");
897
+ goto fail;
898
+ }
899
+ res = pbOut;
900
+ fail:
901
+ winpr_RC4_Free(rc4Ctx);
902
+ free(PasswordW);
903
+ free(PassStubW);
904
+ free(pbIn);
905
+ if (!res)
906
+ free(pbOut);
907
+ else
908
+ *pEncryptedSize = EncryptedSize;
909
+ return res;
910
+ }
911
+
912
+ static BOOL freerdp_assistance_decrypt2(rdpAssistanceFile* file)
913
+ {
914
+ BOOL rc = FALSE;
915
+ int status = 0;
916
+ size_t cbPasswordW = 0;
917
+ size_t cchOutW = 0;
918
+ WINPR_CIPHER_CTX* aesDec = NULL;
919
+ WCHAR* PasswordW = NULL;
920
+ BYTE* pbIn = NULL;
921
+ BYTE* pbOut = NULL;
922
+ size_t cbOut = 0;
923
+ size_t cbIn = 0;
924
+ size_t cbFinal = 0;
925
+ BYTE DerivedKey[WINPR_AES_BLOCK_SIZE] = { 0 };
926
+ BYTE InitializationVector[WINPR_AES_BLOCK_SIZE] = { 0 };
927
+ BYTE PasswordHash[WINPR_SHA1_DIGEST_LENGTH] = { 0 };
928
+
929
+ WINPR_ASSERT(file);
930
+
931
+ if (!file->password)
932
+ return FALSE;
933
+
934
+ PasswordW = ConvertUtf8ToWCharAlloc(file->password, &cbPasswordW);
935
+ if (!PasswordW)
936
+ {
937
+ WLog_ERR(TAG, "Failed to parse ASSISTANCE file: Conversion from UCS2 to UTF8 failed");
938
+ return FALSE;
939
+ }
940
+
941
+ cbPasswordW = (cbPasswordW) * sizeof(WCHAR);
942
+
943
+ if (!winpr_Digest(WINPR_MD_SHA1, (BYTE*)PasswordW, cbPasswordW, PasswordHash,
944
+ sizeof(PasswordHash)))
945
+ goto fail;
946
+
947
+ if (!freerdp_assistance_crypt_derive_key_sha1(PasswordHash, sizeof(PasswordHash), DerivedKey,
948
+ sizeof(DerivedKey)))
949
+ goto fail;
950
+
951
+ aesDec =
952
+ winpr_Cipher_NewEx(WINPR_CIPHER_AES_128_CBC, WINPR_DECRYPT, DerivedKey, sizeof(DerivedKey),
953
+ InitializationVector, sizeof(InitializationVector));
954
+
955
+ if (!aesDec)
956
+ goto fail;
957
+
958
+ cbOut = cbFinal = 0;
959
+ cbIn = file->EncryptedLHTicketLength;
960
+ pbIn = file->EncryptedLHTicket;
961
+ pbOut = (BYTE*)calloc(1, cbIn + WINPR_AES_BLOCK_SIZE + 2);
962
+
963
+ if (!pbOut)
964
+ goto fail;
965
+
966
+ if (!winpr_Cipher_Update(aesDec, pbIn, cbIn, pbOut, &cbOut))
967
+ goto fail;
968
+
969
+ if (!winpr_Cipher_Final(aesDec, pbOut + cbOut, &cbFinal))
970
+ {
971
+ WLog_ERR(TAG, "winpr_Cipher_Final failure");
972
+ goto fail;
973
+ }
974
+
975
+ cbOut += cbFinal;
976
+ cbFinal = 0;
977
+
978
+ union
979
+ {
980
+ const WCHAR* wc;
981
+ const BYTE* b;
982
+ } cnv;
983
+
984
+ cnv.b = pbOut;
985
+ cchOutW = cbOut / sizeof(WCHAR);
986
+
987
+ if (!update_connectionstring2_wchar(file, cnv.wc, cchOutW))
988
+ {
989
+ WLog_ERR(TAG, "Failed to parse ASSISTANCE file: Conversion from UCS2 to UTF8 failed");
990
+ goto fail;
991
+ }
992
+
993
+ if (!freerdp_assistance_parse_connection_string2(file))
994
+ goto fail;
995
+
996
+ rc = TRUE;
997
+ fail:
998
+ winpr_Cipher_Free(aesDec);
999
+ free(PasswordW);
1000
+ free(pbOut);
1001
+ WLog_DBG(TAG, "freerdp_assistance_parse_connection_string2: %d", status);
1002
+ return rc;
1003
+ }
1004
+
1005
+ BYTE* freerdp_assistance_hex_string_to_bin(const void* raw, size_t* size)
1006
+ {
1007
+ BYTE* buffer = NULL;
1008
+ if (!raw || !size)
1009
+ return NULL;
1010
+ *size = 0;
1011
+ const size_t length = strlen(raw);
1012
+ buffer = calloc(length, sizeof(BYTE));
1013
+ if (!buffer)
1014
+ return NULL;
1015
+ const size_t rc = winpr_HexStringToBinBuffer(raw, length, buffer, length);
1016
+ if (rc == 0)
1017
+ {
1018
+ free(buffer);
1019
+ return NULL;
1020
+ }
1021
+ *size = rc;
1022
+ return buffer;
1023
+ }
1024
+
1025
+ char* freerdp_assistance_bin_to_hex_string(const void* raw, size_t size)
1026
+ {
1027
+ return winpr_BinToHexString(raw, size, FALSE);
1028
+ }
1029
+
1030
+ static int freerdp_assistance_parse_uploadinfo(rdpAssistanceFile* file, char* uploadinfo,
1031
+ size_t uploadinfosize)
1032
+ {
1033
+ const char escalated[9] = "Escalated";
1034
+ const size_t esclen = sizeof(escalated);
1035
+ const char* typestr = NULL;
1036
+ size_t typelen = 0;
1037
+
1038
+ if (!uploadinfo || (uploadinfosize == 0))
1039
+ return -1;
1040
+
1041
+ if (strnlen(uploadinfo, uploadinfosize) == uploadinfosize)
1042
+ {
1043
+ WLog_WARN(TAG, "UPLOADINFOR string is not '\0' terminated");
1044
+ return -1;
1045
+ }
1046
+
1047
+ if (!freerdp_assistance_parse_attr(&typestr, &typelen, "TYPE", uploadinfo))
1048
+ return -1;
1049
+
1050
+ if ((typelen != esclen) || (strncmp(typestr, escalated, esclen) != 0))
1051
+ {
1052
+ WLog_ERR(TAG,
1053
+ "Failed to parse ASSISTANCE file: Missing or invalid UPLOADINFO TYPE '%s' [%" PRIuz
1054
+ "]",
1055
+ typestr, typelen);
1056
+ return -1;
1057
+ }
1058
+
1059
+ char* uploaddata = NULL;
1060
+ size_t uploaddatasize = 0;
1061
+ if (!freerdp_assistance_consume_input_and_get_element(uploadinfo, "UPLOADDATA", &uploaddata,
1062
+ &uploaddatasize))
1063
+ return -1;
1064
+
1065
+ /* Parse USERNAME */
1066
+ if (!freerdp_assistance_parse_attr_str(&file->Username, "USERNAME", uploaddata))
1067
+ return -1;
1068
+
1069
+ /* Parse LHTICKET */
1070
+ if (!freerdp_assistance_parse_attr_str(&file->LHTicket, "LHTICKET", uploaddata))
1071
+ return -1;
1072
+
1073
+ /* Parse RCTICKET */
1074
+ if (!freerdp_assistance_parse_attr_str(&file->RCTicket, "RCTICKET", uploaddata))
1075
+ return -1;
1076
+
1077
+ /* Parse RCTICKETENCRYPTED */
1078
+ if (!freerdp_assistance_parse_attr_bool(&file->RCTicketEncrypted, "RCTICKETENCRYPTED",
1079
+ uploaddata))
1080
+ return -1;
1081
+
1082
+ /* Parse PassStub */
1083
+ if (!freerdp_assistance_parse_attr_str(&file->PassStub, "PassStub", uploaddata))
1084
+ return -1;
1085
+
1086
+ if (file->PassStub)
1087
+ {
1088
+ const char* amp = "&amp;";
1089
+ char* passtub = strstr(file->PassStub, amp);
1090
+ while (passtub)
1091
+ {
1092
+ const char* end = passtub + 5;
1093
+ const size_t len = strlen(end);
1094
+ memmove(&passtub[1], end, len + 1);
1095
+ passtub = strstr(passtub, amp);
1096
+ }
1097
+ }
1098
+
1099
+ /* Parse DtStart */
1100
+ if (!freerdp_assistance_parse_attr_uint32(&file->DtStart, "DtStart", uploaddata))
1101
+ return -1;
1102
+
1103
+ /* Parse DtLength */
1104
+ if (!freerdp_assistance_parse_attr_uint32(&file->DtLength, "DtLength", uploaddata))
1105
+ return -1;
1106
+
1107
+ /* Parse L (LowSpeed) */
1108
+ if (!freerdp_assistance_parse_attr_bool(&file->LowSpeed, "L", uploaddata))
1109
+ return -1;
1110
+
1111
+ file->Type = (file->LHTicket) ? 2 : 1;
1112
+ int status = 0;
1113
+
1114
+ switch (file->Type)
1115
+ {
1116
+ case 2:
1117
+ {
1118
+ file->EncryptedLHTicket = freerdp_assistance_hex_string_to_bin(
1119
+ file->LHTicket, &file->EncryptedLHTicketLength);
1120
+
1121
+ if (!freerdp_assistance_decrypt2(file))
1122
+ status = -1;
1123
+ }
1124
+ break;
1125
+
1126
+ case 1:
1127
+ {
1128
+ if (!freerdp_assistance_parse_connection_string1(file))
1129
+ status = -1;
1130
+ }
1131
+ break;
1132
+
1133
+ default:
1134
+ return -1;
1135
+ }
1136
+
1137
+ if (status < 0)
1138
+ {
1139
+ WLog_ERR(TAG, "freerdp_assistance_parse_connection_string1 failure: %d", status);
1140
+ return -1;
1141
+ }
1142
+
1143
+ file->EncryptedPassStub = freerdp_assistance_encrypt_pass_stub(file->password, file->PassStub,
1144
+ &file->EncryptedPassStubLength);
1145
+
1146
+ if (!file->EncryptedPassStub)
1147
+ return -1;
1148
+
1149
+ return 1;
1150
+ }
1151
+
1152
+ static int freerdp_assistance_parse_file_buffer_int(rdpAssistanceFile* file, char* buffer,
1153
+ size_t size, const char* password)
1154
+ {
1155
+ WINPR_ASSERT(file);
1156
+ WINPR_ASSERT(buffer);
1157
+ WINPR_ASSERT(size > 0);
1158
+
1159
+ if (!update_password(file, password))
1160
+ return -1;
1161
+
1162
+ char* uploadinfo = NULL;
1163
+ size_t uploadinfosize = 0;
1164
+ if (freerdp_assistance_consume_input_and_get_element(buffer, "UPLOADINFO", &uploadinfo,
1165
+ &uploadinfosize))
1166
+ return freerdp_assistance_parse_uploadinfo(file, uploadinfo, uploadinfosize);
1167
+
1168
+ size_t elen = 0;
1169
+ const char* estr = freerdp_assistance_contains_element(buffer, size, "E", &elen, NULL, NULL);
1170
+ if (!estr || (elen == 0))
1171
+ {
1172
+ WLog_ERR(TAG, "Failed to parse ASSISTANCE file: Neither UPLOADINFO nor <E> found");
1173
+ return -1;
1174
+ }
1175
+ if (!update_connectionstring2(file, estr, elen))
1176
+ return -1;
1177
+
1178
+ if (!freerdp_assistance_parse_connection_string2(file))
1179
+ return -1;
1180
+
1181
+ return 1;
1182
+ }
1183
+
1184
+ int freerdp_assistance_parse_file_buffer(rdpAssistanceFile* file, const char* cbuffer, size_t size,
1185
+ const char* password)
1186
+ {
1187
+ WINPR_ASSERT(file);
1188
+ if (!password)
1189
+ {
1190
+ WLog_WARN(TAG, "empty password supplied");
1191
+ }
1192
+
1193
+ if (!cbuffer || (size == 0))
1194
+ {
1195
+ WLog_WARN(TAG, "no data supplied [%p, %" PRIuz "]", cbuffer, size);
1196
+ return -1;
1197
+ }
1198
+
1199
+ char* abuffer = strndup(cbuffer, size);
1200
+ const size_t len = strnlen(cbuffer, size);
1201
+ if (len == size)
1202
+ WLog_WARN(TAG, "Input data not '\0' terminated");
1203
+
1204
+ if (!abuffer)
1205
+ return -1;
1206
+
1207
+ const int rc = freerdp_assistance_parse_file_buffer_int(file, abuffer, len + 1, password);
1208
+ free(abuffer);
1209
+ return rc;
1210
+ }
1211
+
1212
+ int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name, const char* password)
1213
+ {
1214
+ int status = 0;
1215
+ BYTE* buffer = NULL;
1216
+ FILE* fp = NULL;
1217
+ size_t readSize = 0;
1218
+ union
1219
+ {
1220
+ INT64 i64;
1221
+ size_t s;
1222
+ } fileSize;
1223
+
1224
+ if (!update_name(file, name))
1225
+ return -1;
1226
+
1227
+ fp = winpr_fopen(name, "r");
1228
+
1229
+ if (!fp)
1230
+ {
1231
+ WLog_ERR(TAG, "Failed to open ASSISTANCE file %s ", name);
1232
+ return -1;
1233
+ }
1234
+
1235
+ (void)_fseeki64(fp, 0, SEEK_END);
1236
+ fileSize.i64 = _ftelli64(fp);
1237
+ (void)_fseeki64(fp, 0, SEEK_SET);
1238
+
1239
+ if (fileSize.i64 < 1)
1240
+ {
1241
+ WLog_ERR(TAG, "Failed to read ASSISTANCE file %s ", name);
1242
+ (void)fclose(fp);
1243
+ return -1;
1244
+ }
1245
+
1246
+ buffer = (BYTE*)malloc(fileSize.s + 2);
1247
+
1248
+ if (!buffer)
1249
+ {
1250
+ (void)fclose(fp);
1251
+ return -1;
1252
+ }
1253
+
1254
+ readSize = fread(buffer, fileSize.s, 1, fp);
1255
+
1256
+ if (!readSize)
1257
+ {
1258
+ if (!ferror(fp))
1259
+ readSize = fileSize.s;
1260
+ }
1261
+
1262
+ (void)fclose(fp);
1263
+
1264
+ if (readSize < 1)
1265
+ {
1266
+ WLog_ERR(TAG, "Failed to read ASSISTANCE file %s ", name);
1267
+ free(buffer);
1268
+ buffer = NULL;
1269
+ return -1;
1270
+ }
1271
+
1272
+ buffer[fileSize.s] = '\0';
1273
+ buffer[fileSize.s + 1] = '\0';
1274
+ status = freerdp_assistance_parse_file_buffer(file, (char*)buffer, fileSize.s, password);
1275
+ free(buffer);
1276
+ return status;
1277
+ }
1278
+
1279
+ BOOL freerdp_assistance_populate_settings_from_assistance_file(rdpAssistanceFile* file,
1280
+ rdpSettings* settings)
1281
+ {
1282
+ if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteAssistanceMode, TRUE))
1283
+ return FALSE;
1284
+
1285
+ if (!file->RASessionId || !file->MachineAddresses)
1286
+ return FALSE;
1287
+
1288
+ if (!freerdp_settings_set_string(settings, FreeRDP_RemoteAssistanceSessionId,
1289
+ file->RASessionId))
1290
+ return FALSE;
1291
+
1292
+ if (file->RCTicket)
1293
+ {
1294
+ if (!freerdp_settings_set_string(settings, FreeRDP_RemoteAssistanceRCTicket,
1295
+ file->RCTicket))
1296
+ return FALSE;
1297
+ }
1298
+ else
1299
+ {
1300
+ if (!freerdp_settings_set_string(settings, FreeRDP_RemoteAssistanceRCTicket,
1301
+ file->ConnectionString2))
1302
+ return FALSE;
1303
+ }
1304
+
1305
+ if (file->PassStub)
1306
+ {
1307
+ if (!freerdp_settings_set_string(settings, FreeRDP_RemoteAssistancePassStub,
1308
+ file->PassStub))
1309
+ return FALSE;
1310
+ }
1311
+
1312
+ if (ArrayList_Count(file->MachineAddresses) < 1)
1313
+ return FALSE;
1314
+
1315
+ const char* addr = ArrayList_GetItem(file->MachineAddresses, 0);
1316
+ if (!freerdp_settings_set_string(settings, FreeRDP_ServerHostname, addr))
1317
+ return FALSE;
1318
+
1319
+ if (!freerdp_settings_set_string(settings, FreeRDP_AssistanceFile, file->filename))
1320
+ return FALSE;
1321
+
1322
+ if (!freerdp_settings_set_string(settings, FreeRDP_RemoteAssistancePassword, file->password))
1323
+ return FALSE;
1324
+
1325
+ if (file->Username)
1326
+ {
1327
+ if (!freerdp_settings_set_string(settings, FreeRDP_Username, file->Username))
1328
+ return FALSE;
1329
+ }
1330
+
1331
+ if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteAssistanceMode, TRUE))
1332
+ return FALSE;
1333
+
1334
+ const size_t ports = ArrayList_Count(file->MachinePorts);
1335
+ const size_t addresses = ArrayList_Count(file->MachineAddresses);
1336
+ if (ports < 1)
1337
+ return FALSE;
1338
+ if (ports != addresses)
1339
+ return FALSE;
1340
+
1341
+ union
1342
+ {
1343
+ uintptr_t port;
1344
+ void* data;
1345
+ } cnv;
1346
+ cnv.data = ArrayList_GetItem(file->MachinePorts, 0);
1347
+ WINPR_ASSERT(cnv.port <= UINT32_MAX);
1348
+ if (!freerdp_settings_set_uint32(settings, FreeRDP_ServerPort, (UINT32)cnv.port))
1349
+ return FALSE;
1350
+
1351
+ if (!freerdp_target_net_adresses_reset(settings, ports))
1352
+ return FALSE;
1353
+
1354
+ for (size_t x = 0; x < ports; x++)
1355
+ {
1356
+ cnv.data = ArrayList_GetItem(file->MachinePorts, x);
1357
+ WINPR_ASSERT(cnv.port <= UINT32_MAX);
1358
+ const UINT32 port = (UINT32)cnv.port;
1359
+ if (!freerdp_settings_set_pointer_array(settings, FreeRDP_TargetNetPorts, x, &port))
1360
+ return FALSE;
1361
+ }
1362
+ for (size_t i = 0; i < addresses; i++)
1363
+ {
1364
+ const char* maddr = ArrayList_GetItem(file->MachineAddresses, i);
1365
+ if (!freerdp_settings_set_pointer_array(settings, FreeRDP_TargetNetAddresses, i, maddr))
1366
+ return FALSE;
1367
+ }
1368
+
1369
+ return TRUE;
1370
+ }
1371
+
1372
+ static BOOL setup_string(wArrayList* list)
1373
+ {
1374
+ WINPR_ASSERT(list);
1375
+
1376
+ wObject* obj = ArrayList_Object(list);
1377
+ if (!obj)
1378
+ return FALSE;
1379
+ obj->fnObjectFree = free;
1380
+ // obj->fnObjectNew = wwinpr_ObjectStringClone;
1381
+ return TRUE;
1382
+ }
1383
+
1384
+ rdpAssistanceFile* freerdp_assistance_file_new(void)
1385
+ {
1386
+ winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
1387
+ rdpAssistanceFile* file = calloc(1, sizeof(rdpAssistanceFile));
1388
+ if (!file)
1389
+ return NULL;
1390
+
1391
+ file->MachineAddresses = ArrayList_New(FALSE);
1392
+ file->MachinePorts = ArrayList_New(FALSE);
1393
+ file->MachineUris = ArrayList_New(FALSE);
1394
+
1395
+ if (!file->MachineAddresses || !file->MachinePorts || !file->MachineUris)
1396
+ goto fail;
1397
+
1398
+ if (!setup_string(file->MachineAddresses) || !setup_string(file->MachineUris))
1399
+ goto fail;
1400
+
1401
+ return file;
1402
+
1403
+ fail:
1404
+ WINPR_PRAGMA_DIAG_PUSH
1405
+ WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
1406
+ freerdp_assistance_file_free(file);
1407
+ WINPR_PRAGMA_DIAG_POP
1408
+ return NULL;
1409
+ }
1410
+
1411
+ void freerdp_assistance_file_free(rdpAssistanceFile* file)
1412
+ {
1413
+ if (!file)
1414
+ return;
1415
+
1416
+ update_password(file, NULL);
1417
+ update_connectionstring2(file, NULL, 0);
1418
+ free(file->filename);
1419
+ free(file->Username);
1420
+ free(file->LHTicket);
1421
+ free(file->RCTicket);
1422
+ free(file->PassStub);
1423
+ free(file->ConnectionString1);
1424
+ free(file->EncryptedLHTicket);
1425
+ free(file->RASessionId);
1426
+ free(file->RASpecificParams);
1427
+ free(file->RASpecificParams2);
1428
+ free(file->EncryptedPassStub);
1429
+
1430
+ ArrayList_Free(file->MachineAddresses);
1431
+ ArrayList_Free(file->MachinePorts);
1432
+ ArrayList_Free(file->MachineUris);
1433
+ free(file);
1434
+ }
1435
+
1436
+ void freerdp_assistance_print_file(rdpAssistanceFile* file, wLog* log, DWORD level)
1437
+ {
1438
+ WINPR_ASSERT(file);
1439
+
1440
+ WLog_Print(log, level, "Username: %s", file->Username);
1441
+ WLog_Print(log, level, "LHTicket: %s", file->LHTicket);
1442
+ WLog_Print(log, level, "RCTicket: %s", file->RCTicket);
1443
+ WLog_Print(log, level, "RCTicketEncrypted: %" PRId32, file->RCTicketEncrypted);
1444
+ WLog_Print(log, level, "PassStub: %s", file->PassStub);
1445
+ WLog_Print(log, level, "DtStart: %" PRIu32, file->DtStart);
1446
+ WLog_Print(log, level, "DtLength: %" PRIu32, file->DtLength);
1447
+ WLog_Print(log, level, "LowSpeed: %" PRId32, file->LowSpeed);
1448
+ WLog_Print(log, level, "RASessionId: %s", file->RASessionId);
1449
+ WLog_Print(log, level, "RASpecificParams: %s", file->RASpecificParams);
1450
+ WLog_Print(log, level, "RASpecificParams2: %s", file->RASpecificParams2);
1451
+
1452
+ for (size_t x = 0; x < ArrayList_Count(file->MachineAddresses); x++)
1453
+ {
1454
+ UINT32 port = 0;
1455
+ const char* uri = NULL;
1456
+ const char* addr = ArrayList_GetItem(file->MachineAddresses, x);
1457
+ if (x < ArrayList_Count(file->MachinePorts))
1458
+ {
1459
+ union
1460
+ {
1461
+ uintptr_t port;
1462
+ void* data;
1463
+ } cnv;
1464
+ cnv.data = ArrayList_GetItem(file->MachinePorts, x);
1465
+ WINPR_ASSERT(cnv.port <= UINT32_MAX);
1466
+ port = (UINT32)cnv.port;
1467
+ }
1468
+ if (x < ArrayList_Count(file->MachineUris))
1469
+ uri = ArrayList_GetItem(file->MachineUris, x);
1470
+
1471
+ WLog_Print(log, level, "MachineAddress [%" PRIdz ": %s", x, addr);
1472
+ WLog_Print(log, level, "MachinePort [%" PRIdz ": %" PRIu32, x, port);
1473
+ WLog_Print(log, level, "MachineURI [%" PRIdz ": %s", x, uri);
1474
+ }
1475
+ }
1476
+
1477
+ BOOL freerdp_assistance_get_encrypted_pass_stub(rdpAssistanceFile* file, const char** pwd,
1478
+ size_t* size)
1479
+ {
1480
+ if (!file || !pwd || !size)
1481
+ return FALSE;
1482
+
1483
+ *pwd = (const char*)file->EncryptedPassStub;
1484
+ *size = file->EncryptedPassStubLength;
1485
+ return TRUE;
1486
+ }
1487
+
1488
+ int freerdp_assistance_set_connection_string2(rdpAssistanceFile* file, const char* string,
1489
+ const char* password)
1490
+ {
1491
+ if (!file || !string || !password)
1492
+ return -1;
1493
+
1494
+ char* str = _strdup(string);
1495
+ if (!str)
1496
+ return -1;
1497
+
1498
+ if (!update_connectionstring2_nocopy(file, str))
1499
+ return -1;
1500
+ if (!update_password(file, password))
1501
+ return -1;
1502
+ return freerdp_assistance_parse_connection_string2(file);
1503
+ }
local-test-freerdp-delta-01/afc-freerdp/libfreerdp/common/settings_str.h ADDED
@@ -0,0 +1,629 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Generated by */
2
+
3
+ #ifndef FREERDP_CORE_SETTINGS_STR_H
4
+ #define FREERDP_CORE_SETTINGS_STR_H
5
+
6
+ #include "../core/settings.h"
7
+
8
+ #include <freerdp/settings.h>
9
+ #include <freerdp/log.h>
10
+
11
+ #define TAG FREERDP_TAG("common.settings")
12
+
13
+ typedef enum
14
+ {
15
+ FREERDP_SETTINGS_TYPE_BOOL,
16
+ FREERDP_SETTINGS_TYPE_UINT16,
17
+ FREERDP_SETTINGS_TYPE_INT16,
18
+ FREERDP_SETTINGS_TYPE_UINT32,
19
+ FREERDP_SETTINGS_TYPE_INT32,
20
+ FREERDP_SETTINGS_TYPE_UINT64,
21
+ FREERDP_SETTINGS_TYPE_INT64,
22
+ FREERDP_SETTINGS_TYPE_STRING,
23
+ FREERDP_SETTINGS_TYPE_POINTER
24
+ } FREERDP_SETTINGS_TYPE;
25
+
26
+ struct settings_str_entry
27
+ {
28
+ SSIZE_T id;
29
+ SSIZE_T type;
30
+ const char* str;
31
+ };
32
+ static const struct settings_str_entry settings_map[] = {
33
+ { FreeRDP_AadSecurity, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_AadSecurity" },
34
+ { FreeRDP_AllowCacheWaitingList, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_AllowCacheWaitingList" },
35
+ { FreeRDP_AllowDesktopComposition, FREERDP_SETTINGS_TYPE_BOOL,
36
+ "FreeRDP_AllowDesktopComposition" },
37
+ { FreeRDP_AllowFontSmoothing, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_AllowFontSmoothing" },
38
+ { FreeRDP_AllowUnanouncedOrdersFromServer, FREERDP_SETTINGS_TYPE_BOOL,
39
+ "FreeRDP_AllowUnanouncedOrdersFromServer" },
40
+ { FreeRDP_AltSecFrameMarkerSupport, FREERDP_SETTINGS_TYPE_BOOL,
41
+ "FreeRDP_AltSecFrameMarkerSupport" },
42
+ { FreeRDP_AsyncChannels, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_AsyncChannels" },
43
+ { FreeRDP_AsyncUpdate, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_AsyncUpdate" },
44
+ { FreeRDP_AudioCapture, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_AudioCapture" },
45
+ { FreeRDP_AudioPlayback, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_AudioPlayback" },
46
+ { FreeRDP_Authentication, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_Authentication" },
47
+ { FreeRDP_AuthenticationOnly, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_AuthenticationOnly" },
48
+ { FreeRDP_AutoAcceptCertificate, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_AutoAcceptCertificate" },
49
+ { FreeRDP_AutoDenyCertificate, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_AutoDenyCertificate" },
50
+ { FreeRDP_AutoLogonEnabled, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_AutoLogonEnabled" },
51
+ { FreeRDP_AutoReconnectionEnabled, FREERDP_SETTINGS_TYPE_BOOL,
52
+ "FreeRDP_AutoReconnectionEnabled" },
53
+ { FreeRDP_AutoReconnectionPacketSupported, FREERDP_SETTINGS_TYPE_BOOL,
54
+ "FreeRDP_AutoReconnectionPacketSupported" },
55
+ { FreeRDP_BitmapCacheEnabled, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_BitmapCacheEnabled" },
56
+ { FreeRDP_BitmapCachePersistEnabled, FREERDP_SETTINGS_TYPE_BOOL,
57
+ "FreeRDP_BitmapCachePersistEnabled" },
58
+ { FreeRDP_BitmapCacheV3Enabled, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_BitmapCacheV3Enabled" },
59
+ { FreeRDP_BitmapCompressionDisabled, FREERDP_SETTINGS_TYPE_BOOL,
60
+ "FreeRDP_BitmapCompressionDisabled" },
61
+ { FreeRDP_CertificateCallbackPreferPEM, FREERDP_SETTINGS_TYPE_BOOL,
62
+ "FreeRDP_CertificateCallbackPreferPEM" },
63
+ { FreeRDP_CompressionEnabled, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_CompressionEnabled" },
64
+ { FreeRDP_ConnectChildSession, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_ConnectChildSession" },
65
+ { FreeRDP_ConsoleSession, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_ConsoleSession" },
66
+ { FreeRDP_CredentialsFromStdin, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_CredentialsFromStdin" },
67
+ { FreeRDP_DeactivateClientDecoding, FREERDP_SETTINGS_TYPE_BOOL,
68
+ "FreeRDP_DeactivateClientDecoding" },
69
+ { FreeRDP_Decorations, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_Decorations" },
70
+ { FreeRDP_DesktopResize, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DesktopResize" },
71
+ { FreeRDP_DeviceRedirection, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DeviceRedirection" },
72
+ { FreeRDP_DisableCredentialsDelegation, FREERDP_SETTINGS_TYPE_BOOL,
73
+ "FreeRDP_DisableCredentialsDelegation" },
74
+ { FreeRDP_DisableCtrlAltDel, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DisableCtrlAltDel" },
75
+ { FreeRDP_DisableCursorBlinking, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DisableCursorBlinking" },
76
+ { FreeRDP_DisableCursorShadow, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DisableCursorShadow" },
77
+ { FreeRDP_DisableFullWindowDrag, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DisableFullWindowDrag" },
78
+ { FreeRDP_DisableMenuAnims, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DisableMenuAnims" },
79
+ { FreeRDP_DisableRemoteAppCapsCheck, FREERDP_SETTINGS_TYPE_BOOL,
80
+ "FreeRDP_DisableRemoteAppCapsCheck" },
81
+ { FreeRDP_DisableThemes, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DisableThemes" },
82
+ { FreeRDP_DisableWallpaper, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DisableWallpaper" },
83
+ { FreeRDP_DrawAllowColorSubsampling, FREERDP_SETTINGS_TYPE_BOOL,
84
+ "FreeRDP_DrawAllowColorSubsampling" },
85
+ { FreeRDP_DrawAllowDynamicColorFidelity, FREERDP_SETTINGS_TYPE_BOOL,
86
+ "FreeRDP_DrawAllowDynamicColorFidelity" },
87
+ { FreeRDP_DrawAllowSkipAlpha, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DrawAllowSkipAlpha" },
88
+ { FreeRDP_DrawGdiPlusCacheEnabled, FREERDP_SETTINGS_TYPE_BOOL,
89
+ "FreeRDP_DrawGdiPlusCacheEnabled" },
90
+ { FreeRDP_DrawGdiPlusEnabled, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DrawGdiPlusEnabled" },
91
+ { FreeRDP_DrawNineGridEnabled, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DrawNineGridEnabled" },
92
+ { FreeRDP_DumpRemoteFx, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_DumpRemoteFx" },
93
+ { FreeRDP_DynamicDaylightTimeDisabled, FREERDP_SETTINGS_TYPE_BOOL,
94
+ "FreeRDP_DynamicDaylightTimeDisabled" },
95
+ { FreeRDP_DynamicResolutionUpdate, FREERDP_SETTINGS_TYPE_BOOL,
96
+ "FreeRDP_DynamicResolutionUpdate" },
97
+ { FreeRDP_EmbeddedWindow, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_EmbeddedWindow" },
98
+ { FreeRDP_EnableWindowsKey, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_EnableWindowsKey" },
99
+ { FreeRDP_EncomspVirtualChannel, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_EncomspVirtualChannel" },
100
+ { FreeRDP_ExtSecurity, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_ExtSecurity" },
101
+ { FreeRDP_ExternalCertificateManagement, FREERDP_SETTINGS_TYPE_BOOL,
102
+ "FreeRDP_ExternalCertificateManagement" },
103
+ { FreeRDP_FIPSMode, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_FIPSMode" },
104
+ { FreeRDP_FastPathInput, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_FastPathInput" },
105
+ { FreeRDP_FastPathOutput, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_FastPathOutput" },
106
+ { FreeRDP_ForceEncryptedCsPdu, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_ForceEncryptedCsPdu" },
107
+ { FreeRDP_ForceMultimon, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_ForceMultimon" },
108
+ { FreeRDP_FrameMarkerCommandEnabled, FREERDP_SETTINGS_TYPE_BOOL,
109
+ "FreeRDP_FrameMarkerCommandEnabled" },
110
+ { FreeRDP_Fullscreen, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_Fullscreen" },
111
+ { FreeRDP_GatewayArmTransport, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GatewayArmTransport" },
112
+ { FreeRDP_GatewayAvdUseTenantid, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GatewayAvdUseTenantid" },
113
+ { FreeRDP_GatewayBypassLocal, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GatewayBypassLocal" },
114
+ { FreeRDP_GatewayEnabled, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GatewayEnabled" },
115
+ { FreeRDP_GatewayHttpExtAuthSspiNtlm, FREERDP_SETTINGS_TYPE_BOOL,
116
+ "FreeRDP_GatewayHttpExtAuthSspiNtlm" },
117
+ { FreeRDP_GatewayHttpTransport, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GatewayHttpTransport" },
118
+ { FreeRDP_GatewayHttpUseWebsockets, FREERDP_SETTINGS_TYPE_BOOL,
119
+ "FreeRDP_GatewayHttpUseWebsockets" },
120
+ { FreeRDP_GatewayIgnoreRedirectionPolicy, FREERDP_SETTINGS_TYPE_BOOL,
121
+ "FreeRDP_GatewayIgnoreRedirectionPolicy" },
122
+ { FreeRDP_GatewayRpcTransport, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GatewayRpcTransport" },
123
+ { FreeRDP_GatewayUdpTransport, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GatewayUdpTransport" },
124
+ { FreeRDP_GatewayUseSameCredentials, FREERDP_SETTINGS_TYPE_BOOL,
125
+ "FreeRDP_GatewayUseSameCredentials" },
126
+ { FreeRDP_GfxAVC444, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GfxAVC444" },
127
+ { FreeRDP_GfxAVC444v2, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GfxAVC444v2" },
128
+ { FreeRDP_GfxH264, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GfxH264" },
129
+ { FreeRDP_GfxPlanar, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GfxPlanar" },
130
+ { FreeRDP_GfxProgressive, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GfxProgressive" },
131
+ { FreeRDP_GfxProgressiveV2, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GfxProgressiveV2" },
132
+ { FreeRDP_GfxSendQoeAck, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GfxSendQoeAck" },
133
+ { FreeRDP_GfxSmallCache, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GfxSmallCache" },
134
+ { FreeRDP_GfxSuspendFrameAck, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GfxSuspendFrameAck" },
135
+ { FreeRDP_GfxThinClient, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GfxThinClient" },
136
+ { FreeRDP_GrabKeyboard, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GrabKeyboard" },
137
+ { FreeRDP_GrabMouse, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_GrabMouse" },
138
+ { FreeRDP_HasExtendedMouseEvent, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_HasExtendedMouseEvent" },
139
+ { FreeRDP_HasHorizontalWheel, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_HasHorizontalWheel" },
140
+ { FreeRDP_HasMonitorAttributes, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_HasMonitorAttributes" },
141
+ { FreeRDP_HasQoeEvent, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_HasQoeEvent" },
142
+ { FreeRDP_HasRelativeMouseEvent, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_HasRelativeMouseEvent" },
143
+ { FreeRDP_HiDefRemoteApp, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_HiDefRemoteApp" },
144
+ { FreeRDP_IPv6Enabled, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_IPv6Enabled" },
145
+ { FreeRDP_IgnoreCertificate, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_IgnoreCertificate" },
146
+ { FreeRDP_IgnoreInvalidDevices, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_IgnoreInvalidDevices" },
147
+ { FreeRDP_JpegCodec, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_JpegCodec" },
148
+ { FreeRDP_KerberosRdgIsProxy, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_KerberosRdgIsProxy" },
149
+ { FreeRDP_ListMonitors, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_ListMonitors" },
150
+ { FreeRDP_LocalConnection, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_LocalConnection" },
151
+ { FreeRDP_LogonErrors, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_LogonErrors" },
152
+ { FreeRDP_LogonNotify, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_LogonNotify" },
153
+ { FreeRDP_LongCredentialsSupported, FREERDP_SETTINGS_TYPE_BOOL,
154
+ "FreeRDP_LongCredentialsSupported" },
155
+ { FreeRDP_LyncRdpMode, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_LyncRdpMode" },
156
+ { FreeRDP_MaximizeShell, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_MaximizeShell" },
157
+ { FreeRDP_MouseAttached, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_MouseAttached" },
158
+ { FreeRDP_MouseHasWheel, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_MouseHasWheel" },
159
+ { FreeRDP_MouseMotion, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_MouseMotion" },
160
+ { FreeRDP_MouseUseRelativeMove, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_MouseUseRelativeMove" },
161
+ { FreeRDP_MstscCookieMode, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_MstscCookieMode" },
162
+ { FreeRDP_MultiTouchGestures, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_MultiTouchGestures" },
163
+ { FreeRDP_MultiTouchInput, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_MultiTouchInput" },
164
+ { FreeRDP_NSCodec, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_NSCodec" },
165
+ { FreeRDP_NSCodecAllowDynamicColorFidelity, FREERDP_SETTINGS_TYPE_BOOL,
166
+ "FreeRDP_NSCodecAllowDynamicColorFidelity" },
167
+ { FreeRDP_NSCodecAllowSubsampling, FREERDP_SETTINGS_TYPE_BOOL,
168
+ "FreeRDP_NSCodecAllowSubsampling" },
169
+ { FreeRDP_NegotiateSecurityLayer, FREERDP_SETTINGS_TYPE_BOOL,
170
+ "FreeRDP_NegotiateSecurityLayer" },
171
+ { FreeRDP_NetworkAutoDetect, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_NetworkAutoDetect" },
172
+ { FreeRDP_NlaSecurity, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_NlaSecurity" },
173
+ { FreeRDP_NoBitmapCompressionHeader, FREERDP_SETTINGS_TYPE_BOOL,
174
+ "FreeRDP_NoBitmapCompressionHeader" },
175
+ { FreeRDP_OldLicenseBehaviour, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_OldLicenseBehaviour" },
176
+ { FreeRDP_PasswordIsSmartcardPin, FREERDP_SETTINGS_TYPE_BOOL,
177
+ "FreeRDP_PasswordIsSmartcardPin" },
178
+ { FreeRDP_PercentScreenUseHeight, FREERDP_SETTINGS_TYPE_BOOL,
179
+ "FreeRDP_PercentScreenUseHeight" },
180
+ { FreeRDP_PercentScreenUseWidth, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_PercentScreenUseWidth" },
181
+ { FreeRDP_PlayRemoteFx, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_PlayRemoteFx" },
182
+ { FreeRDP_PreferIPv6OverIPv4, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_PreferIPv6OverIPv4" },
183
+ { FreeRDP_PrintReconnectCookie, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_PrintReconnectCookie" },
184
+ { FreeRDP_PromptForCredentials, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_PromptForCredentials" },
185
+ { FreeRDP_RdpSecurity, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RdpSecurity" },
186
+ { FreeRDP_RdstlsSecurity, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RdstlsSecurity" },
187
+ { FreeRDP_RedirectClipboard, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RedirectClipboard" },
188
+ { FreeRDP_RedirectDrives, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RedirectDrives" },
189
+ { FreeRDP_RedirectHomeDrive, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RedirectHomeDrive" },
190
+ { FreeRDP_RedirectParallelPorts, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RedirectParallelPorts" },
191
+ { FreeRDP_RedirectPrinters, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RedirectPrinters" },
192
+ { FreeRDP_RedirectSerialPorts, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RedirectSerialPorts" },
193
+ { FreeRDP_RedirectSmartCards, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RedirectSmartCards" },
194
+ { FreeRDP_RedirectWebAuthN, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RedirectWebAuthN" },
195
+ { FreeRDP_RefreshRect, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RefreshRect" },
196
+ { FreeRDP_RemdeskVirtualChannel, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RemdeskVirtualChannel" },
197
+ { FreeRDP_RemoteAppLanguageBarSupported, FREERDP_SETTINGS_TYPE_BOOL,
198
+ "FreeRDP_RemoteAppLanguageBarSupported" },
199
+ { FreeRDP_RemoteApplicationMode, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RemoteApplicationMode" },
200
+ { FreeRDP_RemoteAssistanceMode, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RemoteAssistanceMode" },
201
+ { FreeRDP_RemoteAssistanceRequestControl, FREERDP_SETTINGS_TYPE_BOOL,
202
+ "FreeRDP_RemoteAssistanceRequestControl" },
203
+ { FreeRDP_RemoteConsoleAudio, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RemoteConsoleAudio" },
204
+ { FreeRDP_RemoteCredentialGuard, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RemoteCredentialGuard" },
205
+ { FreeRDP_RemoteFxCodec, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RemoteFxCodec" },
206
+ { FreeRDP_RemoteFxImageCodec, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RemoteFxImageCodec" },
207
+ { FreeRDP_RemoteFxOnly, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_RemoteFxOnly" },
208
+ { FreeRDP_RestrictedAdminModeRequired, FREERDP_SETTINGS_TYPE_BOOL,
209
+ "FreeRDP_RestrictedAdminModeRequired" },
210
+ { FreeRDP_SaltedChecksum, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SaltedChecksum" },
211
+ { FreeRDP_SendPreconnectionPdu, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SendPreconnectionPdu" },
212
+ { FreeRDP_ServerLicenseRequired, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_ServerLicenseRequired" },
213
+ { FreeRDP_ServerMode, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_ServerMode" },
214
+ { FreeRDP_SmartSizing, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SmartSizing" },
215
+ { FreeRDP_SmartcardEmulation, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SmartcardEmulation" },
216
+ { FreeRDP_SmartcardLogon, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SmartcardLogon" },
217
+ { FreeRDP_SoftwareGdi, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SoftwareGdi" },
218
+ { FreeRDP_SoundBeepsEnabled, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SoundBeepsEnabled" },
219
+ { FreeRDP_SpanMonitors, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SpanMonitors" },
220
+ { FreeRDP_SupportAsymetricKeys, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SupportAsymetricKeys" },
221
+ { FreeRDP_SupportDisplayControl, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SupportDisplayControl" },
222
+ { FreeRDP_SupportDynamicChannels, FREERDP_SETTINGS_TYPE_BOOL,
223
+ "FreeRDP_SupportDynamicChannels" },
224
+ { FreeRDP_SupportDynamicTimeZone, FREERDP_SETTINGS_TYPE_BOOL,
225
+ "FreeRDP_SupportDynamicTimeZone" },
226
+ { FreeRDP_SupportEchoChannel, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SupportEchoChannel" },
227
+ { FreeRDP_SupportEdgeActionV1, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SupportEdgeActionV1" },
228
+ { FreeRDP_SupportEdgeActionV2, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SupportEdgeActionV2" },
229
+ { FreeRDP_SupportErrorInfoPdu, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SupportErrorInfoPdu" },
230
+ { FreeRDP_SupportGeometryTracking, FREERDP_SETTINGS_TYPE_BOOL,
231
+ "FreeRDP_SupportGeometryTracking" },
232
+ { FreeRDP_SupportGraphicsPipeline, FREERDP_SETTINGS_TYPE_BOOL,
233
+ "FreeRDP_SupportGraphicsPipeline" },
234
+ { FreeRDP_SupportHeartbeatPdu, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SupportHeartbeatPdu" },
235
+ { FreeRDP_SupportMonitorLayoutPdu, FREERDP_SETTINGS_TYPE_BOOL,
236
+ "FreeRDP_SupportMonitorLayoutPdu" },
237
+ { FreeRDP_SupportMultitransport, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SupportMultitransport" },
238
+ { FreeRDP_SupportSSHAgentChannel, FREERDP_SETTINGS_TYPE_BOOL,
239
+ "FreeRDP_SupportSSHAgentChannel" },
240
+ { FreeRDP_SupportSkipChannelJoin, FREERDP_SETTINGS_TYPE_BOOL,
241
+ "FreeRDP_SupportSkipChannelJoin" },
242
+ { FreeRDP_SupportStatusInfoPdu, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SupportStatusInfoPdu" },
243
+ { FreeRDP_SupportVideoOptimized, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SupportVideoOptimized" },
244
+ { FreeRDP_SuppressOutput, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SuppressOutput" },
245
+ { FreeRDP_SurfaceCommandsEnabled, FREERDP_SETTINGS_TYPE_BOOL,
246
+ "FreeRDP_SurfaceCommandsEnabled" },
247
+ { FreeRDP_SurfaceFrameMarkerEnabled, FREERDP_SETTINGS_TYPE_BOOL,
248
+ "FreeRDP_SurfaceFrameMarkerEnabled" },
249
+ { FreeRDP_SuspendInput, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_SuspendInput" },
250
+ { FreeRDP_SynchronousDynamicChannels, FREERDP_SETTINGS_TYPE_BOOL,
251
+ "FreeRDP_SynchronousDynamicChannels" },
252
+ { FreeRDP_SynchronousStaticChannels, FREERDP_SETTINGS_TYPE_BOOL,
253
+ "FreeRDP_SynchronousStaticChannels" },
254
+ { FreeRDP_TcpKeepAlive, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_TcpKeepAlive" },
255
+ { FreeRDP_TlsSecurity, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_TlsSecurity" },
256
+ { FreeRDP_ToggleFullscreen, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_ToggleFullscreen" },
257
+ { FreeRDP_TransportDump, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_TransportDump" },
258
+ { FreeRDP_TransportDumpReplay, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_TransportDumpReplay" },
259
+ { FreeRDP_TransportDumpReplayNodelay, FREERDP_SETTINGS_TYPE_BOOL,
260
+ "FreeRDP_TransportDumpReplayNodelay" },
261
+ { FreeRDP_UnicodeInput, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_UnicodeInput" },
262
+ { FreeRDP_UnmapButtons, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_UnmapButtons" },
263
+ { FreeRDP_UseCommonStdioCallbacks, FREERDP_SETTINGS_TYPE_BOOL,
264
+ "FreeRDP_UseCommonStdioCallbacks" },
265
+ { FreeRDP_UseMultimon, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_UseMultimon" },
266
+ { FreeRDP_UseRdpSecurityLayer, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_UseRdpSecurityLayer" },
267
+ { FreeRDP_UsingSavedCredentials, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_UsingSavedCredentials" },
268
+ { FreeRDP_VideoDisable, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_VideoDisable" },
269
+ { FreeRDP_VmConnectMode, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_VmConnectMode" },
270
+ { FreeRDP_WaitForOutputBufferFlush, FREERDP_SETTINGS_TYPE_BOOL,
271
+ "FreeRDP_WaitForOutputBufferFlush" },
272
+ { FreeRDP_Workarea, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_Workarea" },
273
+ { FreeRDP_CapsGeneralCompressionLevel, FREERDP_SETTINGS_TYPE_UINT16,
274
+ "FreeRDP_CapsGeneralCompressionLevel" },
275
+ { FreeRDP_CapsGeneralCompressionTypes, FREERDP_SETTINGS_TYPE_UINT16,
276
+ "FreeRDP_CapsGeneralCompressionTypes" },
277
+ { FreeRDP_CapsProtocolVersion, FREERDP_SETTINGS_TYPE_UINT16, "FreeRDP_CapsProtocolVersion" },
278
+ { FreeRDP_CapsRemoteUnshareFlag, FREERDP_SETTINGS_TYPE_UINT16,
279
+ "FreeRDP_CapsRemoteUnshareFlag" },
280
+ { FreeRDP_CapsUpdateCapabilityFlag, FREERDP_SETTINGS_TYPE_UINT16,
281
+ "FreeRDP_CapsUpdateCapabilityFlag" },
282
+ { FreeRDP_DesktopOrientation, FREERDP_SETTINGS_TYPE_UINT16, "FreeRDP_DesktopOrientation" },
283
+ { FreeRDP_OrderSupportFlags, FREERDP_SETTINGS_TYPE_UINT16, "FreeRDP_OrderSupportFlags" },
284
+ { FreeRDP_OrderSupportFlagsEx, FREERDP_SETTINGS_TYPE_UINT16, "FreeRDP_OrderSupportFlagsEx" },
285
+ { FreeRDP_ProxyPort, FREERDP_SETTINGS_TYPE_UINT16, "FreeRDP_ProxyPort" },
286
+ { FreeRDP_SupportedColorDepths, FREERDP_SETTINGS_TYPE_UINT16, "FreeRDP_SupportedColorDepths" },
287
+ { FreeRDP_TLSMaxVersion, FREERDP_SETTINGS_TYPE_UINT16, "FreeRDP_TLSMaxVersion" },
288
+ { FreeRDP_TLSMinVersion, FREERDP_SETTINGS_TYPE_UINT16, "FreeRDP_TLSMinVersion" },
289
+ { FreeRDP_TextANSICodePage, FREERDP_SETTINGS_TYPE_UINT16, "FreeRDP_TextANSICodePage" },
290
+ { FreeRDP_AcceptedCertLength, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_AcceptedCertLength" },
291
+ { FreeRDP_AuthenticationLevel, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_AuthenticationLevel" },
292
+ { FreeRDP_AutoReconnectMaxRetries, FREERDP_SETTINGS_TYPE_UINT32,
293
+ "FreeRDP_AutoReconnectMaxRetries" },
294
+ { FreeRDP_BitmapCacheV2NumCells, FREERDP_SETTINGS_TYPE_UINT32,
295
+ "FreeRDP_BitmapCacheV2NumCells" },
296
+ { FreeRDP_BitmapCacheV3CodecId, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_BitmapCacheV3CodecId" },
297
+ { FreeRDP_BitmapCacheVersion, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_BitmapCacheVersion" },
298
+ { FreeRDP_BrushSupportLevel, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_BrushSupportLevel" },
299
+ { FreeRDP_ChannelCount, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ChannelCount" },
300
+ { FreeRDP_ChannelDefArraySize, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ChannelDefArraySize" },
301
+ { FreeRDP_ClientBuild, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ClientBuild" },
302
+ { FreeRDP_ClientRandomLength, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ClientRandomLength" },
303
+ { FreeRDP_ClientSessionId, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ClientSessionId" },
304
+ { FreeRDP_ClipboardFeatureMask, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ClipboardFeatureMask" },
305
+ { FreeRDP_ClusterInfoFlags, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ClusterInfoFlags" },
306
+ { FreeRDP_ColorDepth, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ColorDepth" },
307
+ { FreeRDP_ColorPointerCacheSize, FREERDP_SETTINGS_TYPE_UINT32,
308
+ "FreeRDP_ColorPointerCacheSize" },
309
+ { FreeRDP_CompDeskSupportLevel, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_CompDeskSupportLevel" },
310
+ { FreeRDP_CompressionLevel, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_CompressionLevel" },
311
+ { FreeRDP_ConnectionType, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ConnectionType" },
312
+ { FreeRDP_CookieMaxLength, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_CookieMaxLength" },
313
+ { FreeRDP_DesktopHeight, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_DesktopHeight" },
314
+ { FreeRDP_DesktopPhysicalHeight, FREERDP_SETTINGS_TYPE_UINT32,
315
+ "FreeRDP_DesktopPhysicalHeight" },
316
+ { FreeRDP_DesktopPhysicalWidth, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_DesktopPhysicalWidth" },
317
+ { FreeRDP_DesktopPosX, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_DesktopPosX" },
318
+ { FreeRDP_DesktopPosY, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_DesktopPosY" },
319
+ { FreeRDP_DesktopScaleFactor, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_DesktopScaleFactor" },
320
+ { FreeRDP_DesktopWidth, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_DesktopWidth" },
321
+ { FreeRDP_DeviceArraySize, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_DeviceArraySize" },
322
+ { FreeRDP_DeviceCount, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_DeviceCount" },
323
+ { FreeRDP_DeviceScaleFactor, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_DeviceScaleFactor" },
324
+ { FreeRDP_DrawNineGridCacheEntries, FREERDP_SETTINGS_TYPE_UINT32,
325
+ "FreeRDP_DrawNineGridCacheEntries" },
326
+ { FreeRDP_DrawNineGridCacheSize, FREERDP_SETTINGS_TYPE_UINT32,
327
+ "FreeRDP_DrawNineGridCacheSize" },
328
+ { FreeRDP_DynamicChannelArraySize, FREERDP_SETTINGS_TYPE_UINT32,
329
+ "FreeRDP_DynamicChannelArraySize" },
330
+ { FreeRDP_DynamicChannelCount, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_DynamicChannelCount" },
331
+ { FreeRDP_EarlyCapabilityFlags, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_EarlyCapabilityFlags" },
332
+ { FreeRDP_EncryptionLevel, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_EncryptionLevel" },
333
+ { FreeRDP_EncryptionMethods, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_EncryptionMethods" },
334
+ { FreeRDP_ExtEncryptionMethods, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ExtEncryptionMethods" },
335
+ { FreeRDP_FakeMouseMotionInterval, FREERDP_SETTINGS_TYPE_UINT32,
336
+ "FreeRDP_FakeMouseMotionInterval" },
337
+ { FreeRDP_Floatbar, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_Floatbar" },
338
+ { FreeRDP_ForceIPvX, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ForceIPvX" },
339
+ { FreeRDP_FrameAcknowledge, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_FrameAcknowledge" },
340
+ { FreeRDP_GatewayAcceptedCertLength, FREERDP_SETTINGS_TYPE_UINT32,
341
+ "FreeRDP_GatewayAcceptedCertLength" },
342
+ { FreeRDP_GatewayCredentialsSource, FREERDP_SETTINGS_TYPE_UINT32,
343
+ "FreeRDP_GatewayCredentialsSource" },
344
+ { FreeRDP_GatewayPort, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_GatewayPort" },
345
+ { FreeRDP_GatewayUsageMethod, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_GatewayUsageMethod" },
346
+ { FreeRDP_GfxCapsFilter, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_GfxCapsFilter" },
347
+ { FreeRDP_GlyphSupportLevel, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_GlyphSupportLevel" },
348
+ { FreeRDP_JpegCodecId, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_JpegCodecId" },
349
+ { FreeRDP_JpegQuality, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_JpegQuality" },
350
+ { FreeRDP_KeySpec, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_KeySpec" },
351
+ { FreeRDP_KeyboardCodePage, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_KeyboardCodePage" },
352
+ { FreeRDP_KeyboardFunctionKey, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_KeyboardFunctionKey" },
353
+ { FreeRDP_KeyboardHook, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_KeyboardHook" },
354
+ { FreeRDP_KeyboardLayout, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_KeyboardLayout" },
355
+ { FreeRDP_KeyboardSubType, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_KeyboardSubType" },
356
+ { FreeRDP_KeyboardType, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_KeyboardType" },
357
+ { FreeRDP_LargePointerFlag, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_LargePointerFlag" },
358
+ { FreeRDP_LoadBalanceInfoLength, FREERDP_SETTINGS_TYPE_UINT32,
359
+ "FreeRDP_LoadBalanceInfoLength" },
360
+ { FreeRDP_MonitorAttributeFlags, FREERDP_SETTINGS_TYPE_UINT32,
361
+ "FreeRDP_MonitorAttributeFlags" },
362
+ { FreeRDP_MonitorCount, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_MonitorCount" },
363
+ { FreeRDP_MonitorDefArraySize, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_MonitorDefArraySize" },
364
+ { FreeRDP_MonitorFlags, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_MonitorFlags" },
365
+ { FreeRDP_MonitorLocalShiftX, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_MonitorLocalShiftX" },
366
+ { FreeRDP_MonitorLocalShiftY, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_MonitorLocalShiftY" },
367
+ { FreeRDP_MultifragMaxRequestSize, FREERDP_SETTINGS_TYPE_UINT32,
368
+ "FreeRDP_MultifragMaxRequestSize" },
369
+ { FreeRDP_MultitransportFlags, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_MultitransportFlags" },
370
+ { FreeRDP_NSCodecColorLossLevel, FREERDP_SETTINGS_TYPE_UINT32,
371
+ "FreeRDP_NSCodecColorLossLevel" },
372
+ { FreeRDP_NSCodecId, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_NSCodecId" },
373
+ { FreeRDP_NegotiationFlags, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_NegotiationFlags" },
374
+ { FreeRDP_NumMonitorIds, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_NumMonitorIds" },
375
+ { FreeRDP_OffscreenCacheEntries, FREERDP_SETTINGS_TYPE_UINT32,
376
+ "FreeRDP_OffscreenCacheEntries" },
377
+ { FreeRDP_OffscreenCacheSize, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_OffscreenCacheSize" },
378
+ { FreeRDP_OffscreenSupportLevel, FREERDP_SETTINGS_TYPE_UINT32,
379
+ "FreeRDP_OffscreenSupportLevel" },
380
+ { FreeRDP_OsMajorType, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_OsMajorType" },
381
+ { FreeRDP_OsMinorType, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_OsMinorType" },
382
+ { FreeRDP_Password51Length, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_Password51Length" },
383
+ { FreeRDP_PduSource, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_PduSource" },
384
+ { FreeRDP_PercentScreen, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_PercentScreen" },
385
+ { FreeRDP_PerformanceFlags, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_PerformanceFlags" },
386
+ { FreeRDP_PointerCacheSize, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_PointerCacheSize" },
387
+ { FreeRDP_PreconnectionId, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_PreconnectionId" },
388
+ { FreeRDP_ProxyType, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ProxyType" },
389
+ { FreeRDP_RdpVersion, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_RdpVersion" },
390
+ { FreeRDP_ReceivedCapabilitiesSize, FREERDP_SETTINGS_TYPE_UINT32,
391
+ "FreeRDP_ReceivedCapabilitiesSize" },
392
+ { FreeRDP_RedirectedSessionId, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_RedirectedSessionId" },
393
+ { FreeRDP_RedirectionAcceptedCertLength, FREERDP_SETTINGS_TYPE_UINT32,
394
+ "FreeRDP_RedirectionAcceptedCertLength" },
395
+ { FreeRDP_RedirectionFlags, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_RedirectionFlags" },
396
+ { FreeRDP_RedirectionGuidLength, FREERDP_SETTINGS_TYPE_UINT32,
397
+ "FreeRDP_RedirectionGuidLength" },
398
+ { FreeRDP_RedirectionPasswordLength, FREERDP_SETTINGS_TYPE_UINT32,
399
+ "FreeRDP_RedirectionPasswordLength" },
400
+ { FreeRDP_RedirectionPreferType, FREERDP_SETTINGS_TYPE_UINT32,
401
+ "FreeRDP_RedirectionPreferType" },
402
+ { FreeRDP_RedirectionTsvUrlLength, FREERDP_SETTINGS_TYPE_UINT32,
403
+ "FreeRDP_RedirectionTsvUrlLength" },
404
+ { FreeRDP_RemoteAppNumIconCacheEntries, FREERDP_SETTINGS_TYPE_UINT32,
405
+ "FreeRDP_RemoteAppNumIconCacheEntries" },
406
+ { FreeRDP_RemoteAppNumIconCaches, FREERDP_SETTINGS_TYPE_UINT32,
407
+ "FreeRDP_RemoteAppNumIconCaches" },
408
+ { FreeRDP_RemoteApplicationExpandCmdLine, FREERDP_SETTINGS_TYPE_UINT32,
409
+ "FreeRDP_RemoteApplicationExpandCmdLine" },
410
+ { FreeRDP_RemoteApplicationExpandWorkingDir, FREERDP_SETTINGS_TYPE_UINT32,
411
+ "FreeRDP_RemoteApplicationExpandWorkingDir" },
412
+ { FreeRDP_RemoteApplicationSupportLevel, FREERDP_SETTINGS_TYPE_UINT32,
413
+ "FreeRDP_RemoteApplicationSupportLevel" },
414
+ { FreeRDP_RemoteApplicationSupportMask, FREERDP_SETTINGS_TYPE_UINT32,
415
+ "FreeRDP_RemoteApplicationSupportMask" },
416
+ { FreeRDP_RemoteFxCaptureFlags, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_RemoteFxCaptureFlags" },
417
+ { FreeRDP_RemoteFxCodecId, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_RemoteFxCodecId" },
418
+ { FreeRDP_RemoteFxCodecMode, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_RemoteFxCodecMode" },
419
+ { FreeRDP_RemoteFxRlgrMode, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_RemoteFxRlgrMode" },
420
+ { FreeRDP_RemoteWndSupportLevel, FREERDP_SETTINGS_TYPE_UINT32,
421
+ "FreeRDP_RemoteWndSupportLevel" },
422
+ { FreeRDP_RequestedProtocols, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_RequestedProtocols" },
423
+ { FreeRDP_SelectedProtocol, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_SelectedProtocol" },
424
+ { FreeRDP_ServerCertificateLength, FREERDP_SETTINGS_TYPE_UINT32,
425
+ "FreeRDP_ServerCertificateLength" },
426
+ { FreeRDP_ServerLicenseProductIssuersCount, FREERDP_SETTINGS_TYPE_UINT32,
427
+ "FreeRDP_ServerLicenseProductIssuersCount" },
428
+ { FreeRDP_ServerLicenseProductVersion, FREERDP_SETTINGS_TYPE_UINT32,
429
+ "FreeRDP_ServerLicenseProductVersion" },
430
+ { FreeRDP_ServerPort, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ServerPort" },
431
+ { FreeRDP_ServerRandomLength, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ServerRandomLength" },
432
+ { FreeRDP_ShareId, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ShareId" },
433
+ { FreeRDP_SmartSizingHeight, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_SmartSizingHeight" },
434
+ { FreeRDP_SmartSizingWidth, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_SmartSizingWidth" },
435
+ { FreeRDP_StaticChannelArraySize, FREERDP_SETTINGS_TYPE_UINT32,
436
+ "FreeRDP_StaticChannelArraySize" },
437
+ { FreeRDP_StaticChannelCount, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_StaticChannelCount" },
438
+ { FreeRDP_SurfaceCommandsSupported, FREERDP_SETTINGS_TYPE_UINT32,
439
+ "FreeRDP_SurfaceCommandsSupported" },
440
+ { FreeRDP_TargetNetAddressCount, FREERDP_SETTINGS_TYPE_UINT32,
441
+ "FreeRDP_TargetNetAddressCount" },
442
+ { FreeRDP_TcpAckTimeout, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_TcpAckTimeout" },
443
+ { FreeRDP_TcpConnectTimeout, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_TcpConnectTimeout" },
444
+ { FreeRDP_TcpKeepAliveDelay, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_TcpKeepAliveDelay" },
445
+ { FreeRDP_TcpKeepAliveInterval, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_TcpKeepAliveInterval" },
446
+ { FreeRDP_TcpKeepAliveRetries, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_TcpKeepAliveRetries" },
447
+ { FreeRDP_ThreadingFlags, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_ThreadingFlags" },
448
+ { FreeRDP_TlsSecLevel, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_TlsSecLevel" },
449
+ { FreeRDP_VCChunkSize, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_VCChunkSize" },
450
+ { FreeRDP_VCFlags, FREERDP_SETTINGS_TYPE_UINT32, "FreeRDP_VCFlags" },
451
+ { FreeRDP_MonitorLocalShiftX, FREERDP_SETTINGS_TYPE_INT32, "FreeRDP_MonitorLocalShiftX" },
452
+ { FreeRDP_MonitorLocalShiftY, FREERDP_SETTINGS_TYPE_INT32, "FreeRDP_MonitorLocalShiftY" },
453
+ { FreeRDP_XPan, FREERDP_SETTINGS_TYPE_INT32, "FreeRDP_XPan" },
454
+ { FreeRDP_YPan, FREERDP_SETTINGS_TYPE_INT32, "FreeRDP_YPan" },
455
+ { FreeRDP_ParentWindowId, FREERDP_SETTINGS_TYPE_UINT64, "FreeRDP_ParentWindowId" },
456
+ { FreeRDP_AadServerHostname, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_AadServerHostname" },
457
+ { FreeRDP_AcceptedCert, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_AcceptedCert" },
458
+ { FreeRDP_ActionScript, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ActionScript" },
459
+ { FreeRDP_AllowedTlsCiphers, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_AllowedTlsCiphers" },
460
+ { FreeRDP_AlternateShell, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_AlternateShell" },
461
+ { FreeRDP_AssistanceFile, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_AssistanceFile" },
462
+ { FreeRDP_AuthenticationPackageList, FREERDP_SETTINGS_TYPE_STRING,
463
+ "FreeRDP_AuthenticationPackageList" },
464
+ { FreeRDP_AuthenticationServiceClass, FREERDP_SETTINGS_TYPE_STRING,
465
+ "FreeRDP_AuthenticationServiceClass" },
466
+ { FreeRDP_BitmapCachePersistFile, FREERDP_SETTINGS_TYPE_STRING,
467
+ "FreeRDP_BitmapCachePersistFile" },
468
+ { FreeRDP_CardName, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_CardName" },
469
+ { FreeRDP_CertificateAcceptedFingerprints, FREERDP_SETTINGS_TYPE_STRING,
470
+ "FreeRDP_CertificateAcceptedFingerprints" },
471
+ { FreeRDP_CertificateName, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_CertificateName" },
472
+ { FreeRDP_ClientAddress, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ClientAddress" },
473
+ { FreeRDP_ClientDir, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ClientDir" },
474
+ { FreeRDP_ClientHostname, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ClientHostname" },
475
+ { FreeRDP_ClientProductId, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ClientProductId" },
476
+ { FreeRDP_ClipboardUseSelection, FREERDP_SETTINGS_TYPE_STRING,
477
+ "FreeRDP_ClipboardUseSelection" },
478
+ { FreeRDP_ComputerName, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ComputerName" },
479
+ { FreeRDP_ConfigPath, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ConfigPath" },
480
+ { FreeRDP_ConnectionFile, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ConnectionFile" },
481
+ { FreeRDP_ContainerName, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ContainerName" },
482
+ { FreeRDP_CspName, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_CspName" },
483
+ { FreeRDP_CurrentPath, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_CurrentPath" },
484
+ { FreeRDP_Domain, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_Domain" },
485
+ { FreeRDP_DrivesToRedirect, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_DrivesToRedirect" },
486
+ { FreeRDP_DumpRemoteFxFile, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_DumpRemoteFxFile" },
487
+ { FreeRDP_DynamicDSTTimeZoneKeyName, FREERDP_SETTINGS_TYPE_STRING,
488
+ "FreeRDP_DynamicDSTTimeZoneKeyName" },
489
+ { FreeRDP_GatewayAcceptedCert, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayAcceptedCert" },
490
+ { FreeRDP_GatewayAccessToken, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayAccessToken" },
491
+ { FreeRDP_GatewayAvdAadtenantid, FREERDP_SETTINGS_TYPE_STRING,
492
+ "FreeRDP_GatewayAvdAadtenantid" },
493
+ { FreeRDP_GatewayAvdActivityhint, FREERDP_SETTINGS_TYPE_STRING,
494
+ "FreeRDP_GatewayAvdActivityhint" },
495
+ { FreeRDP_GatewayAvdArmpath, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayAvdArmpath" },
496
+ { FreeRDP_GatewayAvdClientID, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayAvdClientID" },
497
+ { FreeRDP_GatewayAvdDiagnosticserviceurl, FREERDP_SETTINGS_TYPE_STRING,
498
+ "FreeRDP_GatewayAvdDiagnosticserviceurl" },
499
+ { FreeRDP_GatewayAvdGeo, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayAvdGeo" },
500
+ { FreeRDP_GatewayAvdHubdiscoverygeourl, FREERDP_SETTINGS_TYPE_STRING,
501
+ "FreeRDP_GatewayAvdHubdiscoverygeourl" },
502
+ { FreeRDP_GatewayAvdWvdEndpointPool, FREERDP_SETTINGS_TYPE_STRING,
503
+ "FreeRDP_GatewayAvdWvdEndpointPool" },
504
+ { FreeRDP_GatewayAzureActiveDirectory, FREERDP_SETTINGS_TYPE_STRING,
505
+ "FreeRDP_GatewayAzureActiveDirectory" },
506
+ { FreeRDP_GatewayDomain, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayDomain" },
507
+ { FreeRDP_GatewayHostname, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayHostname" },
508
+ { FreeRDP_GatewayHttpExtAuthBearer, FREERDP_SETTINGS_TYPE_STRING,
509
+ "FreeRDP_GatewayHttpExtAuthBearer" },
510
+ { FreeRDP_GatewayPassword, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayPassword" },
511
+ { FreeRDP_GatewayUrl, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayUrl" },
512
+ { FreeRDP_GatewayUsername, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayUsername" },
513
+ { FreeRDP_HomePath, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_HomePath" },
514
+ { FreeRDP_ImeFileName, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ImeFileName" },
515
+ { FreeRDP_KerberosArmor, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_KerberosArmor" },
516
+ { FreeRDP_KerberosCache, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_KerberosCache" },
517
+ { FreeRDP_KerberosKdcUrl, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_KerberosKdcUrl" },
518
+ { FreeRDP_KerberosKeytab, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_KerberosKeytab" },
519
+ { FreeRDP_KerberosLifeTime, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_KerberosLifeTime" },
520
+ { FreeRDP_KerberosRealm, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_KerberosRealm" },
521
+ { FreeRDP_KerberosRenewableLifeTime, FREERDP_SETTINGS_TYPE_STRING,
522
+ "FreeRDP_KerberosRenewableLifeTime" },
523
+ { FreeRDP_KerberosStartTime, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_KerberosStartTime" },
524
+ { FreeRDP_KeyboardPipeName, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_KeyboardPipeName" },
525
+ { FreeRDP_KeyboardRemappingList, FREERDP_SETTINGS_TYPE_STRING,
526
+ "FreeRDP_KeyboardRemappingList" },
527
+ { FreeRDP_NtlmSamFile, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_NtlmSamFile" },
528
+ { FreeRDP_Password, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_Password" },
529
+ { FreeRDP_PasswordHash, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_PasswordHash" },
530
+ { FreeRDP_Pkcs11Module, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_Pkcs11Module" },
531
+ { FreeRDP_PkinitAnchors, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_PkinitAnchors" },
532
+ { FreeRDP_PlayRemoteFxFile, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_PlayRemoteFxFile" },
533
+ { FreeRDP_PreconnectionBlob, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_PreconnectionBlob" },
534
+ { FreeRDP_ProxyHostname, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ProxyHostname" },
535
+ { FreeRDP_ProxyPassword, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ProxyPassword" },
536
+ { FreeRDP_ProxyUsername, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ProxyUsername" },
537
+ { FreeRDP_RDP2TCPArgs, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_RDP2TCPArgs" },
538
+ { FreeRDP_ReaderName, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ReaderName" },
539
+ { FreeRDP_RedirectionAcceptedCert, FREERDP_SETTINGS_TYPE_STRING,
540
+ "FreeRDP_RedirectionAcceptedCert" },
541
+ { FreeRDP_RedirectionDomain, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_RedirectionDomain" },
542
+ { FreeRDP_RedirectionTargetFQDN, FREERDP_SETTINGS_TYPE_STRING,
543
+ "FreeRDP_RedirectionTargetFQDN" },
544
+ { FreeRDP_RedirectionTargetNetBiosName, FREERDP_SETTINGS_TYPE_STRING,
545
+ "FreeRDP_RedirectionTargetNetBiosName" },
546
+ { FreeRDP_RedirectionUsername, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_RedirectionUsername" },
547
+ { FreeRDP_RemoteApplicationCmdLine, FREERDP_SETTINGS_TYPE_STRING,
548
+ "FreeRDP_RemoteApplicationCmdLine" },
549
+ { FreeRDP_RemoteApplicationFile, FREERDP_SETTINGS_TYPE_STRING,
550
+ "FreeRDP_RemoteApplicationFile" },
551
+ { FreeRDP_RemoteApplicationGuid, FREERDP_SETTINGS_TYPE_STRING,
552
+ "FreeRDP_RemoteApplicationGuid" },
553
+ { FreeRDP_RemoteApplicationIcon, FREERDP_SETTINGS_TYPE_STRING,
554
+ "FreeRDP_RemoteApplicationIcon" },
555
+ { FreeRDP_RemoteApplicationName, FREERDP_SETTINGS_TYPE_STRING,
556
+ "FreeRDP_RemoteApplicationName" },
557
+ { FreeRDP_RemoteApplicationProgram, FREERDP_SETTINGS_TYPE_STRING,
558
+ "FreeRDP_RemoteApplicationProgram" },
559
+ { FreeRDP_RemoteApplicationWorkingDir, FREERDP_SETTINGS_TYPE_STRING,
560
+ "FreeRDP_RemoteApplicationWorkingDir" },
561
+ { FreeRDP_RemoteAssistancePassStub, FREERDP_SETTINGS_TYPE_STRING,
562
+ "FreeRDP_RemoteAssistancePassStub" },
563
+ { FreeRDP_RemoteAssistancePassword, FREERDP_SETTINGS_TYPE_STRING,
564
+ "FreeRDP_RemoteAssistancePassword" },
565
+ { FreeRDP_RemoteAssistanceRCTicket, FREERDP_SETTINGS_TYPE_STRING,
566
+ "FreeRDP_RemoteAssistanceRCTicket" },
567
+ { FreeRDP_RemoteAssistanceSessionId, FREERDP_SETTINGS_TYPE_STRING,
568
+ "FreeRDP_RemoteAssistanceSessionId" },
569
+ { FreeRDP_ServerHostname, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_ServerHostname" },
570
+ { FreeRDP_ServerLicenseCompanyName, FREERDP_SETTINGS_TYPE_STRING,
571
+ "FreeRDP_ServerLicenseCompanyName" },
572
+ { FreeRDP_ServerLicenseProductName, FREERDP_SETTINGS_TYPE_STRING,
573
+ "FreeRDP_ServerLicenseProductName" },
574
+ { FreeRDP_ShellWorkingDirectory, FREERDP_SETTINGS_TYPE_STRING,
575
+ "FreeRDP_ShellWorkingDirectory" },
576
+ { FreeRDP_SmartcardCertificate, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_SmartcardCertificate" },
577
+ { FreeRDP_SmartcardPrivateKey, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_SmartcardPrivateKey" },
578
+ { FreeRDP_SspiModule, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_SspiModule" },
579
+ { FreeRDP_TargetNetAddress, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_TargetNetAddress" },
580
+ { FreeRDP_TerminalDescriptor, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_TerminalDescriptor" },
581
+ { FreeRDP_TlsSecretsFile, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_TlsSecretsFile" },
582
+ { FreeRDP_TransportDumpFile, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_TransportDumpFile" },
583
+ { FreeRDP_UserSpecifiedServerName, FREERDP_SETTINGS_TYPE_STRING,
584
+ "FreeRDP_UserSpecifiedServerName" },
585
+ { FreeRDP_Username, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_Username" },
586
+ { FreeRDP_WinSCardModule, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_WinSCardModule" },
587
+ { FreeRDP_WindowTitle, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_WindowTitle" },
588
+ { FreeRDP_WmClass, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_WmClass" },
589
+ { FreeRDP_BitmapCacheV2CellInfo, FREERDP_SETTINGS_TYPE_POINTER,
590
+ "FreeRDP_BitmapCacheV2CellInfo" },
591
+ { FreeRDP_ChannelDefArray, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_ChannelDefArray" },
592
+ { FreeRDP_ClientAutoReconnectCookie, FREERDP_SETTINGS_TYPE_POINTER,
593
+ "FreeRDP_ClientAutoReconnectCookie" },
594
+ { FreeRDP_ClientRandom, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_ClientRandom" },
595
+ { FreeRDP_ClientTimeZone, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_ClientTimeZone" },
596
+ { FreeRDP_DeviceArray, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_DeviceArray" },
597
+ { FreeRDP_DynamicChannelArray, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_DynamicChannelArray" },
598
+ { FreeRDP_FragCache, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_FragCache" },
599
+ { FreeRDP_GlyphCache, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_GlyphCache" },
600
+ { FreeRDP_LoadBalanceInfo, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_LoadBalanceInfo" },
601
+ { FreeRDP_MonitorDefArray, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_MonitorDefArray" },
602
+ { FreeRDP_MonitorIds, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_MonitorIds" },
603
+ { FreeRDP_OrderSupport, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_OrderSupport" },
604
+ { FreeRDP_Password51, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_Password51" },
605
+ { FreeRDP_RdpServerCertificate, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_RdpServerCertificate" },
606
+ { FreeRDP_RdpServerRsaKey, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_RdpServerRsaKey" },
607
+ { FreeRDP_ReceivedCapabilities, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_ReceivedCapabilities" },
608
+ { FreeRDP_ReceivedCapabilityData, FREERDP_SETTINGS_TYPE_POINTER,
609
+ "FreeRDP_ReceivedCapabilityData" },
610
+ { FreeRDP_ReceivedCapabilityDataSizes, FREERDP_SETTINGS_TYPE_POINTER,
611
+ "FreeRDP_ReceivedCapabilityDataSizes" },
612
+ { FreeRDP_RedirectionGuid, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_RedirectionGuid" },
613
+ { FreeRDP_RedirectionPassword, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_RedirectionPassword" },
614
+ { FreeRDP_RedirectionTargetCertificate, FREERDP_SETTINGS_TYPE_POINTER,
615
+ "FreeRDP_RedirectionTargetCertificate" },
616
+ { FreeRDP_RedirectionTsvUrl, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_RedirectionTsvUrl" },
617
+ { FreeRDP_ServerAutoReconnectCookie, FREERDP_SETTINGS_TYPE_POINTER,
618
+ "FreeRDP_ServerAutoReconnectCookie" },
619
+ { FreeRDP_ServerCertificate, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_ServerCertificate" },
620
+ { FreeRDP_ServerLicenseProductIssuers, FREERDP_SETTINGS_TYPE_POINTER,
621
+ "FreeRDP_ServerLicenseProductIssuers" },
622
+ { FreeRDP_ServerRandom, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_ServerRandom" },
623
+ { FreeRDP_StaticChannelArray, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_StaticChannelArray" },
624
+ { FreeRDP_TargetNetAddresses, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_TargetNetAddresses" },
625
+ { FreeRDP_TargetNetPorts, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_TargetNetPorts" },
626
+ { FreeRDP_instance, FREERDP_SETTINGS_TYPE_POINTER, "FreeRDP_instance" },
627
+ };
628
+
629
+ #endif
local-test-freerdp-delta-01/afc-freerdp/libfreerdp/core/security.c ADDED
@@ -0,0 +1,1002 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * FreeRDP: A Remote Desktop Protocol Implementation
3
+ * RDP Security
4
+ *
5
+ * Copyright 2011 Marc-Andre Moreau <[email protected]>
6
+ * Copyright 2014 Norbert Federa <[email protected]>
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+
21
+ #include <freerdp/config.h>
22
+
23
+ #include "settings.h"
24
+ #include "security.h"
25
+
26
+ #include <freerdp/log.h>
27
+ #include <winpr/crypto.h>
28
+
29
+ #define TAG FREERDP_TAG("core")
30
+
31
+ static const BYTE A[] = { 'A' };
32
+ static const BYTE BB[] = { 'B', 'B' };
33
+ static const BYTE CCC[] = { 'C', 'C', 'C' };
34
+
35
+ /* 0x36 repeated 40 times */
36
+ static const BYTE pad1[40] = { "\x36\x36\x36\x36\x36\x36\x36\x36"
37
+ "\x36\x36\x36\x36\x36\x36\x36\x36"
38
+ "\x36\x36\x36\x36\x36\x36\x36\x36"
39
+ "\x36\x36\x36\x36\x36\x36\x36\x36"
40
+ "\x36\x36\x36\x36\x36\x36\x36\x36" };
41
+
42
+ /* 0x5C repeated 48 times */
43
+ static const BYTE pad2[48] = { "\x5C\x5C\x5C\x5C\x5C\x5C\x5C\x5C"
44
+ "\x5C\x5C\x5C\x5C\x5C\x5C\x5C\x5C"
45
+ "\x5C\x5C\x5C\x5C\x5C\x5C\x5C\x5C"
46
+ "\x5C\x5C\x5C\x5C\x5C\x5C\x5C\x5C"
47
+ "\x5C\x5C\x5C\x5C\x5C\x5C\x5C\x5C"
48
+ "\x5C\x5C\x5C\x5C\x5C\x5C\x5C\x5C" };
49
+
50
+ static const BYTE fips_reverse_table[256] = {
51
+ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
52
+ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
53
+ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
54
+ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
55
+ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
56
+ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
57
+ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
58
+ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
59
+ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
60
+ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
61
+ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
62
+ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
63
+ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
64
+ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
65
+ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
66
+ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
67
+ };
68
+
69
+ static const BYTE fips_oddparity_table[256] = {
70
+ 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x07, 0x07, 0x08, 0x08, 0x0b, 0x0b, 0x0d, 0x0d, 0x0e, 0x0e,
71
+ 0x10, 0x10, 0x13, 0x13, 0x15, 0x15, 0x16, 0x16, 0x19, 0x19, 0x1a, 0x1a, 0x1c, 0x1c, 0x1f, 0x1f,
72
+ 0x20, 0x20, 0x23, 0x23, 0x25, 0x25, 0x26, 0x26, 0x29, 0x29, 0x2a, 0x2a, 0x2c, 0x2c, 0x2f, 0x2f,
73
+ 0x31, 0x31, 0x32, 0x32, 0x34, 0x34, 0x37, 0x37, 0x38, 0x38, 0x3b, 0x3b, 0x3d, 0x3d, 0x3e, 0x3e,
74
+ 0x40, 0x40, 0x43, 0x43, 0x45, 0x45, 0x46, 0x46, 0x49, 0x49, 0x4a, 0x4a, 0x4c, 0x4c, 0x4f, 0x4f,
75
+ 0x51, 0x51, 0x52, 0x52, 0x54, 0x54, 0x57, 0x57, 0x58, 0x58, 0x5b, 0x5b, 0x5d, 0x5d, 0x5e, 0x5e,
76
+ 0x61, 0x61, 0x62, 0x62, 0x64, 0x64, 0x67, 0x67, 0x68, 0x68, 0x6b, 0x6b, 0x6d, 0x6d, 0x6e, 0x6e,
77
+ 0x70, 0x70, 0x73, 0x73, 0x75, 0x75, 0x76, 0x76, 0x79, 0x79, 0x7a, 0x7a, 0x7c, 0x7c, 0x7f, 0x7f,
78
+ 0x80, 0x80, 0x83, 0x83, 0x85, 0x85, 0x86, 0x86, 0x89, 0x89, 0x8a, 0x8a, 0x8c, 0x8c, 0x8f, 0x8f,
79
+ 0x91, 0x91, 0x92, 0x92, 0x94, 0x94, 0x97, 0x97, 0x98, 0x98, 0x9b, 0x9b, 0x9d, 0x9d, 0x9e, 0x9e,
80
+ 0xa1, 0xa1, 0xa2, 0xa2, 0xa4, 0xa4, 0xa7, 0xa7, 0xa8, 0xa8, 0xab, 0xab, 0xad, 0xad, 0xae, 0xae,
81
+ 0xb0, 0xb0, 0xb3, 0xb3, 0xb5, 0xb5, 0xb6, 0xb6, 0xb9, 0xb9, 0xba, 0xba, 0xbc, 0xbc, 0xbf, 0xbf,
82
+ 0xc1, 0xc1, 0xc2, 0xc2, 0xc4, 0xc4, 0xc7, 0xc7, 0xc8, 0xc8, 0xcb, 0xcb, 0xcd, 0xcd, 0xce, 0xce,
83
+ 0xd0, 0xd0, 0xd3, 0xd3, 0xd5, 0xd5, 0xd6, 0xd6, 0xd9, 0xd9, 0xda, 0xda, 0xdc, 0xdc, 0xdf, 0xdf,
84
+ 0xe0, 0xe0, 0xe3, 0xe3, 0xe5, 0xe5, 0xe6, 0xe6, 0xe9, 0xe9, 0xea, 0xea, 0xec, 0xec, 0xef, 0xef,
85
+ 0xf1, 0xf1, 0xf2, 0xf2, 0xf4, 0xf4, 0xf7, 0xf7, 0xf8, 0xf8, 0xfb, 0xfb, 0xfd, 0xfd, 0xfe, 0xfe
86
+ };
87
+
88
+ static BOOL security_salted_hash(const BYTE* salt, size_t salt_len, const BYTE* input,
89
+ size_t length, const BYTE* salt1, size_t salt1_len,
90
+ const BYTE* salt2, size_t salt2_len, BYTE* output, size_t out_len)
91
+ {
92
+ WINPR_DIGEST_CTX* sha1 = NULL;
93
+ WINPR_DIGEST_CTX* md5 = NULL;
94
+ BYTE sha1_digest[WINPR_SHA1_DIGEST_LENGTH] = { 0 };
95
+ BOOL result = FALSE;
96
+
97
+ /* SaltedHash(Salt, Input, Salt1, Salt2) = MD5(S + SHA1(Input + Salt + Salt1 + Salt2)) */
98
+ WINPR_ASSERT(out_len >= WINPR_MD5_DIGEST_LENGTH);
99
+
100
+ /* SHA1_Digest = SHA1(Input + Salt + Salt1 + Salt2) */
101
+ if (!(sha1 = winpr_Digest_New()))
102
+ goto out;
103
+
104
+ if (!winpr_Digest_Init(sha1, WINPR_MD_SHA1))
105
+ goto out;
106
+
107
+ if (!winpr_Digest_Update(sha1, input, length)) /* Input */
108
+ goto out;
109
+
110
+ WINPR_ASSERT(salt_len == 48);
111
+ if (!winpr_Digest_Update(sha1, salt, salt_len)) /* Salt (48 bytes) */
112
+ goto out;
113
+
114
+ WINPR_ASSERT(salt1_len == 32);
115
+ if (!winpr_Digest_Update(sha1, salt1, salt1_len)) /* Salt1 (32 bytes) */
116
+ goto out;
117
+
118
+ WINPR_ASSERT(salt2_len == 32);
119
+ if (!winpr_Digest_Update(sha1, salt2, salt2_len)) /* Salt2 (32 bytes) */
120
+ goto out;
121
+
122
+ if (!winpr_Digest_Final(sha1, sha1_digest, sizeof(sha1_digest)))
123
+ goto out;
124
+
125
+ /* SaltedHash(Salt, Input, Salt1, Salt2) = MD5(S + SHA1_Digest) */
126
+ if (!(md5 = winpr_Digest_New()))
127
+ goto out;
128
+
129
+ /* Allow FIPS override for use of MD5 here, this is used for creating hashes of the
130
+ * premaster_secret and master_secret */
131
+ /* used for RDP licensing as described in MS-RDPELE. This is for RDP licensing packets */
132
+ /* which will already be encrypted under FIPS, so the use of MD5 here is not for sensitive data
133
+ * protection. */
134
+ if (!winpr_Digest_Init_Allow_FIPS(md5, WINPR_MD_MD5))
135
+ goto out;
136
+
137
+ if (!winpr_Digest_Update(md5, salt, 48)) /* Salt (48 bytes) */
138
+ goto out;
139
+
140
+ if (!winpr_Digest_Update(md5, sha1_digest, sizeof(sha1_digest))) /* SHA1_Digest */
141
+ goto out;
142
+
143
+ if (!winpr_Digest_Final(md5, output, out_len))
144
+ goto out;
145
+
146
+ result = TRUE;
147
+ out:
148
+ winpr_Digest_Free(sha1);
149
+ winpr_Digest_Free(md5);
150
+ return result;
151
+ }
152
+
153
+ static BOOL security_premaster_hash(const BYTE* input, size_t length, const BYTE* premaster_secret,
154
+ size_t pre_len, const BYTE* client_random, size_t client_len,
155
+ const BYTE* server_random, size_t server_len, BYTE* output,
156
+ size_t out_len)
157
+ {
158
+ /* PremasterHash(Input) = SaltedHash(PremasterSecret, Input, ClientRandom, ServerRandom) */
159
+ return security_salted_hash(premaster_secret, pre_len, input, length, client_random, client_len,
160
+ server_random, server_len, output, out_len);
161
+ }
162
+
163
+ BOOL security_master_secret(const BYTE* premaster_secret, size_t pre_len, const BYTE* client_random,
164
+ size_t client_len, const BYTE* server_random, size_t server_len,
165
+ BYTE* output, size_t out_len)
166
+ {
167
+ /* MasterSecret = PremasterHash('A') + PremasterHash('BB') + PremasterHash('CCC') */
168
+ WINPR_ASSERT(out_len >= 32);
169
+ return security_premaster_hash(A, sizeof(A), premaster_secret, pre_len, client_random,
170
+ client_len, server_random, server_len, &output[0], out_len) &&
171
+ security_premaster_hash(BB, sizeof(BB), premaster_secret, pre_len, client_random,
172
+ client_len, server_random, server_len, &output[16],
173
+ out_len - 16) &&
174
+ security_premaster_hash(CCC, sizeof(CCC), premaster_secret, pre_len, client_random,
175
+ client_len, server_random, server_len, &output[32],
176
+ out_len - 32);
177
+ }
178
+
179
+ static BOOL security_master_hash(const BYTE* input, size_t length, const BYTE* master_secret,
180
+ size_t master_len, const BYTE* client_random, size_t client_len,
181
+ const BYTE* server_random, size_t server_len, BYTE* output,
182
+ size_t out_len)
183
+ {
184
+ /* MasterHash(Input) = SaltedHash(MasterSecret, Input, ServerRandom, ClientRandom) */
185
+ return security_salted_hash(master_secret, master_len, input, length, server_random, server_len,
186
+ client_random, client_len, output, out_len);
187
+ }
188
+
189
+ BOOL security_session_key_blob(const BYTE* master_secret, size_t master_len,
190
+ const BYTE* client_random, size_t client_len,
191
+ const BYTE* server_random, size_t server_len, BYTE* output,
192
+ size_t out_len)
193
+ {
194
+ /* MasterHash = MasterHash('A') + MasterHash('BB') + MasterHash('CCC') */
195
+ WINPR_ASSERT(out_len >= 32);
196
+ return security_master_hash(A, sizeof(A), master_secret, master_len, client_random, client_len,
197
+ server_random, server_len, &output[0], 16) &&
198
+ security_master_hash(BB, sizeof(BB), master_secret, master_len, client_random,
199
+ client_len, server_random, server_len, &output[16], 16) &&
200
+ security_master_hash(CCC, sizeof(CCC), master_secret, master_len, client_random,
201
+ client_len, server_random, server_len, &output[32], out_len - 32);
202
+ }
203
+
204
+ void security_mac_salt_key(const BYTE* session_key_blob, size_t session_len,
205
+ const BYTE* client_random, size_t client_len, const BYTE* server_random,
206
+ size_t server_len, BYTE* output, size_t out_len)
207
+ {
208
+ /* MacSaltKey = First128Bits(SessionKeyBlob) */
209
+ WINPR_ASSERT(out_len >= 16);
210
+ WINPR_ASSERT(session_len >= 16);
211
+ WINPR_UNUSED(client_random);
212
+ WINPR_UNUSED(client_len);
213
+ WINPR_UNUSED(server_random);
214
+ WINPR_UNUSED(server_len);
215
+ memcpy(output, session_key_blob, 16);
216
+ }
217
+
218
+ static BOOL security_md5_16_32_32(const BYTE* in0, const BYTE* in1, const BYTE* in2, BYTE* output,
219
+ size_t out_len)
220
+ {
221
+ WINPR_DIGEST_CTX* md5 = NULL;
222
+ BOOL result = FALSE;
223
+
224
+ WINPR_ASSERT(WINPR_MD5_DIGEST_LENGTH <= out_len);
225
+
226
+ if (!(md5 = winpr_Digest_New()))
227
+ return FALSE;
228
+
229
+ if (!winpr_Digest_Init(md5, WINPR_MD_MD5))
230
+ goto out;
231
+
232
+ if (!winpr_Digest_Update(md5, in0, 16))
233
+ goto out;
234
+
235
+ if (!winpr_Digest_Update(md5, in1, 32))
236
+ goto out;
237
+
238
+ if (!winpr_Digest_Update(md5, in2, 32))
239
+ goto out;
240
+
241
+ if (!winpr_Digest_Final(md5, output, out_len))
242
+ goto out;
243
+
244
+ result = TRUE;
245
+ out:
246
+ winpr_Digest_Free(md5);
247
+ return result;
248
+ }
249
+
250
+ static BOOL security_md5_16_32_32_Allow_FIPS(const BYTE* in0, const BYTE* in1, const BYTE* in2,
251
+ BYTE* output, size_t out_len)
252
+ {
253
+ WINPR_DIGEST_CTX* md5 = NULL;
254
+ BOOL result = FALSE;
255
+
256
+ WINPR_ASSERT(out_len >= WINPR_MD5_DIGEST_LENGTH);
257
+
258
+ if (!(md5 = winpr_Digest_New()))
259
+ return FALSE;
260
+ if (!winpr_Digest_Init_Allow_FIPS(md5, WINPR_MD_MD5))
261
+ goto out;
262
+ if (!winpr_Digest_Update(md5, in0, 16))
263
+ goto out;
264
+ if (!winpr_Digest_Update(md5, in1, 32))
265
+ goto out;
266
+ if (!winpr_Digest_Update(md5, in2, 32))
267
+ goto out;
268
+ if (!winpr_Digest_Final(md5, output, out_len))
269
+ goto out;
270
+
271
+ result = TRUE;
272
+ out:
273
+ winpr_Digest_Free(md5);
274
+ return result;
275
+ }
276
+
277
+ BOOL security_licensing_encryption_key(const BYTE* session_key_blob, size_t session_len,
278
+ const BYTE* client_random, size_t client_len,
279
+ const BYTE* server_random, size_t server_len, BYTE* output,
280
+ size_t out_len)
281
+ {
282
+ if (session_len < 16)
283
+ return FALSE;
284
+ if (client_len < 32)
285
+ return FALSE;
286
+ if (server_len < 32)
287
+ return FALSE;
288
+ /* LicensingEncryptionKey = MD5(Second128Bits(SessionKeyBlob) + ClientRandom + ServerRandom))
289
+ * Allow FIPS use of MD5 here, this is just used for creating the licensing encryption key as
290
+ * described in MS-RDPELE. This is for RDP licensing packets which will already be encrypted
291
+ * under FIPS, so the use of MD5 here is not for sensitive data protection. */
292
+ return security_md5_16_32_32_Allow_FIPS(&session_key_blob[16], client_random, server_random,
293
+ output, out_len);
294
+ }
295
+
296
+ static void security_UINT32_le(BYTE* output, size_t out_len, UINT32 value)
297
+ {
298
+ WINPR_ASSERT(output);
299
+ WINPR_ASSERT(out_len >= 4);
300
+ output[0] = (value)&0xFF;
301
+ output[1] = (value >> 8) & 0xFF;
302
+ output[2] = (value >> 16) & 0xFF;
303
+ output[3] = (value >> 24) & 0xFF;
304
+ }
305
+
306
+ BOOL security_mac_data(const BYTE* mac_salt_key, size_t mac_salt_key_length, const BYTE* data,
307
+ size_t length, BYTE* output, size_t output_length)
308
+ {
309
+ WINPR_DIGEST_CTX* sha1 = NULL;
310
+ WINPR_DIGEST_CTX* md5 = NULL;
311
+ BYTE length_le[4] = { 0 };
312
+ BYTE sha1_digest[WINPR_SHA1_DIGEST_LENGTH] = { 0 };
313
+ BOOL result = FALSE;
314
+
315
+ WINPR_ASSERT(length <= UINT32_MAX);
316
+ WINPR_ASSERT(mac_salt_key_length == WINPR_MD5_DIGEST_LENGTH);
317
+ WINPR_ASSERT(output_length == WINPR_MD5_DIGEST_LENGTH);
318
+
319
+ /* MacData = MD5(MacSaltKey + pad2 + SHA1(MacSaltKey + pad1 + length + data)) */
320
+ security_UINT32_le(length_le, sizeof(length_le),
321
+ (UINT32)length); /* length must be little-endian */
322
+
323
+ /* SHA1_Digest = SHA1(MacSaltKey + pad1 + length + data) */
324
+ if (!(sha1 = winpr_Digest_New()))
325
+ goto out;
326
+
327
+ if (!winpr_Digest_Init(sha1, WINPR_MD_SHA1))
328
+ goto out;
329
+
330
+ if (!winpr_Digest_Update(sha1, mac_salt_key, mac_salt_key_length)) /* MacSaltKey */
331
+ goto out;
332
+
333
+ if (!winpr_Digest_Update(sha1, pad1, sizeof(pad1))) /* pad1 */
334
+ goto out;
335
+
336
+ if (!winpr_Digest_Update(sha1, length_le, sizeof(length_le))) /* length */
337
+ goto out;
338
+
339
+ if (!winpr_Digest_Update(sha1, data, length)) /* data */
340
+ goto out;
341
+
342
+ if (!winpr_Digest_Final(sha1, sha1_digest, sizeof(sha1_digest)))
343
+ goto out;
344
+
345
+ /* MacData = MD5(MacSaltKey + pad2 + SHA1_Digest) */
346
+ if (!(md5 = winpr_Digest_New()))
347
+ goto out;
348
+
349
+ /* Allow FIPS override for use of MD5 here, this is only used for creating the MACData field of
350
+ * the */
351
+ /* Client Platform Challenge Response packet (from MS-RDPELE section 2.2.2.5). This is for RDP
352
+ * licensing packets */
353
+ /* which will already be encrypted under FIPS, so the use of MD5 here is not for sensitive data
354
+ * protection. */
355
+ if (!winpr_Digest_Init_Allow_FIPS(md5, WINPR_MD_MD5))
356
+ goto out;
357
+
358
+ if (!winpr_Digest_Update(md5, mac_salt_key, 16)) /* MacSaltKey */
359
+ goto out;
360
+
361
+ if (!winpr_Digest_Update(md5, pad2, sizeof(pad2))) /* pad2 */
362
+ goto out;
363
+
364
+ if (!winpr_Digest_Update(md5, sha1_digest, sizeof(sha1_digest))) /* SHA1_Digest */
365
+ goto out;
366
+
367
+ if (!winpr_Digest_Final(md5, output, output_length))
368
+ goto out;
369
+
370
+ result = TRUE;
371
+ out:
372
+ if (!result)
373
+ WLog_ERR(TAG, "failed to create security mac");
374
+ winpr_Digest_Free(sha1);
375
+ winpr_Digest_Free(md5);
376
+ return result;
377
+ }
378
+
379
+ BOOL security_mac_signature(rdpRdp* rdp, const BYTE* data, UINT32 length, BYTE* output,
380
+ size_t out_len)
381
+ {
382
+ WINPR_DIGEST_CTX* sha1 = NULL;
383
+ WINPR_DIGEST_CTX* md5 = NULL;
384
+ BYTE length_le[4] = { 0 };
385
+ BYTE md5_digest[WINPR_MD5_DIGEST_LENGTH] = { 0 };
386
+ BYTE sha1_digest[WINPR_SHA1_DIGEST_LENGTH] = { 0 };
387
+ BOOL result = FALSE;
388
+
389
+ WINPR_ASSERT(rdp);
390
+ WINPR_ASSERT(data || (length == 0));
391
+ WINPR_ASSERT(output);
392
+ WINPR_ASSERT(out_len >= 8);
393
+
394
+ security_UINT32_le(length_le, sizeof(length_le), length); /* length must be little-endian */
395
+
396
+ /* SHA1_Digest = SHA1(MACKeyN + pad1 + length + data) */
397
+ if (!(sha1 = winpr_Digest_New()))
398
+ goto out;
399
+
400
+ if (!winpr_Digest_Init(sha1, WINPR_MD_SHA1))
401
+ goto out;
402
+
403
+ if (!winpr_Digest_Update(sha1, rdp->sign_key, rdp->rc4_key_len)) /* MacKeyN */
404
+ goto out;
405
+
406
+ if (!winpr_Digest_Update(sha1, pad1, sizeof(pad1))) /* pad1 */
407
+ goto out;
408
+
409
+ if (!winpr_Digest_Update(sha1, length_le, sizeof(length_le))) /* length */
410
+ goto out;
411
+
412
+ if (!winpr_Digest_Update(sha1, data, length)) /* data */
413
+ goto out;
414
+
415
+ if (!winpr_Digest_Final(sha1, sha1_digest, sizeof(sha1_digest)))
416
+ goto out;
417
+
418
+ /* MACSignature = First64Bits(MD5(MACKeyN + pad2 + SHA1_Digest)) */
419
+ if (!(md5 = winpr_Digest_New()))
420
+ goto out;
421
+
422
+ if (!winpr_Digest_Init(md5, WINPR_MD_MD5))
423
+ goto out;
424
+
425
+ if (!winpr_Digest_Update(md5, rdp->sign_key, rdp->rc4_key_len)) /* MacKeyN */
426
+ goto out;
427
+
428
+ if (!winpr_Digest_Update(md5, pad2, sizeof(pad2))) /* pad2 */
429
+ goto out;
430
+
431
+ if (!winpr_Digest_Update(md5, sha1_digest, sizeof(sha1_digest))) /* SHA1_Digest */
432
+ goto out;
433
+
434
+ if (!winpr_Digest_Final(md5, md5_digest, sizeof(md5_digest)))
435
+ goto out;
436
+
437
+ memcpy(output, md5_digest, 8);
438
+ result = TRUE;
439
+ out:
440
+ if (!result)
441
+ WLog_WARN(TAG, "security mac generation failed");
442
+ winpr_Digest_Free(sha1);
443
+ winpr_Digest_Free(md5);
444
+ return result;
445
+ }
446
+
447
+ BOOL security_salted_mac_signature(rdpRdp* rdp, const BYTE* data, UINT32 length, BOOL encryption,
448
+ BYTE* output, size_t out_len)
449
+ {
450
+ WINPR_DIGEST_CTX* sha1 = NULL;
451
+ WINPR_DIGEST_CTX* md5 = NULL;
452
+ BYTE length_le[4] = { 0 };
453
+ BYTE use_count_le[4] = { 0 };
454
+ BYTE md5_digest[WINPR_MD5_DIGEST_LENGTH] = { 0 };
455
+ BYTE sha1_digest[WINPR_SHA1_DIGEST_LENGTH] = { 0 };
456
+ BOOL result = FALSE;
457
+
458
+ WINPR_ASSERT(rdp);
459
+ WINPR_ASSERT(data || (length == 0));
460
+ WINPR_ASSERT(output);
461
+ WINPR_ASSERT(out_len >= 8);
462
+
463
+ security_UINT32_le(length_le, sizeof(length_le), length); /* length must be little-endian */
464
+
465
+ if (encryption)
466
+ {
467
+ security_UINT32_le(use_count_le, sizeof(use_count_le), rdp->encrypt_checksum_use_count);
468
+ }
469
+ else
470
+ {
471
+ /*
472
+ * We calculate checksum on plain text, so we must have already
473
+ * decrypt it, which means decrypt_checksum_use_count is off by one.
474
+ */
475
+ security_UINT32_le(use_count_le, sizeof(use_count_le),
476
+ rdp->decrypt_checksum_use_count - 1u);
477
+ }
478
+
479
+ /* SHA1_Digest = SHA1(MACKeyN + pad1 + length + data) */
480
+ if (!(sha1 = winpr_Digest_New()))
481
+ goto out;
482
+
483
+ if (!winpr_Digest_Init(sha1, WINPR_MD_SHA1))
484
+ goto out;
485
+
486
+ if (!winpr_Digest_Update(sha1, rdp->sign_key, rdp->rc4_key_len)) /* MacKeyN */
487
+ goto out;
488
+
489
+ if (!winpr_Digest_Update(sha1, pad1, sizeof(pad1))) /* pad1 */
490
+ goto out;
491
+
492
+ if (!winpr_Digest_Update(sha1, length_le, sizeof(length_le))) /* length */
493
+ goto out;
494
+
495
+ if (!winpr_Digest_Update(sha1, data, length)) /* data */
496
+ goto out;
497
+
498
+ if (!winpr_Digest_Update(sha1, use_count_le, sizeof(use_count_le))) /* encryptionCount */
499
+ goto out;
500
+
501
+ if (!winpr_Digest_Final(sha1, sha1_digest, sizeof(sha1_digest)))
502
+ goto out;
503
+
504
+ /* MACSignature = First64Bits(MD5(MACKeyN + pad2 + SHA1_Digest)) */
505
+ if (!(md5 = winpr_Digest_New()))
506
+ goto out;
507
+
508
+ if (!winpr_Digest_Init(md5, WINPR_MD_MD5))
509
+ goto out;
510
+
511
+ if (!winpr_Digest_Update(md5, rdp->sign_key, rdp->rc4_key_len)) /* MacKeyN */
512
+ goto out;
513
+
514
+ if (!winpr_Digest_Update(md5, pad2, sizeof(pad2))) /* pad2 */
515
+ goto out;
516
+
517
+ if (!winpr_Digest_Update(md5, sha1_digest, sizeof(sha1_digest))) /* SHA1_Digest */
518
+ goto out;
519
+
520
+ if (!winpr_Digest_Final(md5, md5_digest, sizeof(md5_digest)))
521
+ goto out;
522
+
523
+ memcpy(output, md5_digest, 8);
524
+ result = TRUE;
525
+ out:
526
+ if (!result)
527
+ WLog_WARN(TAG, "security mac signature generation failed");
528
+
529
+ winpr_Digest_Free(sha1);
530
+ winpr_Digest_Free(md5);
531
+ return result;
532
+ }
533
+
534
+ static BOOL security_A(const BYTE* master_secret, size_t master_len, const BYTE* client_random,
535
+ size_t client_len, const BYTE* server_random, size_t server_len,
536
+ BYTE* output, size_t out_len)
537
+ {
538
+ WINPR_ASSERT(out_len >= 32);
539
+
540
+ return security_premaster_hash(A, sizeof(A), master_secret, master_len, client_random,
541
+ client_len, server_random, server_len, &output[0], 16) &&
542
+ security_premaster_hash(BB, sizeof(BB), master_secret, master_len, client_random,
543
+ client_len, server_random, server_len, &output[16], 16) &&
544
+ security_premaster_hash(CCC, sizeof(CCC), master_secret, master_len, client_random,
545
+ client_len, server_random, server_len, &output[32],
546
+ out_len - 32);
547
+ }
548
+
549
+ static BOOL security_X(const BYTE* master_secret, size_t master_len, const BYTE* client_random,
550
+ size_t client_len, const BYTE* server_random, size_t server_len,
551
+ BYTE* output, size_t out_len)
552
+ {
553
+ const BYTE X[] = { 'X' };
554
+ const BYTE YY[] = { 'Y', 'Y' };
555
+ const BYTE ZZZ[] = { 'Z', 'Z', 'Z' };
556
+
557
+ WINPR_ASSERT(out_len >= 32);
558
+
559
+ return security_premaster_hash(X, sizeof(X), master_secret, master_len, client_random,
560
+ client_len, server_random, server_len, &output[0], 16) &&
561
+ security_premaster_hash(YY, sizeof(YY), master_secret, master_len, client_random,
562
+ client_len, server_random, server_len, &output[16], 16) &&
563
+ security_premaster_hash(ZZZ, sizeof(ZZZ), master_secret, master_len, client_random,
564
+ client_len, server_random, server_len, &output[32],
565
+ out_len - 32);
566
+ }
567
+
568
+ static void fips_expand_key_bits(const BYTE* in, size_t in_len, BYTE* out, size_t out_len)
569
+ {
570
+ BYTE buf[21] = { 0 };
571
+
572
+ WINPR_ASSERT(in);
573
+ WINPR_ASSERT(in_len >= sizeof(buf));
574
+
575
+ WINPR_ASSERT(out);
576
+ WINPR_ASSERT(out_len >= 24);
577
+
578
+ /* reverse every byte in the key */
579
+ for (size_t i = 0; i < sizeof(buf); i++)
580
+ buf[i] = fips_reverse_table[in[i]];
581
+
582
+ /* insert a zero-bit after every 7th bit */
583
+ size_t b = 0;
584
+ for (size_t i = 0; i < 24; i++, b += 7)
585
+ {
586
+ const size_t p = b / 8;
587
+ const size_t r = b % 8;
588
+
589
+ WINPR_ASSERT(p < sizeof(buf));
590
+ if (r <= 1)
591
+ {
592
+ out[i] = (buf[p] << r) & 0xfe;
593
+ }
594
+ else
595
+ {
596
+ WINPR_ASSERT(p + 1 < sizeof(buf));
597
+ /* c is accumulator */
598
+ BYTE c = (BYTE)(buf[p] << r) & 0xFF;
599
+ c |= buf[p + 1] >> (8 - r);
600
+ out[i] = c & 0xfe;
601
+ }
602
+ }
603
+
604
+ /* reverse every byte */
605
+ /* alter lsb so the byte has odd parity */
606
+ for (size_t i = 0; i < 24; i++)
607
+ out[i] = fips_oddparity_table[fips_reverse_table[out[i]]];
608
+ }
609
+
610
+ BOOL security_establish_keys(rdpRdp* rdp)
611
+ {
612
+ BYTE pre_master_secret[48] = { 0 };
613
+ BYTE master_secret[48] = { 0 };
614
+ BYTE session_key_blob[48] = { 0 };
615
+ BYTE salt[] = { 0xD1, 0x26, 0x9E }; /* 40 bits: 3 bytes, 56 bits: 1 byte */
616
+ BOOL status = FALSE;
617
+
618
+ WINPR_ASSERT(rdp);
619
+ const rdpSettings* settings = rdp->settings;
620
+ WINPR_ASSERT(settings);
621
+
622
+ const BYTE* server_random = freerdp_settings_get_pointer(settings, FreeRDP_ServerRandom);
623
+ const BYTE* client_random = freerdp_settings_get_pointer(settings, FreeRDP_ClientRandom);
624
+ WINPR_ASSERT(client_random);
625
+ WINPR_ASSERT(server_random);
626
+
627
+ const UINT32 ClientRandomLength =
628
+ freerdp_settings_get_uint32(settings, FreeRDP_ClientRandomLength);
629
+ const UINT32 ServerRandomLength =
630
+ freerdp_settings_get_uint32(settings, FreeRDP_ServerRandomLength);
631
+ WINPR_ASSERT(ClientRandomLength == 32);
632
+ WINPR_ASSERT(ServerRandomLength == 32);
633
+
634
+ if (settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
635
+ {
636
+ BYTE client_encrypt_key_t[WINPR_SHA1_DIGEST_LENGTH + 1] = { 0 };
637
+ BYTE client_decrypt_key_t[WINPR_SHA1_DIGEST_LENGTH + 1] = { 0 };
638
+ WINPR_DIGEST_CTX* sha1 = winpr_Digest_New();
639
+ if (!sha1)
640
+ return FALSE;
641
+
642
+ if (!winpr_Digest_Init(sha1, WINPR_MD_SHA1) ||
643
+ !winpr_Digest_Update(sha1, client_random + 16, 16) ||
644
+ !winpr_Digest_Update(sha1, server_random + 16, 16) ||
645
+ !winpr_Digest_Final(sha1, client_encrypt_key_t, sizeof(client_encrypt_key_t)))
646
+ {
647
+ winpr_Digest_Free(sha1);
648
+ return FALSE;
649
+ }
650
+
651
+ client_encrypt_key_t[20] = client_encrypt_key_t[0];
652
+
653
+ if (!winpr_Digest_Init(sha1, WINPR_MD_SHA1) ||
654
+ !winpr_Digest_Update(sha1, client_random, 16) ||
655
+ !winpr_Digest_Update(sha1, server_random, 16) ||
656
+ !winpr_Digest_Final(sha1, client_decrypt_key_t, sizeof(client_decrypt_key_t)))
657
+ {
658
+ winpr_Digest_Free(sha1);
659
+ return FALSE;
660
+ }
661
+
662
+ client_decrypt_key_t[20] = client_decrypt_key_t[0];
663
+
664
+ if (!winpr_Digest_Init(sha1, WINPR_MD_SHA1) ||
665
+ !winpr_Digest_Update(sha1, client_decrypt_key_t, WINPR_SHA1_DIGEST_LENGTH) ||
666
+ !winpr_Digest_Update(sha1, client_encrypt_key_t, WINPR_SHA1_DIGEST_LENGTH) ||
667
+ !winpr_Digest_Final(sha1, rdp->fips_sign_key, WINPR_SHA1_DIGEST_LENGTH))
668
+ {
669
+ winpr_Digest_Free(sha1);
670
+ return FALSE;
671
+ }
672
+
673
+ winpr_Digest_Free(sha1);
674
+
675
+ if (settings->ServerMode)
676
+ {
677
+ fips_expand_key_bits(client_encrypt_key_t, sizeof(client_encrypt_key_t),
678
+ rdp->fips_decrypt_key, sizeof(rdp->fips_decrypt_key));
679
+ fips_expand_key_bits(client_decrypt_key_t, sizeof(client_decrypt_key_t),
680
+ rdp->fips_encrypt_key, sizeof(rdp->fips_encrypt_key));
681
+ }
682
+ else
683
+ {
684
+ fips_expand_key_bits(client_encrypt_key_t, sizeof(client_encrypt_key_t),
685
+ rdp->fips_encrypt_key, sizeof(rdp->fips_encrypt_key));
686
+ fips_expand_key_bits(client_decrypt_key_t, sizeof(client_decrypt_key_t),
687
+ rdp->fips_decrypt_key, sizeof(rdp->fips_decrypt_key));
688
+ }
689
+ }
690
+
691
+ memcpy(pre_master_secret, client_random, 24);
692
+ memcpy(pre_master_secret + 24, server_random, 24);
693
+
694
+ if (!security_A(pre_master_secret, sizeof(pre_master_secret), client_random, ClientRandomLength,
695
+ server_random, ServerRandomLength, master_secret, sizeof(master_secret)) ||
696
+ !security_X(master_secret, sizeof(master_secret), client_random, ClientRandomLength,
697
+ server_random, ServerRandomLength, session_key_blob, sizeof(session_key_blob)))
698
+ {
699
+ return FALSE;
700
+ }
701
+
702
+ memcpy(rdp->sign_key, session_key_blob, 16);
703
+
704
+ if (settings->ServerMode)
705
+ {
706
+ status = security_md5_16_32_32(&session_key_blob[16], client_random, server_random,
707
+ rdp->encrypt_key, sizeof(rdp->encrypt_key));
708
+ status &= security_md5_16_32_32(&session_key_blob[32], client_random, server_random,
709
+ rdp->decrypt_key, sizeof(rdp->decrypt_key));
710
+ }
711
+ else
712
+ {
713
+ /* Allow FIPS use of MD5 here, this is just used for generation of the SessionKeyBlob as
714
+ * described in MS-RDPELE. */
715
+ /* This is for RDP licensing packets which will already be encrypted under FIPS, so the use
716
+ * of MD5 here is not */
717
+ /* for sensitive data protection. */
718
+ status =
719
+ security_md5_16_32_32_Allow_FIPS(&session_key_blob[16], client_random, server_random,
720
+ rdp->decrypt_key, sizeof(rdp->decrypt_key));
721
+ status &=
722
+ security_md5_16_32_32_Allow_FIPS(&session_key_blob[32], client_random, server_random,
723
+ rdp->encrypt_key, sizeof(rdp->encrypt_key));
724
+ }
725
+
726
+ if (!status)
727
+ return FALSE;
728
+
729
+ if (settings->EncryptionMethods == ENCRYPTION_METHOD_40BIT)
730
+ {
731
+ memcpy(rdp->sign_key, salt, 3);
732
+ memcpy(rdp->decrypt_key, salt, 3);
733
+ memcpy(rdp->encrypt_key, salt, 3);
734
+ rdp->rc4_key_len = 8;
735
+ }
736
+ else if (settings->EncryptionMethods == ENCRYPTION_METHOD_56BIT)
737
+ {
738
+ memcpy(rdp->sign_key, salt, 1);
739
+ memcpy(rdp->decrypt_key, salt, 1);
740
+ memcpy(rdp->encrypt_key, salt, 1);
741
+ rdp->rc4_key_len = 8;
742
+ }
743
+ else if (settings->EncryptionMethods == ENCRYPTION_METHOD_128BIT)
744
+ {
745
+ rdp->rc4_key_len = 16;
746
+ }
747
+
748
+ if (!security_lock(rdp))
749
+ return FALSE;
750
+ memcpy(rdp->decrypt_update_key, rdp->decrypt_key, 16);
751
+ memcpy(rdp->encrypt_update_key, rdp->encrypt_key, 16);
752
+ rdp->decrypt_use_count = 0;
753
+ rdp->decrypt_checksum_use_count = 0;
754
+ rdp->encrypt_use_count = 0;
755
+ rdp->encrypt_checksum_use_count = 0;
756
+
757
+ return security_unlock(rdp);
758
+ }
759
+
760
+ static BOOL security_key_update(BYTE* key, BYTE* update_key, size_t key_len, rdpRdp* rdp)
761
+ {
762
+ BYTE sha1h[WINPR_SHA1_DIGEST_LENGTH] = { 0 };
763
+ WINPR_DIGEST_CTX* sha1 = NULL;
764
+ WINPR_DIGEST_CTX* md5 = NULL;
765
+ WINPR_RC4_CTX* rc4 = NULL;
766
+ BYTE salt[] = { 0xD1, 0x26, 0x9E }; /* 40 bits: 3 bytes, 56 bits: 1 byte */
767
+ BOOL result = FALSE;
768
+ WLog_DBG(TAG, "updating RDP key");
769
+
770
+ if (!(sha1 = winpr_Digest_New()))
771
+ goto out;
772
+
773
+ if (!winpr_Digest_Init(sha1, WINPR_MD_SHA1))
774
+ goto out;
775
+
776
+ if (!winpr_Digest_Update(sha1, update_key, key_len))
777
+ goto out;
778
+
779
+ if (!winpr_Digest_Update(sha1, pad1, sizeof(pad1)))
780
+ goto out;
781
+
782
+ if (!winpr_Digest_Update(sha1, key, key_len))
783
+ goto out;
784
+
785
+ if (!winpr_Digest_Final(sha1, sha1h, sizeof(sha1h)))
786
+ goto out;
787
+
788
+ if (!(md5 = winpr_Digest_New()))
789
+ goto out;
790
+
791
+ if (!winpr_Digest_Init(md5, WINPR_MD_MD5))
792
+ goto out;
793
+
794
+ if (!winpr_Digest_Update(md5, update_key, key_len))
795
+ goto out;
796
+
797
+ if (!winpr_Digest_Update(md5, pad2, sizeof(pad2)))
798
+ goto out;
799
+
800
+ if (!winpr_Digest_Update(md5, sha1h, sizeof(sha1h)))
801
+ goto out;
802
+
803
+ if (!winpr_Digest_Final(md5, key, WINPR_MD5_DIGEST_LENGTH))
804
+ goto out;
805
+
806
+ if (!(rc4 = winpr_RC4_New(key, key_len)))
807
+ goto out;
808
+
809
+ if (!winpr_RC4_Update(rc4, key_len, key, key))
810
+ goto out;
811
+
812
+ if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_40BIT)
813
+ memcpy(key, salt, 3);
814
+ else if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_56BIT)
815
+ memcpy(key, salt, 1);
816
+
817
+ result = TRUE;
818
+ out:
819
+ winpr_Digest_Free(sha1);
820
+ winpr_Digest_Free(md5);
821
+ winpr_RC4_Free(rc4);
822
+ return result;
823
+ }
824
+
825
+ BOOL security_encrypt(BYTE* data, size_t length, rdpRdp* rdp)
826
+ {
827
+ BOOL rc = FALSE;
828
+
829
+ WINPR_ASSERT(rdp);
830
+ if (!rdp->rc4_encrypt_key)
831
+ {
832
+ WLog_ERR(TAG, "rdp->rc4_encrypt_key=%p", rdp->rc4_encrypt_key);
833
+ goto fail;
834
+ }
835
+
836
+ if (rdp->encrypt_use_count >= 4096)
837
+ {
838
+ if (!security_key_update(rdp->encrypt_key, rdp->encrypt_update_key, rdp->rc4_key_len, rdp))
839
+ goto fail;
840
+
841
+ if (!rdp_reset_rc4_encrypt_keys(rdp))
842
+ goto fail;
843
+ }
844
+
845
+ if (!winpr_RC4_Update(rdp->rc4_encrypt_key, length, data, data))
846
+ goto fail;
847
+
848
+ rdp->encrypt_use_count++;
849
+ rdp->encrypt_checksum_use_count++;
850
+ rc = TRUE;
851
+ fail:
852
+ return rc;
853
+ }
854
+
855
+ BOOL security_decrypt(BYTE* data, size_t length, rdpRdp* rdp)
856
+ {
857
+ BOOL rc = FALSE;
858
+
859
+ WINPR_ASSERT(data || (length == 0));
860
+ WINPR_ASSERT(rdp);
861
+
862
+ if (!rdp->rc4_decrypt_key)
863
+ {
864
+ WLog_ERR(TAG, "rdp->rc4_decrypt_key=%p", rdp->rc4_decrypt_key);
865
+ goto fail;
866
+ }
867
+
868
+ if (rdp->decrypt_use_count >= 4096)
869
+ {
870
+ if (!security_key_update(rdp->decrypt_key, rdp->decrypt_update_key, rdp->rc4_key_len, rdp))
871
+ goto fail;
872
+
873
+ if (!rdp_reset_rc4_decrypt_keys(rdp))
874
+ goto fail;
875
+ }
876
+
877
+ if (!winpr_RC4_Update(rdp->rc4_decrypt_key, length, data, data))
878
+ goto fail;
879
+
880
+ rdp->decrypt_use_count += 1;
881
+ rdp->decrypt_checksum_use_count++;
882
+ rc = TRUE;
883
+ fail:
884
+ if (!rc)
885
+ WLog_WARN(TAG, "Failed to decrypt security");
886
+ return rc;
887
+ }
888
+
889
+ BOOL security_hmac_signature(const BYTE* data, size_t length, BYTE* output, size_t out_len,
890
+ rdpRdp* rdp)
891
+ {
892
+ BYTE buf[WINPR_SHA1_DIGEST_LENGTH] = { 0 };
893
+ BYTE use_count_le[4] = { 0 };
894
+ WINPR_HMAC_CTX* hmac = NULL;
895
+ BOOL result = FALSE;
896
+
897
+ WINPR_ASSERT(rdp);
898
+ WINPR_ASSERT(output);
899
+ WINPR_ASSERT(out_len >= 8);
900
+
901
+ security_UINT32_le(use_count_le, sizeof(use_count_le), rdp->encrypt_use_count);
902
+
903
+ if (!(hmac = winpr_HMAC_New()))
904
+ return FALSE;
905
+
906
+ if (!winpr_HMAC_Init(hmac, WINPR_MD_SHA1, rdp->fips_sign_key, WINPR_SHA1_DIGEST_LENGTH))
907
+ goto out;
908
+
909
+ if (!winpr_HMAC_Update(hmac, data, length))
910
+ goto out;
911
+
912
+ if (!winpr_HMAC_Update(hmac, use_count_le, 4))
913
+ goto out;
914
+
915
+ if (!winpr_HMAC_Final(hmac, buf, WINPR_SHA1_DIGEST_LENGTH))
916
+ goto out;
917
+
918
+ memmove(output, buf, 8);
919
+ result = TRUE;
920
+ out:
921
+ winpr_HMAC_Free(hmac);
922
+ return result;
923
+ }
924
+
925
+ BOOL security_fips_encrypt(BYTE* data, size_t length, rdpRdp* rdp)
926
+ {
927
+ BOOL rc = FALSE;
928
+ size_t olen = 0;
929
+
930
+ if (!winpr_Cipher_Update(rdp->fips_encrypt, data, length, data, &olen))
931
+ goto fail;
932
+
933
+ rdp->encrypt_use_count++;
934
+ rc = TRUE;
935
+ fail:
936
+ return rc;
937
+ }
938
+
939
+ BOOL security_fips_decrypt(BYTE* data, size_t length, rdpRdp* rdp)
940
+ {
941
+ size_t olen = 0;
942
+
943
+ if (!rdp || !rdp->fips_decrypt)
944
+ {
945
+ WLog_ERR(TAG, "rdp=%p, rdp->fips_decrypt=%p", rdp, rdp ? rdp->fips_decrypt : NULL);
946
+ return FALSE;
947
+ }
948
+
949
+ if (!winpr_Cipher_Update(rdp->fips_decrypt, data, length, data, &olen))
950
+ return FALSE;
951
+
952
+ return TRUE;
953
+ }
954
+
955
+ BOOL security_fips_check_signature(const BYTE* data, size_t length, const BYTE* sig, size_t sig_len,
956
+ rdpRdp* rdp)
957
+ {
958
+ BYTE buf[WINPR_SHA1_DIGEST_LENGTH] = { 0 };
959
+ BYTE use_count_le[4] = { 0 };
960
+ WINPR_HMAC_CTX* hmac = NULL;
961
+ BOOL result = FALSE;
962
+
963
+ security_UINT32_le(use_count_le, sizeof(use_count_le), rdp->decrypt_use_count++);
964
+
965
+ if (!(hmac = winpr_HMAC_New()))
966
+ goto out;
967
+
968
+ if (!winpr_HMAC_Init(hmac, WINPR_MD_SHA1, rdp->fips_sign_key, WINPR_SHA1_DIGEST_LENGTH))
969
+ goto out;
970
+
971
+ if (!winpr_HMAC_Update(hmac, data, length))
972
+ goto out;
973
+
974
+ if (!winpr_HMAC_Update(hmac, use_count_le, 4))
975
+ goto out;
976
+
977
+ if (!winpr_HMAC_Final(hmac, buf, WINPR_SHA1_DIGEST_LENGTH))
978
+ goto out;
979
+
980
+ if ((sig_len >= 8) && (memcmp(sig, buf, 8) == 0))
981
+ result = TRUE;
982
+
983
+ out:
984
+ if (!result)
985
+ WLog_WARN(TAG, "signature check failed");
986
+ winpr_HMAC_Free(hmac);
987
+ return result;
988
+ }
989
+
990
+ BOOL security_lock(rdpRdp* rdp)
991
+ {
992
+ WINPR_ASSERT(rdp);
993
+ EnterCriticalSection(&rdp->critical);
994
+ return TRUE;
995
+ }
996
+
997
+ BOOL security_unlock(rdpRdp* rdp)
998
+ {
999
+ WINPR_ASSERT(rdp);
1000
+ LeaveCriticalSection(&rdp->critical);
1001
+ return TRUE;
1002
+ }
local-test-freerdp-delta-01/afc-freerdp/libfreerdp/utils/drdynvc.c ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * FreeRDP: A Remote Desktop Protocol Implementation
3
+ *
4
+ * drdynvc Utils - Helper functions converting something to string
5
+ *
6
+ * Copyright 2023 Armin Novak <[email protected]>
7
+ * Copyright 2023 Thincast Technologies GmbH
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+
22
+ #include <freerdp/utils/drdynvc.h>
23
+ #include <freerdp/channels/drdynvc.h>
24
+
25
+ const char* drdynvc_get_packet_type(BYTE cmd)
26
+ {
27
+ switch (cmd)
28
+ {
29
+ case CREATE_REQUEST_PDU:
30
+ return "CREATE_REQUEST_PDU";
31
+ case DATA_FIRST_PDU:
32
+ return "DATA_FIRST_PDU";
33
+ case DATA_PDU:
34
+ return "DATA_PDU";
35
+ case CLOSE_REQUEST_PDU:
36
+ return "CLOSE_REQUEST_PDU";
37
+ case CAPABILITY_REQUEST_PDU:
38
+ return "CAPABILITY_REQUEST_PDU";
39
+ case DATA_FIRST_COMPRESSED_PDU:
40
+ return "DATA_FIRST_COMPRESSED_PDU";
41
+ case DATA_COMPRESSED_PDU:
42
+ return "DATA_COMPRESSED_PDU";
43
+ case SOFT_SYNC_REQUEST_PDU:
44
+ return "SOFT_SYNC_REQUEST_PDU";
45
+ case SOFT_SYNC_RESPONSE_PDU:
46
+ return "SOFT_SYNC_RESPONSE_PDU";
47
+ default:
48
+ return "UNKNOWN";
49
+ }
50
+ }
local-test-freerdp-delta-01/afc-freerdp/libfreerdp/utils/helpers.c ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * FreeRDP: A Remote Desktop Protocol Implementation
3
+ * common helper utilities
4
+ *
5
+ * Copyright 2024 Armin Novak <[email protected]>
6
+ * Copyright 2024 Thincast Technologies GmbH
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+
21
+ #include <freerdp/utils/helpers.h>
22
+
23
+ #include <winpr/path.h>
24
+ #include <freerdp/version.h>
25
+ #include <freerdp/build-config.h>
26
+
27
+ #if defined(WITH_RESOURCE_VERSIONING)
28
+ #define STR(x) #x
29
+ #endif
30
+
31
+ char* freerdp_GetConfigFilePath(BOOL system, const char* filename)
32
+ {
33
+ eKnownPathTypes id = system ? KNOWN_PATH_SYSTEM_CONFIG_HOME : KNOWN_PATH_XDG_CONFIG_HOME;
34
+
35
+ #if defined(FREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR)
36
+ char* vendor = GetKnownSubPath(id, FREERDP_VENDOR_STRING);
37
+ #else
38
+ char* vendor = GetKnownPath(id);
39
+ #endif
40
+ if (!vendor)
41
+ return NULL;
42
+
43
+ #if defined(WITH_RESOURCE_VERSIONING)
44
+ char* verstr = FREERDP_PRODUCT_STRING STR(FREERDP_VERSION_MAJOR);
45
+ #else
46
+ char* verstr = FREERDP_PRODUCT_STRING;
47
+ #endif
48
+
49
+ char* base = GetCombinedPath(vendor, verstr);
50
+ free(vendor);
51
+
52
+ if (!base)
53
+ return NULL;
54
+
55
+ if (!filename)
56
+ return base;
57
+
58
+ char* path = GetCombinedPath(base, filename);
59
+ free(base);
60
+ return path;
61
+ }
local-test-sqlite3-delta-02/afc-sqlite3/ext/jni/src/c/sqlite3-jni.h ADDED
@@ -0,0 +1,2461 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* DO NOT EDIT THIS FILE - it is machine generated */
2
+ #include <jni.h>
3
+ /* Header for class org_sqlite_jni_capi_CApi */
4
+
5
+ #ifndef _Included_org_sqlite_jni_capi_CApi
6
+ #define _Included_org_sqlite_jni_capi_CApi
7
+ #ifdef __cplusplus
8
+ extern "C" {
9
+ #endif
10
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ACCESS_EXISTS
11
+ #define org_sqlite_jni_capi_CApi_SQLITE_ACCESS_EXISTS 0L
12
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ACCESS_READWRITE
13
+ #define org_sqlite_jni_capi_CApi_SQLITE_ACCESS_READWRITE 1L
14
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ACCESS_READ
15
+ #define org_sqlite_jni_capi_CApi_SQLITE_ACCESS_READ 2L
16
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DENY
17
+ #define org_sqlite_jni_capi_CApi_SQLITE_DENY 1L
18
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IGNORE
19
+ #define org_sqlite_jni_capi_CApi_SQLITE_IGNORE 2L
20
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_INDEX
21
+ #define org_sqlite_jni_capi_CApi_SQLITE_CREATE_INDEX 1L
22
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TABLE
23
+ #define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TABLE 2L
24
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_INDEX
25
+ #define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_INDEX 3L
26
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_TABLE
27
+ #define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_TABLE 4L
28
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_TRIGGER
29
+ #define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_TRIGGER 5L
30
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_VIEW
31
+ #define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_VIEW 6L
32
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TRIGGER
33
+ #define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TRIGGER 7L
34
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_VIEW
35
+ #define org_sqlite_jni_capi_CApi_SQLITE_CREATE_VIEW 8L
36
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DELETE
37
+ #define org_sqlite_jni_capi_CApi_SQLITE_DELETE 9L
38
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DROP_INDEX
39
+ #define org_sqlite_jni_capi_CApi_SQLITE_DROP_INDEX 10L
40
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TABLE
41
+ #define org_sqlite_jni_capi_CApi_SQLITE_DROP_TABLE 11L
42
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_INDEX
43
+ #define org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_INDEX 12L
44
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_TABLE
45
+ #define org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_TABLE 13L
46
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_TRIGGER
47
+ #define org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_TRIGGER 14L
48
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_VIEW
49
+ #define org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_VIEW 15L
50
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TRIGGER
51
+ #define org_sqlite_jni_capi_CApi_SQLITE_DROP_TRIGGER 16L
52
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DROP_VIEW
53
+ #define org_sqlite_jni_capi_CApi_SQLITE_DROP_VIEW 17L
54
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INSERT
55
+ #define org_sqlite_jni_capi_CApi_SQLITE_INSERT 18L
56
+ #undef org_sqlite_jni_capi_CApi_SQLITE_PRAGMA
57
+ #define org_sqlite_jni_capi_CApi_SQLITE_PRAGMA 19L
58
+ #undef org_sqlite_jni_capi_CApi_SQLITE_READ
59
+ #define org_sqlite_jni_capi_CApi_SQLITE_READ 20L
60
+ #undef org_sqlite_jni_capi_CApi_SQLITE_SELECT
61
+ #define org_sqlite_jni_capi_CApi_SQLITE_SELECT 21L
62
+ #undef org_sqlite_jni_capi_CApi_SQLITE_TRANSACTION
63
+ #define org_sqlite_jni_capi_CApi_SQLITE_TRANSACTION 22L
64
+ #undef org_sqlite_jni_capi_CApi_SQLITE_UPDATE
65
+ #define org_sqlite_jni_capi_CApi_SQLITE_UPDATE 23L
66
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ATTACH
67
+ #define org_sqlite_jni_capi_CApi_SQLITE_ATTACH 24L
68
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DETACH
69
+ #define org_sqlite_jni_capi_CApi_SQLITE_DETACH 25L
70
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ALTER_TABLE
71
+ #define org_sqlite_jni_capi_CApi_SQLITE_ALTER_TABLE 26L
72
+ #undef org_sqlite_jni_capi_CApi_SQLITE_REINDEX
73
+ #define org_sqlite_jni_capi_CApi_SQLITE_REINDEX 27L
74
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ANALYZE
75
+ #define org_sqlite_jni_capi_CApi_SQLITE_ANALYZE 28L
76
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_VTABLE
77
+ #define org_sqlite_jni_capi_CApi_SQLITE_CREATE_VTABLE 29L
78
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DROP_VTABLE
79
+ #define org_sqlite_jni_capi_CApi_SQLITE_DROP_VTABLE 30L
80
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FUNCTION
81
+ #define org_sqlite_jni_capi_CApi_SQLITE_FUNCTION 31L
82
+ #undef org_sqlite_jni_capi_CApi_SQLITE_SAVEPOINT
83
+ #define org_sqlite_jni_capi_CApi_SQLITE_SAVEPOINT 32L
84
+ #undef org_sqlite_jni_capi_CApi_SQLITE_RECURSIVE
85
+ #define org_sqlite_jni_capi_CApi_SQLITE_RECURSIVE 33L
86
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STATIC
87
+ #define org_sqlite_jni_capi_CApi_SQLITE_STATIC 0LL
88
+ #undef org_sqlite_jni_capi_CApi_SQLITE_TRANSIENT
89
+ #define org_sqlite_jni_capi_CApi_SQLITE_TRANSIENT -1LL
90
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESETSTART_INVERT
91
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESETSTART_INVERT 2L
92
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_NOSAVEPOINT
93
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_NOSAVEPOINT 1L
94
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_INVERT
95
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_INVERT 2L
96
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_IGNORENOOP
97
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_IGNORENOOP 4L
98
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_DATA
99
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_DATA 1L
100
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_NOTFOUND
101
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_NOTFOUND 2L
102
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_CONFLICT
103
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_CONFLICT 3L
104
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_CONSTRAINT
105
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_CONSTRAINT 4L
106
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_FOREIGN_KEY
107
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_FOREIGN_KEY 5L
108
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_OMIT
109
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_OMIT 0L
110
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_REPLACE
111
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_REPLACE 1L
112
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_ABORT
113
+ #define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_ABORT 2L
114
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SINGLETHREAD
115
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SINGLETHREAD 1L
116
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MULTITHREAD
117
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MULTITHREAD 2L
118
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SERIALIZED
119
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SERIALIZED 3L
120
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MALLOC
121
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MALLOC 4L
122
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETMALLOC
123
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETMALLOC 5L
124
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SCRATCH
125
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SCRATCH 6L
126
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PAGECACHE
127
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PAGECACHE 7L
128
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_HEAP
129
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_HEAP 8L
130
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MEMSTATUS
131
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MEMSTATUS 9L
132
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MUTEX
133
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MUTEX 10L
134
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETMUTEX
135
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETMUTEX 11L
136
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_LOOKASIDE
137
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_LOOKASIDE 13L
138
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE
139
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE 14L
140
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETPCACHE
141
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETPCACHE 15L
142
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_LOG
143
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_LOG 16L
144
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_URI
145
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_URI 17L
146
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE2
147
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE2 18L
148
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETPCACHE2
149
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETPCACHE2 19L
150
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_COVERING_INDEX_SCAN
151
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_COVERING_INDEX_SCAN 20L
152
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SQLLOG
153
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SQLLOG 21L
154
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MMAP_SIZE
155
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MMAP_SIZE 22L
156
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_WIN32_HEAPSIZE
157
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_WIN32_HEAPSIZE 23L
158
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE_HDRSZ
159
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE_HDRSZ 24L
160
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PMASZ
161
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PMASZ 25L
162
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_STMTJRNL_SPILL
163
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_STMTJRNL_SPILL 26L
164
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SMALL_MALLOC
165
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SMALL_MALLOC 27L
166
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SORTERREF_SIZE
167
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SORTERREF_SIZE 28L
168
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MEMDB_MAXSIZE
169
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MEMDB_MAXSIZE 29L
170
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INTEGER
171
+ #define org_sqlite_jni_capi_CApi_SQLITE_INTEGER 1L
172
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FLOAT
173
+ #define org_sqlite_jni_capi_CApi_SQLITE_FLOAT 2L
174
+ #undef org_sqlite_jni_capi_CApi_SQLITE_TEXT
175
+ #define org_sqlite_jni_capi_CApi_SQLITE_TEXT 3L
176
+ #undef org_sqlite_jni_capi_CApi_SQLITE_BLOB
177
+ #define org_sqlite_jni_capi_CApi_SQLITE_BLOB 4L
178
+ #undef org_sqlite_jni_capi_CApi_SQLITE_NULL
179
+ #define org_sqlite_jni_capi_CApi_SQLITE_NULL 5L
180
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_MAINDBNAME
181
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_MAINDBNAME 1000L
182
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LOOKASIDE
183
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LOOKASIDE 1001L
184
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_FKEY
185
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_FKEY 1002L
186
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_TRIGGER
187
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_TRIGGER 1003L
188
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
189
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004L
190
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
191
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005L
192
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
193
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006L
194
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_QPSG
195
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_QPSG 1007L
196
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_TRIGGER_EQP
197
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_TRIGGER_EQP 1008L
198
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_RESET_DATABASE
199
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_RESET_DATABASE 1009L
200
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DEFENSIVE
201
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DEFENSIVE 1010L
202
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_WRITABLE_SCHEMA
203
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011L
204
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LEGACY_ALTER_TABLE
205
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012L
206
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DQS_DML
207
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DQS_DML 1013L
208
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DQS_DDL
209
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DQS_DDL 1014L
210
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_VIEW
211
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_VIEW 1015L
212
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LEGACY_FILE_FORMAT
213
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016L
214
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_TRUSTED_SCHEMA
215
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017L
216
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_STMT_SCANSTATUS
217
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_STMT_SCANSTATUS 1018L
218
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_REVERSE_SCANORDER
219
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_REVERSE_SCANORDER 1019L
220
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_MAX
221
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_MAX 1019L
222
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_USED
223
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_USED 0L
224
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_USED
225
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_USED 1L
226
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_SCHEMA_USED
227
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_SCHEMA_USED 2L
228
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_STMT_USED
229
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_STMT_USED 3L
230
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_HIT
231
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_HIT 4L
232
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE
233
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5L
234
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL
235
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6L
236
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_HIT
237
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_HIT 7L
238
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_MISS
239
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_MISS 8L
240
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_WRITE
241
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_WRITE 9L
242
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_DEFERRED_FKS
243
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_DEFERRED_FKS 10L
244
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_USED_SHARED
245
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_USED_SHARED 11L
246
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_SPILL
247
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_SPILL 12L
248
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_MAX
249
+ #define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_MAX 12L
250
+ #undef org_sqlite_jni_capi_CApi_SQLITE_UTF8
251
+ #define org_sqlite_jni_capi_CApi_SQLITE_UTF8 1L
252
+ #undef org_sqlite_jni_capi_CApi_SQLITE_UTF16LE
253
+ #define org_sqlite_jni_capi_CApi_SQLITE_UTF16LE 2L
254
+ #undef org_sqlite_jni_capi_CApi_SQLITE_UTF16BE
255
+ #define org_sqlite_jni_capi_CApi_SQLITE_UTF16BE 3L
256
+ #undef org_sqlite_jni_capi_CApi_SQLITE_UTF16
257
+ #define org_sqlite_jni_capi_CApi_SQLITE_UTF16 4L
258
+ #undef org_sqlite_jni_capi_CApi_SQLITE_UTF16_ALIGNED
259
+ #define org_sqlite_jni_capi_CApi_SQLITE_UTF16_ALIGNED 8L
260
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LOCKSTATE
261
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LOCKSTATE 1L
262
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_GET_LOCKPROXYFILE
263
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_GET_LOCKPROXYFILE 2L
264
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SET_LOCKPROXYFILE
265
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SET_LOCKPROXYFILE 3L
266
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LAST_ERRNO
267
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LAST_ERRNO 4L
268
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SIZE_HINT
269
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SIZE_HINT 5L
270
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CHUNK_SIZE
271
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CHUNK_SIZE 6L
272
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_FILE_POINTER
273
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_FILE_POINTER 7L
274
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SYNC_OMITTED
275
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SYNC_OMITTED 8L
276
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_AV_RETRY
277
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_AV_RETRY 9L
278
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PERSIST_WAL
279
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PERSIST_WAL 10L
280
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_OVERWRITE
281
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_OVERWRITE 11L
282
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_VFSNAME
283
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_VFSNAME 12L
284
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_POWERSAFE_OVERWRITE
285
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_POWERSAFE_OVERWRITE 13L
286
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PRAGMA
287
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PRAGMA 14L
288
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_BUSYHANDLER
289
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_BUSYHANDLER 15L
290
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_TEMPFILENAME
291
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_TEMPFILENAME 16L
292
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_MMAP_SIZE
293
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_MMAP_SIZE 18L
294
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_TRACE
295
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_TRACE 19L
296
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_HAS_MOVED
297
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_HAS_MOVED 20L
298
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SYNC
299
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SYNC 21L
300
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_COMMIT_PHASETWO
301
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_COMMIT_PHASETWO 22L
302
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_SET_HANDLE
303
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_SET_HANDLE 23L
304
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WAL_BLOCK
305
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WAL_BLOCK 24L
306
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_ZIPVFS
307
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_ZIPVFS 25L
308
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RBU
309
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RBU 26L
310
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_VFS_POINTER
311
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_VFS_POINTER 27L
312
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_JOURNAL_POINTER
313
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_JOURNAL_POINTER 28L
314
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_GET_HANDLE
315
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_GET_HANDLE 29L
316
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PDB
317
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PDB 30L
318
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_BEGIN_ATOMIC_WRITE
319
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31L
320
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_COMMIT_ATOMIC_WRITE
321
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32L
322
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE
323
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33L
324
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LOCK_TIMEOUT
325
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LOCK_TIMEOUT 34L
326
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_DATA_VERSION
327
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_DATA_VERSION 35L
328
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SIZE_LIMIT
329
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SIZE_LIMIT 36L
330
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKPT_DONE
331
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKPT_DONE 37L
332
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RESERVE_BYTES
333
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RESERVE_BYTES 38L
334
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKPT_START
335
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKPT_START 39L
336
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_EXTERNAL_READER
337
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_EXTERNAL_READER 40L
338
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKSM_FILE
339
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKSM_FILE 41L
340
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RESET_CACHE
341
+ #define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RESET_CACHE 42L
342
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LOCK_NONE
343
+ #define org_sqlite_jni_capi_CApi_SQLITE_LOCK_NONE 0L
344
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LOCK_SHARED
345
+ #define org_sqlite_jni_capi_CApi_SQLITE_LOCK_SHARED 1L
346
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LOCK_RESERVED
347
+ #define org_sqlite_jni_capi_CApi_SQLITE_LOCK_RESERVED 2L
348
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LOCK_PENDING
349
+ #define org_sqlite_jni_capi_CApi_SQLITE_LOCK_PENDING 3L
350
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LOCK_EXCLUSIVE
351
+ #define org_sqlite_jni_capi_CApi_SQLITE_LOCK_EXCLUSIVE 4L
352
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC
353
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC 1L
354
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC512
355
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC512 2L
356
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC1K
357
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC1K 4L
358
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC2K
359
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC2K 8L
360
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC4K
361
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC4K 16L
362
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC8K
363
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC8K 32L
364
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC16K
365
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC16K 64L
366
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC32K
367
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC32K 128L
368
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC64K
369
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC64K 256L
370
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_SAFE_APPEND
371
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_SAFE_APPEND 512L
372
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_SEQUENTIAL
373
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_SEQUENTIAL 1024L
374
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
375
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 2048L
376
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_POWERSAFE_OVERWRITE
377
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_POWERSAFE_OVERWRITE 4096L
378
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_IMMUTABLE
379
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_IMMUTABLE 8192L
380
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_BATCH_ATOMIC
381
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_BATCH_ATOMIC 16384L
382
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_LENGTH
383
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_LENGTH 0L
384
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_SQL_LENGTH
385
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_SQL_LENGTH 1L
386
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_COLUMN
387
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_COLUMN 2L
388
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_EXPR_DEPTH
389
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_EXPR_DEPTH 3L
390
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_COMPOUND_SELECT
391
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_COMPOUND_SELECT 4L
392
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_VDBE_OP
393
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_VDBE_OP 5L
394
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_FUNCTION_ARG
395
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_FUNCTION_ARG 6L
396
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_ATTACHED
397
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_ATTACHED 7L
398
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_LIKE_PATTERN_LENGTH
399
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8L
400
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_VARIABLE_NUMBER
401
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_VARIABLE_NUMBER 9L
402
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_TRIGGER_DEPTH
403
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_TRIGGER_DEPTH 10L
404
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_WORKER_THREADS
405
+ #define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_WORKER_THREADS 11L
406
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_READONLY
407
+ #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_READONLY 1L
408
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_READWRITE
409
+ #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_READWRITE 2L
410
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_CREATE
411
+ #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_CREATE 4L
412
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_URI
413
+ #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_URI 64L
414
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_MEMORY
415
+ #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_MEMORY 128L
416
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_NOMUTEX
417
+ #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_NOMUTEX 32768L
418
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_FULLMUTEX
419
+ #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_FULLMUTEX 65536L
420
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_SHAREDCACHE
421
+ #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_SHAREDCACHE 131072L
422
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_PRIVATECACHE
423
+ #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_PRIVATECACHE 262144L
424
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_NOFOLLOW
425
+ #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_NOFOLLOW 16777216L
426
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_EXRESCODE
427
+ #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_EXRESCODE 33554432L
428
+ #undef org_sqlite_jni_capi_CApi_SQLITE_PREPARE_PERSISTENT
429
+ #define org_sqlite_jni_capi_CApi_SQLITE_PREPARE_PERSISTENT 1L
430
+ #undef org_sqlite_jni_capi_CApi_SQLITE_PREPARE_NO_VTAB
431
+ #define org_sqlite_jni_capi_CApi_SQLITE_PREPARE_NO_VTAB 4L
432
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OK
433
+ #define org_sqlite_jni_capi_CApi_SQLITE_OK 0L
434
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ERROR
435
+ #define org_sqlite_jni_capi_CApi_SQLITE_ERROR 1L
436
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INTERNAL
437
+ #define org_sqlite_jni_capi_CApi_SQLITE_INTERNAL 2L
438
+ #undef org_sqlite_jni_capi_CApi_SQLITE_PERM
439
+ #define org_sqlite_jni_capi_CApi_SQLITE_PERM 3L
440
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ABORT
441
+ #define org_sqlite_jni_capi_CApi_SQLITE_ABORT 4L
442
+ #undef org_sqlite_jni_capi_CApi_SQLITE_BUSY
443
+ #define org_sqlite_jni_capi_CApi_SQLITE_BUSY 5L
444
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LOCKED
445
+ #define org_sqlite_jni_capi_CApi_SQLITE_LOCKED 6L
446
+ #undef org_sqlite_jni_capi_CApi_SQLITE_NOMEM
447
+ #define org_sqlite_jni_capi_CApi_SQLITE_NOMEM 7L
448
+ #undef org_sqlite_jni_capi_CApi_SQLITE_READONLY
449
+ #define org_sqlite_jni_capi_CApi_SQLITE_READONLY 8L
450
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INTERRUPT
451
+ #define org_sqlite_jni_capi_CApi_SQLITE_INTERRUPT 9L
452
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR
453
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR 10L
454
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CORRUPT
455
+ #define org_sqlite_jni_capi_CApi_SQLITE_CORRUPT 11L
456
+ #undef org_sqlite_jni_capi_CApi_SQLITE_NOTFOUND
457
+ #define org_sqlite_jni_capi_CApi_SQLITE_NOTFOUND 12L
458
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FULL
459
+ #define org_sqlite_jni_capi_CApi_SQLITE_FULL 13L
460
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN
461
+ #define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN 14L
462
+ #undef org_sqlite_jni_capi_CApi_SQLITE_PROTOCOL
463
+ #define org_sqlite_jni_capi_CApi_SQLITE_PROTOCOL 15L
464
+ #undef org_sqlite_jni_capi_CApi_SQLITE_EMPTY
465
+ #define org_sqlite_jni_capi_CApi_SQLITE_EMPTY 16L
466
+ #undef org_sqlite_jni_capi_CApi_SQLITE_SCHEMA
467
+ #define org_sqlite_jni_capi_CApi_SQLITE_SCHEMA 17L
468
+ #undef org_sqlite_jni_capi_CApi_SQLITE_TOOBIG
469
+ #define org_sqlite_jni_capi_CApi_SQLITE_TOOBIG 18L
470
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT
471
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT 19L
472
+ #undef org_sqlite_jni_capi_CApi_SQLITE_MISMATCH
473
+ #define org_sqlite_jni_capi_CApi_SQLITE_MISMATCH 20L
474
+ #undef org_sqlite_jni_capi_CApi_SQLITE_MISUSE
475
+ #define org_sqlite_jni_capi_CApi_SQLITE_MISUSE 21L
476
+ #undef org_sqlite_jni_capi_CApi_SQLITE_NOLFS
477
+ #define org_sqlite_jni_capi_CApi_SQLITE_NOLFS 22L
478
+ #undef org_sqlite_jni_capi_CApi_SQLITE_AUTH
479
+ #define org_sqlite_jni_capi_CApi_SQLITE_AUTH 23L
480
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FORMAT
481
+ #define org_sqlite_jni_capi_CApi_SQLITE_FORMAT 24L
482
+ #undef org_sqlite_jni_capi_CApi_SQLITE_RANGE
483
+ #define org_sqlite_jni_capi_CApi_SQLITE_RANGE 25L
484
+ #undef org_sqlite_jni_capi_CApi_SQLITE_NOTADB
485
+ #define org_sqlite_jni_capi_CApi_SQLITE_NOTADB 26L
486
+ #undef org_sqlite_jni_capi_CApi_SQLITE_NOTICE
487
+ #define org_sqlite_jni_capi_CApi_SQLITE_NOTICE 27L
488
+ #undef org_sqlite_jni_capi_CApi_SQLITE_WARNING
489
+ #define org_sqlite_jni_capi_CApi_SQLITE_WARNING 28L
490
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ROW
491
+ #define org_sqlite_jni_capi_CApi_SQLITE_ROW 100L
492
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DONE
493
+ #define org_sqlite_jni_capi_CApi_SQLITE_DONE 101L
494
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ERROR_MISSING_COLLSEQ
495
+ #define org_sqlite_jni_capi_CApi_SQLITE_ERROR_MISSING_COLLSEQ 257L
496
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ERROR_RETRY
497
+ #define org_sqlite_jni_capi_CApi_SQLITE_ERROR_RETRY 513L
498
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ERROR_SNAPSHOT
499
+ #define org_sqlite_jni_capi_CApi_SQLITE_ERROR_SNAPSHOT 769L
500
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_READ
501
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_READ 266L
502
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHORT_READ
503
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHORT_READ 522L
504
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_WRITE
505
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_WRITE 778L
506
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_FSYNC
507
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_FSYNC 1034L
508
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_DIR_FSYNC
509
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_DIR_FSYNC 1290L
510
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_TRUNCATE
511
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_TRUNCATE 1546L
512
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_FSTAT
513
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_FSTAT 1802L
514
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_UNLOCK
515
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_UNLOCK 2058L
516
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_RDLOCK
517
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_RDLOCK 2314L
518
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_DELETE
519
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_DELETE 2570L
520
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_BLOCKED
521
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_BLOCKED 2826L
522
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_NOMEM
523
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_NOMEM 3082L
524
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_ACCESS
525
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_ACCESS 3338L
526
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_CHECKRESERVEDLOCK
527
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_CHECKRESERVEDLOCK 3594L
528
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_LOCK
529
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_LOCK 3850L
530
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_CLOSE
531
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_CLOSE 4106L
532
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_DIR_CLOSE
533
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_DIR_CLOSE 4362L
534
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMOPEN
535
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMOPEN 4618L
536
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMSIZE
537
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMSIZE 4874L
538
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMLOCK
539
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMLOCK 5130L
540
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMMAP
541
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMMAP 5386L
542
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SEEK
543
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SEEK 5642L
544
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_DELETE_NOENT
545
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_DELETE_NOENT 5898L
546
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_MMAP
547
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_MMAP 6154L
548
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_GETTEMPPATH
549
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_GETTEMPPATH 6410L
550
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_CONVPATH
551
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_CONVPATH 6666L
552
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_VNODE
553
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_VNODE 6922L
554
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_AUTH
555
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_AUTH 7178L
556
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_BEGIN_ATOMIC
557
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_BEGIN_ATOMIC 7434L
558
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_COMMIT_ATOMIC
559
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_COMMIT_ATOMIC 7690L
560
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_ROLLBACK_ATOMIC
561
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_ROLLBACK_ATOMIC 7946L
562
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_DATA
563
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_DATA 8202L
564
+ #undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_CORRUPTFS
565
+ #define org_sqlite_jni_capi_CApi_SQLITE_IOERR_CORRUPTFS 8458L
566
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LOCKED_SHAREDCACHE
567
+ #define org_sqlite_jni_capi_CApi_SQLITE_LOCKED_SHAREDCACHE 262L
568
+ #undef org_sqlite_jni_capi_CApi_SQLITE_LOCKED_VTAB
569
+ #define org_sqlite_jni_capi_CApi_SQLITE_LOCKED_VTAB 518L
570
+ #undef org_sqlite_jni_capi_CApi_SQLITE_BUSY_RECOVERY
571
+ #define org_sqlite_jni_capi_CApi_SQLITE_BUSY_RECOVERY 261L
572
+ #undef org_sqlite_jni_capi_CApi_SQLITE_BUSY_SNAPSHOT
573
+ #define org_sqlite_jni_capi_CApi_SQLITE_BUSY_SNAPSHOT 517L
574
+ #undef org_sqlite_jni_capi_CApi_SQLITE_BUSY_TIMEOUT
575
+ #define org_sqlite_jni_capi_CApi_SQLITE_BUSY_TIMEOUT 773L
576
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_NOTEMPDIR
577
+ #define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_NOTEMPDIR 270L
578
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_ISDIR
579
+ #define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_ISDIR 526L
580
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_FULLPATH
581
+ #define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_FULLPATH 782L
582
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_CONVPATH
583
+ #define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_CONVPATH 1038L
584
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_SYMLINK
585
+ #define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_SYMLINK 1550L
586
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_VTAB
587
+ #define org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_VTAB 267L
588
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_SEQUENCE
589
+ #define org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_SEQUENCE 523L
590
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_INDEX
591
+ #define org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_INDEX 779L
592
+ #undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_RECOVERY
593
+ #define org_sqlite_jni_capi_CApi_SQLITE_READONLY_RECOVERY 264L
594
+ #undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_CANTLOCK
595
+ #define org_sqlite_jni_capi_CApi_SQLITE_READONLY_CANTLOCK 520L
596
+ #undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_ROLLBACK
597
+ #define org_sqlite_jni_capi_CApi_SQLITE_READONLY_ROLLBACK 776L
598
+ #undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_DBMOVED
599
+ #define org_sqlite_jni_capi_CApi_SQLITE_READONLY_DBMOVED 1032L
600
+ #undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_CANTINIT
601
+ #define org_sqlite_jni_capi_CApi_SQLITE_READONLY_CANTINIT 1288L
602
+ #undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_DIRECTORY
603
+ #define org_sqlite_jni_capi_CApi_SQLITE_READONLY_DIRECTORY 1544L
604
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ABORT_ROLLBACK
605
+ #define org_sqlite_jni_capi_CApi_SQLITE_ABORT_ROLLBACK 516L
606
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_CHECK
607
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_CHECK 275L
608
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_COMMITHOOK
609
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_COMMITHOOK 531L
610
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_FOREIGNKEY
611
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_FOREIGNKEY 787L
612
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_FUNCTION
613
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_FUNCTION 1043L
614
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_NOTNULL
615
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_NOTNULL 1299L
616
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_PRIMARYKEY
617
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_PRIMARYKEY 1555L
618
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_TRIGGER
619
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_TRIGGER 1811L
620
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_UNIQUE
621
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_UNIQUE 2067L
622
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_VTAB
623
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_VTAB 2323L
624
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_ROWID
625
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_ROWID 2579L
626
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_PINNED
627
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_PINNED 2835L
628
+ #undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_DATATYPE
629
+ #define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_DATATYPE 3091L
630
+ #undef org_sqlite_jni_capi_CApi_SQLITE_NOTICE_RECOVER_WAL
631
+ #define org_sqlite_jni_capi_CApi_SQLITE_NOTICE_RECOVER_WAL 283L
632
+ #undef org_sqlite_jni_capi_CApi_SQLITE_NOTICE_RECOVER_ROLLBACK
633
+ #define org_sqlite_jni_capi_CApi_SQLITE_NOTICE_RECOVER_ROLLBACK 539L
634
+ #undef org_sqlite_jni_capi_CApi_SQLITE_WARNING_AUTOINDEX
635
+ #define org_sqlite_jni_capi_CApi_SQLITE_WARNING_AUTOINDEX 284L
636
+ #undef org_sqlite_jni_capi_CApi_SQLITE_AUTH_USER
637
+ #define org_sqlite_jni_capi_CApi_SQLITE_AUTH_USER 279L
638
+ #undef org_sqlite_jni_capi_CApi_SQLITE_OK_LOAD_PERMANENTLY
639
+ #define org_sqlite_jni_capi_CApi_SQLITE_OK_LOAD_PERMANENTLY 256L
640
+ #undef org_sqlite_jni_capi_CApi_SQLITE_SERIALIZE_NOCOPY
641
+ #define org_sqlite_jni_capi_CApi_SQLITE_SERIALIZE_NOCOPY 1L
642
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_FREEONCLOSE
643
+ #define org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_FREEONCLOSE 1L
644
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_READONLY
645
+ #define org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_READONLY 4L
646
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_RESIZEABLE
647
+ #define org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_RESIZEABLE 2L
648
+ #undef org_sqlite_jni_capi_CApi_SQLITE_SESSION_CONFIG_STRMSIZE
649
+ #define org_sqlite_jni_capi_CApi_SQLITE_SESSION_CONFIG_STRMSIZE 1L
650
+ #undef org_sqlite_jni_capi_CApi_SQLITE_SESSION_OBJCONFIG_SIZE
651
+ #define org_sqlite_jni_capi_CApi_SQLITE_SESSION_OBJCONFIG_SIZE 1L
652
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_MEMORY_USED
653
+ #define org_sqlite_jni_capi_CApi_SQLITE_STATUS_MEMORY_USED 0L
654
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_USED
655
+ #define org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_USED 1L
656
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_OVERFLOW
657
+ #define org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_OVERFLOW 2L
658
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_MALLOC_SIZE
659
+ #define org_sqlite_jni_capi_CApi_SQLITE_STATUS_MALLOC_SIZE 5L
660
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_PARSER_STACK
661
+ #define org_sqlite_jni_capi_CApi_SQLITE_STATUS_PARSER_STACK 6L
662
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_SIZE
663
+ #define org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_SIZE 7L
664
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_MALLOC_COUNT
665
+ #define org_sqlite_jni_capi_CApi_SQLITE_STATUS_MALLOC_COUNT 9L
666
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FULLSCAN_STEP
667
+ #define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FULLSCAN_STEP 1L
668
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_SORT
669
+ #define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_SORT 2L
670
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_AUTOINDEX
671
+ #define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_AUTOINDEX 3L
672
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_VM_STEP
673
+ #define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_VM_STEP 4L
674
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_REPREPARE
675
+ #define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_REPREPARE 5L
676
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_RUN
677
+ #define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_RUN 6L
678
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FILTER_MISS
679
+ #define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FILTER_MISS 7L
680
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FILTER_HIT
681
+ #define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FILTER_HIT 8L
682
+ #undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_MEMUSED
683
+ #define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_MEMUSED 99L
684
+ #undef org_sqlite_jni_capi_CApi_SQLITE_SYNC_NORMAL
685
+ #define org_sqlite_jni_capi_CApi_SQLITE_SYNC_NORMAL 2L
686
+ #undef org_sqlite_jni_capi_CApi_SQLITE_SYNC_FULL
687
+ #define org_sqlite_jni_capi_CApi_SQLITE_SYNC_FULL 3L
688
+ #undef org_sqlite_jni_capi_CApi_SQLITE_SYNC_DATAONLY
689
+ #define org_sqlite_jni_capi_CApi_SQLITE_SYNC_DATAONLY 16L
690
+ #undef org_sqlite_jni_capi_CApi_SQLITE_TRACE_STMT
691
+ #define org_sqlite_jni_capi_CApi_SQLITE_TRACE_STMT 1L
692
+ #undef org_sqlite_jni_capi_CApi_SQLITE_TRACE_PROFILE
693
+ #define org_sqlite_jni_capi_CApi_SQLITE_TRACE_PROFILE 2L
694
+ #undef org_sqlite_jni_capi_CApi_SQLITE_TRACE_ROW
695
+ #define org_sqlite_jni_capi_CApi_SQLITE_TRACE_ROW 4L
696
+ #undef org_sqlite_jni_capi_CApi_SQLITE_TRACE_CLOSE
697
+ #define org_sqlite_jni_capi_CApi_SQLITE_TRACE_CLOSE 8L
698
+ #undef org_sqlite_jni_capi_CApi_SQLITE_TXN_NONE
699
+ #define org_sqlite_jni_capi_CApi_SQLITE_TXN_NONE 0L
700
+ #undef org_sqlite_jni_capi_CApi_SQLITE_TXN_READ
701
+ #define org_sqlite_jni_capi_CApi_SQLITE_TXN_READ 1L
702
+ #undef org_sqlite_jni_capi_CApi_SQLITE_TXN_WRITE
703
+ #define org_sqlite_jni_capi_CApi_SQLITE_TXN_WRITE 2L
704
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DETERMINISTIC
705
+ #define org_sqlite_jni_capi_CApi_SQLITE_DETERMINISTIC 2048L
706
+ #undef org_sqlite_jni_capi_CApi_SQLITE_DIRECTONLY
707
+ #define org_sqlite_jni_capi_CApi_SQLITE_DIRECTONLY 524288L
708
+ #undef org_sqlite_jni_capi_CApi_SQLITE_SUBTYPE
709
+ #define org_sqlite_jni_capi_CApi_SQLITE_SUBTYPE 1048576L
710
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INNOCUOUS
711
+ #define org_sqlite_jni_capi_CApi_SQLITE_INNOCUOUS 2097152L
712
+ #undef org_sqlite_jni_capi_CApi_SQLITE_RESULT_SUBTYPE
713
+ #define org_sqlite_jni_capi_CApi_SQLITE_RESULT_SUBTYPE 16777216L
714
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_SCAN_UNIQUE
715
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_SCAN_UNIQUE 1L
716
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_EQ
717
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_EQ 2L
718
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GT
719
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GT 4L
720
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LE
721
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LE 8L
722
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LT
723
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LT 16L
724
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GE
725
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GE 32L
726
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_MATCH
727
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_MATCH 64L
728
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LIKE
729
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LIKE 65L
730
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GLOB
731
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GLOB 66L
732
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_REGEXP
733
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_REGEXP 67L
734
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_NE
735
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_NE 68L
736
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNOT
737
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNOT 69L
738
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNOTNULL
739
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70L
740
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNULL
741
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNULL 71L
742
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_IS
743
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_IS 72L
744
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LIMIT
745
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LIMIT 73L
746
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_OFFSET
747
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_OFFSET 74L
748
+ #undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_FUNCTION
749
+ #define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_FUNCTION 150L
750
+ #undef org_sqlite_jni_capi_CApi_SQLITE_VTAB_CONSTRAINT_SUPPORT
751
+ #define org_sqlite_jni_capi_CApi_SQLITE_VTAB_CONSTRAINT_SUPPORT 1L
752
+ #undef org_sqlite_jni_capi_CApi_SQLITE_VTAB_INNOCUOUS
753
+ #define org_sqlite_jni_capi_CApi_SQLITE_VTAB_INNOCUOUS 2L
754
+ #undef org_sqlite_jni_capi_CApi_SQLITE_VTAB_DIRECTONLY
755
+ #define org_sqlite_jni_capi_CApi_SQLITE_VTAB_DIRECTONLY 3L
756
+ #undef org_sqlite_jni_capi_CApi_SQLITE_VTAB_USES_ALL_SCHEMAS
757
+ #define org_sqlite_jni_capi_CApi_SQLITE_VTAB_USES_ALL_SCHEMAS 4L
758
+ #undef org_sqlite_jni_capi_CApi_SQLITE_ROLLBACK
759
+ #define org_sqlite_jni_capi_CApi_SQLITE_ROLLBACK 1L
760
+ #undef org_sqlite_jni_capi_CApi_SQLITE_FAIL
761
+ #define org_sqlite_jni_capi_CApi_SQLITE_FAIL 3L
762
+ #undef org_sqlite_jni_capi_CApi_SQLITE_REPLACE
763
+ #define org_sqlite_jni_capi_CApi_SQLITE_REPLACE 5L
764
+ /*
765
+ * Class: org_sqlite_jni_capi_CApi
766
+ * Method: init
767
+ * Signature: ()V
768
+ */
769
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_init
770
+ (JNIEnv *, jclass);
771
+
772
+ /*
773
+ * Class: org_sqlite_jni_capi_CApi
774
+ * Method: sqlite3_java_uncache_thread
775
+ * Signature: ()Z
776
+ */
777
+ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1java_1uncache_1thread
778
+ (JNIEnv *, jclass);
779
+
780
+ /*
781
+ * Class: org_sqlite_jni_capi_CApi
782
+ * Method: sqlite3_jni_supports_nio
783
+ * Signature: ()Z
784
+ */
785
+ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1jni_1supports_1nio
786
+ (JNIEnv *, jclass);
787
+
788
+ /*
789
+ * Class: org_sqlite_jni_capi_CApi
790
+ * Method: sqlite3_jni_db_error
791
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;ILjava/lang/String;)I
792
+ */
793
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1jni_1db_1error
794
+ (JNIEnv *, jclass, jobject, jint, jstring);
795
+
796
+ /*
797
+ * Class: org_sqlite_jni_capi_CApi
798
+ * Method: sqlite3_aggregate_context
799
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;Z)J
800
+ */
801
+ JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1aggregate_1context
802
+ (JNIEnv *, jclass, jobject, jboolean);
803
+
804
+ /*
805
+ * Class: org_sqlite_jni_capi_CApi
806
+ * Method: sqlite3_auto_extension
807
+ * Signature: (Lorg/sqlite/jni/capi/AutoExtensionCallback;)I
808
+ */
809
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1auto_1extension
810
+ (JNIEnv *, jclass, jobject);
811
+
812
+ /*
813
+ * Class: org_sqlite_jni_capi_CApi
814
+ * Method: sqlite3_backup_finish
815
+ * Signature: (J)I
816
+ */
817
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1backup_1finish
818
+ (JNIEnv *, jclass, jlong);
819
+
820
+ /*
821
+ * Class: org_sqlite_jni_capi_CApi
822
+ * Method: sqlite3_backup_init
823
+ * Signature: (JLjava/lang/String;JLjava/lang/String;)Lorg/sqlite/jni/capi/sqlite3_backup;
824
+ */
825
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1backup_1init
826
+ (JNIEnv *, jclass, jlong, jstring, jlong, jstring);
827
+
828
+ /*
829
+ * Class: org_sqlite_jni_capi_CApi
830
+ * Method: sqlite3_backup_pagecount
831
+ * Signature: (J)I
832
+ */
833
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1backup_1pagecount
834
+ (JNIEnv *, jclass, jlong);
835
+
836
+ /*
837
+ * Class: org_sqlite_jni_capi_CApi
838
+ * Method: sqlite3_backup_remaining
839
+ * Signature: (J)I
840
+ */
841
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1backup_1remaining
842
+ (JNIEnv *, jclass, jlong);
843
+
844
+ /*
845
+ * Class: org_sqlite_jni_capi_CApi
846
+ * Method: sqlite3_backup_step
847
+ * Signature: (JI)I
848
+ */
849
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1backup_1step
850
+ (JNIEnv *, jclass, jlong, jint);
851
+
852
+ /*
853
+ * Class: org_sqlite_jni_capi_CApi
854
+ * Method: sqlite3_bind_blob
855
+ * Signature: (JI[BI)I
856
+ */
857
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1blob
858
+ (JNIEnv *, jclass, jlong, jint, jbyteArray, jint);
859
+
860
+ /*
861
+ * Class: org_sqlite_jni_capi_CApi
862
+ * Method: sqlite3_bind_double
863
+ * Signature: (JID)I
864
+ */
865
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1double
866
+ (JNIEnv *, jclass, jlong, jint, jdouble);
867
+
868
+ /*
869
+ * Class: org_sqlite_jni_capi_CApi
870
+ * Method: sqlite3_bind_int
871
+ * Signature: (JII)I
872
+ */
873
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1int
874
+ (JNIEnv *, jclass, jlong, jint, jint);
875
+
876
+ /*
877
+ * Class: org_sqlite_jni_capi_CApi
878
+ * Method: sqlite3_bind_int64
879
+ * Signature: (JIJ)I
880
+ */
881
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1int64
882
+ (JNIEnv *, jclass, jlong, jint, jlong);
883
+
884
+ /*
885
+ * Class: org_sqlite_jni_capi_CApi
886
+ * Method: sqlite3_bind_java_object
887
+ * Signature: (JILjava/lang/Object;)I
888
+ */
889
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1java_1object
890
+ (JNIEnv *, jclass, jlong, jint, jobject);
891
+
892
+ /*
893
+ * Class: org_sqlite_jni_capi_CApi
894
+ * Method: sqlite3_bind_nio_buffer
895
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;ILjava/nio/ByteBuffer;II)I
896
+ */
897
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1nio_1buffer
898
+ (JNIEnv *, jclass, jobject, jint, jobject, jint, jint);
899
+
900
+ /*
901
+ * Class: org_sqlite_jni_capi_CApi
902
+ * Method: sqlite3_bind_null
903
+ * Signature: (JI)I
904
+ */
905
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1null
906
+ (JNIEnv *, jclass, jlong, jint);
907
+
908
+ /*
909
+ * Class: org_sqlite_jni_capi_CApi
910
+ * Method: sqlite3_bind_parameter_count
911
+ * Signature: (J)I
912
+ */
913
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1parameter_1count
914
+ (JNIEnv *, jclass, jlong);
915
+
916
+ /*
917
+ * Class: org_sqlite_jni_capi_CApi
918
+ * Method: sqlite3_bind_parameter_index
919
+ * Signature: (J[B)I
920
+ */
921
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1parameter_1index
922
+ (JNIEnv *, jclass, jlong, jbyteArray);
923
+
924
+ /*
925
+ * Class: org_sqlite_jni_capi_CApi
926
+ * Method: sqlite3_bind_parameter_name
927
+ * Signature: (JI)Ljava/lang/String;
928
+ */
929
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1parameter_1name
930
+ (JNIEnv *, jclass, jlong, jint);
931
+
932
+ /*
933
+ * Class: org_sqlite_jni_capi_CApi
934
+ * Method: sqlite3_bind_text
935
+ * Signature: (JI[BI)I
936
+ */
937
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1text
938
+ (JNIEnv *, jclass, jlong, jint, jbyteArray, jint);
939
+
940
+ /*
941
+ * Class: org_sqlite_jni_capi_CApi
942
+ * Method: sqlite3_bind_text16
943
+ * Signature: (JI[BI)I
944
+ */
945
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1text16
946
+ (JNIEnv *, jclass, jlong, jint, jbyteArray, jint);
947
+
948
+ /*
949
+ * Class: org_sqlite_jni_capi_CApi
950
+ * Method: sqlite3_bind_value
951
+ * Signature: (JIJ)I
952
+ */
953
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1value
954
+ (JNIEnv *, jclass, jlong, jint, jlong);
955
+
956
+ /*
957
+ * Class: org_sqlite_jni_capi_CApi
958
+ * Method: sqlite3_bind_zeroblob
959
+ * Signature: (JII)I
960
+ */
961
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1zeroblob
962
+ (JNIEnv *, jclass, jlong, jint, jint);
963
+
964
+ /*
965
+ * Class: org_sqlite_jni_capi_CApi
966
+ * Method: sqlite3_bind_zeroblob64
967
+ * Signature: (JIJ)I
968
+ */
969
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1zeroblob64
970
+ (JNIEnv *, jclass, jlong, jint, jlong);
971
+
972
+ /*
973
+ * Class: org_sqlite_jni_capi_CApi
974
+ * Method: sqlite3_blob_bytes
975
+ * Signature: (J)I
976
+ */
977
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1bytes
978
+ (JNIEnv *, jclass, jlong);
979
+
980
+ /*
981
+ * Class: org_sqlite_jni_capi_CApi
982
+ * Method: sqlite3_blob_close
983
+ * Signature: (J)I
984
+ */
985
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1close
986
+ (JNIEnv *, jclass, jlong);
987
+
988
+ /*
989
+ * Class: org_sqlite_jni_capi_CApi
990
+ * Method: sqlite3_blob_open
991
+ * Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;JILorg/sqlite/jni/capi/OutputPointer/sqlite3_blob;)I
992
+ */
993
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1open
994
+ (JNIEnv *, jclass, jlong, jstring, jstring, jstring, jlong, jint, jobject);
995
+
996
+ /*
997
+ * Class: org_sqlite_jni_capi_CApi
998
+ * Method: sqlite3_blob_read
999
+ * Signature: (J[BI)I
1000
+ */
1001
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1read
1002
+ (JNIEnv *, jclass, jlong, jbyteArray, jint);
1003
+
1004
+ /*
1005
+ * Class: org_sqlite_jni_capi_CApi
1006
+ * Method: sqlite3_blob_read_nio_buffer
1007
+ * Signature: (JILjava/nio/ByteBuffer;II)I
1008
+ */
1009
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1read_1nio_1buffer
1010
+ (JNIEnv *, jclass, jlong, jint, jobject, jint, jint);
1011
+
1012
+ /*
1013
+ * Class: org_sqlite_jni_capi_CApi
1014
+ * Method: sqlite3_blob_reopen
1015
+ * Signature: (JJ)I
1016
+ */
1017
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1reopen
1018
+ (JNIEnv *, jclass, jlong, jlong);
1019
+
1020
+ /*
1021
+ * Class: org_sqlite_jni_capi_CApi
1022
+ * Method: sqlite3_blob_write
1023
+ * Signature: (J[BI)I
1024
+ */
1025
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1write
1026
+ (JNIEnv *, jclass, jlong, jbyteArray, jint);
1027
+
1028
+ /*
1029
+ * Class: org_sqlite_jni_capi_CApi
1030
+ * Method: sqlite3_blob_write_nio_buffer
1031
+ * Signature: (JILjava/nio/ByteBuffer;II)I
1032
+ */
1033
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1write_1nio_1buffer
1034
+ (JNIEnv *, jclass, jlong, jint, jobject, jint, jint);
1035
+
1036
+ /*
1037
+ * Class: org_sqlite_jni_capi_CApi
1038
+ * Method: sqlite3_busy_handler
1039
+ * Signature: (JLorg/sqlite/jni/capi/BusyHandlerCallback;)I
1040
+ */
1041
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1busy_1handler
1042
+ (JNIEnv *, jclass, jlong, jobject);
1043
+
1044
+ /*
1045
+ * Class: org_sqlite_jni_capi_CApi
1046
+ * Method: sqlite3_busy_timeout
1047
+ * Signature: (JI)I
1048
+ */
1049
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1busy_1timeout
1050
+ (JNIEnv *, jclass, jlong, jint);
1051
+
1052
+ /*
1053
+ * Class: org_sqlite_jni_capi_CApi
1054
+ * Method: sqlite3_cancel_auto_extension
1055
+ * Signature: (Lorg/sqlite/jni/capi/AutoExtensionCallback;)Z
1056
+ */
1057
+ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1cancel_1auto_1extension
1058
+ (JNIEnv *, jclass, jobject);
1059
+
1060
+ /*
1061
+ * Class: org_sqlite_jni_capi_CApi
1062
+ * Method: sqlite3_changes
1063
+ * Signature: (J)I
1064
+ */
1065
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1changes
1066
+ (JNIEnv *, jclass, jlong);
1067
+
1068
+ /*
1069
+ * Class: org_sqlite_jni_capi_CApi
1070
+ * Method: sqlite3_changes64
1071
+ * Signature: (J)J
1072
+ */
1073
+ JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1changes64
1074
+ (JNIEnv *, jclass, jlong);
1075
+
1076
+ /*
1077
+ * Class: org_sqlite_jni_capi_CApi
1078
+ * Method: sqlite3_clear_bindings
1079
+ * Signature: (J)I
1080
+ */
1081
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1clear_1bindings
1082
+ (JNIEnv *, jclass, jlong);
1083
+
1084
+ /*
1085
+ * Class: org_sqlite_jni_capi_CApi
1086
+ * Method: sqlite3_close
1087
+ * Signature: (J)I
1088
+ */
1089
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1close
1090
+ (JNIEnv *, jclass, jlong);
1091
+
1092
+ /*
1093
+ * Class: org_sqlite_jni_capi_CApi
1094
+ * Method: sqlite3_close_v2
1095
+ * Signature: (J)I
1096
+ */
1097
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1close_1v2
1098
+ (JNIEnv *, jclass, jlong);
1099
+
1100
+ /*
1101
+ * Class: org_sqlite_jni_capi_CApi
1102
+ * Method: sqlite3_column_blob
1103
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)[B
1104
+ */
1105
+ JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1blob
1106
+ (JNIEnv *, jclass, jobject, jint);
1107
+
1108
+ /*
1109
+ * Class: org_sqlite_jni_capi_CApi
1110
+ * Method: sqlite3_column_bytes
1111
+ * Signature: (JI)I
1112
+ */
1113
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1bytes
1114
+ (JNIEnv *, jclass, jlong, jint);
1115
+
1116
+ /*
1117
+ * Class: org_sqlite_jni_capi_CApi
1118
+ * Method: sqlite3_column_bytes16
1119
+ * Signature: (JI)I
1120
+ */
1121
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1bytes16
1122
+ (JNIEnv *, jclass, jlong, jint);
1123
+
1124
+ /*
1125
+ * Class: org_sqlite_jni_capi_CApi
1126
+ * Method: sqlite3_column_count
1127
+ * Signature: (J)I
1128
+ */
1129
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1count
1130
+ (JNIEnv *, jclass, jlong);
1131
+
1132
+ /*
1133
+ * Class: org_sqlite_jni_capi_CApi
1134
+ * Method: sqlite3_column_database_name
1135
+ * Signature: (JI)Ljava/lang/String;
1136
+ */
1137
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1database_1name
1138
+ (JNIEnv *, jclass, jlong, jint);
1139
+
1140
+ /*
1141
+ * Class: org_sqlite_jni_capi_CApi
1142
+ * Method: sqlite3_column_decltype
1143
+ * Signature: (JI)Ljava/lang/String;
1144
+ */
1145
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1decltype
1146
+ (JNIEnv *, jclass, jlong, jint);
1147
+
1148
+ /*
1149
+ * Class: org_sqlite_jni_capi_CApi
1150
+ * Method: sqlite3_column_double
1151
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)D
1152
+ */
1153
+ JNIEXPORT jdouble JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1double
1154
+ (JNIEnv *, jclass, jobject, jint);
1155
+
1156
+ /*
1157
+ * Class: org_sqlite_jni_capi_CApi
1158
+ * Method: sqlite3_column_int
1159
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)I
1160
+ */
1161
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1int
1162
+ (JNIEnv *, jclass, jobject, jint);
1163
+
1164
+ /*
1165
+ * Class: org_sqlite_jni_capi_CApi
1166
+ * Method: sqlite3_column_int64
1167
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)J
1168
+ */
1169
+ JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1int64
1170
+ (JNIEnv *, jclass, jobject, jint);
1171
+
1172
+ /*
1173
+ * Class: org_sqlite_jni_capi_CApi
1174
+ * Method: sqlite3_column_java_object
1175
+ * Signature: (JI)Ljava/lang/Object;
1176
+ */
1177
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1java_1object
1178
+ (JNIEnv *, jclass, jlong, jint);
1179
+
1180
+ /*
1181
+ * Class: org_sqlite_jni_capi_CApi
1182
+ * Method: sqlite3_column_name
1183
+ * Signature: (JI)Ljava/lang/String;
1184
+ */
1185
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1name
1186
+ (JNIEnv *, jclass, jlong, jint);
1187
+
1188
+ /*
1189
+ * Class: org_sqlite_jni_capi_CApi
1190
+ * Method: sqlite3_column_nio_buffer
1191
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)Ljava/nio/ByteBuffer;
1192
+ */
1193
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1nio_1buffer
1194
+ (JNIEnv *, jclass, jobject, jint);
1195
+
1196
+ /*
1197
+ * Class: org_sqlite_jni_capi_CApi
1198
+ * Method: sqlite3_column_origin_name
1199
+ * Signature: (JI)Ljava/lang/String;
1200
+ */
1201
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1origin_1name
1202
+ (JNIEnv *, jclass, jlong, jint);
1203
+
1204
+ /*
1205
+ * Class: org_sqlite_jni_capi_CApi
1206
+ * Method: sqlite3_column_table_name
1207
+ * Signature: (JI)Ljava/lang/String;
1208
+ */
1209
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1table_1name
1210
+ (JNIEnv *, jclass, jlong, jint);
1211
+
1212
+ /*
1213
+ * Class: org_sqlite_jni_capi_CApi
1214
+ * Method: sqlite3_column_text
1215
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)[B
1216
+ */
1217
+ JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1text
1218
+ (JNIEnv *, jclass, jobject, jint);
1219
+
1220
+ /*
1221
+ * Class: org_sqlite_jni_capi_CApi
1222
+ * Method: sqlite3_column_text16
1223
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)Ljava/lang/String;
1224
+ */
1225
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1text16
1226
+ (JNIEnv *, jclass, jobject, jint);
1227
+
1228
+ /*
1229
+ * Class: org_sqlite_jni_capi_CApi
1230
+ * Method: sqlite3_column_type
1231
+ * Signature: (JI)I
1232
+ */
1233
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1type
1234
+ (JNIEnv *, jclass, jlong, jint);
1235
+
1236
+ /*
1237
+ * Class: org_sqlite_jni_capi_CApi
1238
+ * Method: sqlite3_column_value
1239
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)Lorg/sqlite/jni/capi/sqlite3_value;
1240
+ */
1241
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1value
1242
+ (JNIEnv *, jclass, jobject, jint);
1243
+
1244
+ /*
1245
+ * Class: org_sqlite_jni_capi_CApi
1246
+ * Method: sqlite3_collation_needed
1247
+ * Signature: (JLorg/sqlite/jni/capi/CollationNeededCallback;)I
1248
+ */
1249
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1collation_1needed
1250
+ (JNIEnv *, jclass, jlong, jobject);
1251
+
1252
+ /*
1253
+ * Class: org_sqlite_jni_capi_CApi
1254
+ * Method: sqlite3_commit_hook
1255
+ * Signature: (JLorg/sqlite/jni/capi/CommitHookCallback;)Lorg/sqlite/jni/capi/CommitHookCallback;
1256
+ */
1257
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1commit_1hook
1258
+ (JNIEnv *, jclass, jlong, jobject);
1259
+
1260
+ /*
1261
+ * Class: org_sqlite_jni_capi_CApi
1262
+ * Method: sqlite3_compileoption_get
1263
+ * Signature: (I)Ljava/lang/String;
1264
+ */
1265
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1compileoption_1get
1266
+ (JNIEnv *, jclass, jint);
1267
+
1268
+ /*
1269
+ * Class: org_sqlite_jni_capi_CApi
1270
+ * Method: sqlite3_compileoption_used
1271
+ * Signature: (Ljava/lang/String;)Z
1272
+ */
1273
+ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1compileoption_1used
1274
+ (JNIEnv *, jclass, jstring);
1275
+
1276
+ /*
1277
+ * Class: org_sqlite_jni_capi_CApi
1278
+ * Method: sqlite3_complete
1279
+ * Signature: ([B)I
1280
+ */
1281
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1complete
1282
+ (JNIEnv *, jclass, jbyteArray);
1283
+
1284
+ /*
1285
+ * Class: org_sqlite_jni_capi_CApi
1286
+ * Method: sqlite3_config__enable
1287
+ * Signature: (I)I
1288
+ */
1289
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1config_1_1enable
1290
+ (JNIEnv *, jclass, jint);
1291
+
1292
+ /*
1293
+ * Class: org_sqlite_jni_capi_CApi
1294
+ * Method: sqlite3_config__CONFIG_LOG
1295
+ * Signature: (Lorg/sqlite/jni/capi/ConfigLogCallback;)I
1296
+ */
1297
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1config_1_1CONFIG_1LOG
1298
+ (JNIEnv *, jclass, jobject);
1299
+
1300
+ /*
1301
+ * Class: org_sqlite_jni_capi_CApi
1302
+ * Method: sqlite3_config__SQLLOG
1303
+ * Signature: (Lorg/sqlite/jni/capi/ConfigSqlLogCallback;)I
1304
+ */
1305
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1config_1_1SQLLOG
1306
+ (JNIEnv *, jclass, jobject);
1307
+
1308
+ /*
1309
+ * Class: org_sqlite_jni_capi_CApi
1310
+ * Method: sqlite3_context_db_handle
1311
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;)Lorg/sqlite/jni/capi/sqlite3;
1312
+ */
1313
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1context_1db_1handle
1314
+ (JNIEnv *, jclass, jobject);
1315
+
1316
+ /*
1317
+ * Class: org_sqlite_jni_capi_CApi
1318
+ * Method: sqlite3_create_collation
1319
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;ILorg/sqlite/jni/capi/CollationCallback;)I
1320
+ */
1321
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1create_1collation
1322
+ (JNIEnv *, jclass, jobject, jstring, jint, jobject);
1323
+
1324
+ /*
1325
+ * Class: org_sqlite_jni_capi_CApi
1326
+ * Method: sqlite3_create_function
1327
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;IILorg/sqlite/jni/capi/SQLFunction;)I
1328
+ */
1329
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1create_1function
1330
+ (JNIEnv *, jclass, jobject, jstring, jint, jint, jobject);
1331
+
1332
+ /*
1333
+ * Class: org_sqlite_jni_capi_CApi
1334
+ * Method: sqlite3_data_count
1335
+ * Signature: (J)I
1336
+ */
1337
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1data_1count
1338
+ (JNIEnv *, jclass, jlong);
1339
+
1340
+ /*
1341
+ * Class: org_sqlite_jni_capi_CApi
1342
+ * Method: sqlite3_db_config
1343
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;IILorg/sqlite/jni/capi/OutputPointer/Int32;)I
1344
+ */
1345
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_capi_sqlite3_2IILorg_sqlite_jni_capi_OutputPointer_Int32_2
1346
+ (JNIEnv *, jclass, jobject, jint, jint, jobject);
1347
+
1348
+ /*
1349
+ * Class: org_sqlite_jni_capi_CApi
1350
+ * Method: sqlite3_db_config
1351
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;ILjava/lang/String;)I
1352
+ */
1353
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_capi_sqlite3_2ILjava_lang_String_2
1354
+ (JNIEnv *, jclass, jobject, jint, jstring);
1355
+
1356
+ /*
1357
+ * Class: org_sqlite_jni_capi_CApi
1358
+ * Method: sqlite3_db_name
1359
+ * Signature: (JI)Ljava/lang/String;
1360
+ */
1361
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1name
1362
+ (JNIEnv *, jclass, jlong, jint);
1363
+
1364
+ /*
1365
+ * Class: org_sqlite_jni_capi_CApi
1366
+ * Method: sqlite3_db_filename
1367
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;)Ljava/lang/String;
1368
+ */
1369
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1filename
1370
+ (JNIEnv *, jclass, jobject, jstring);
1371
+
1372
+ /*
1373
+ * Class: org_sqlite_jni_capi_CApi
1374
+ * Method: sqlite3_db_handle
1375
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Lorg/sqlite/jni/capi/sqlite3;
1376
+ */
1377
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1handle
1378
+ (JNIEnv *, jclass, jobject);
1379
+
1380
+ /*
1381
+ * Class: org_sqlite_jni_capi_CApi
1382
+ * Method: sqlite3_db_readonly
1383
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;)I
1384
+ */
1385
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1readonly
1386
+ (JNIEnv *, jclass, jobject, jstring);
1387
+
1388
+ /*
1389
+ * Class: org_sqlite_jni_capi_CApi
1390
+ * Method: sqlite3_db_release_memory
1391
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;)I
1392
+ */
1393
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1release_1memory
1394
+ (JNIEnv *, jclass, jobject);
1395
+
1396
+ /*
1397
+ * Class: org_sqlite_jni_capi_CApi
1398
+ * Method: sqlite3_db_status
1399
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;ILorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;Z)I
1400
+ */
1401
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1status
1402
+ (JNIEnv *, jclass, jobject, jint, jobject, jobject, jboolean);
1403
+
1404
+ /*
1405
+ * Class: org_sqlite_jni_capi_CApi
1406
+ * Method: sqlite3_errcode
1407
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;)I
1408
+ */
1409
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1errcode
1410
+ (JNIEnv *, jclass, jobject);
1411
+
1412
+ /*
1413
+ * Class: org_sqlite_jni_capi_CApi
1414
+ * Method: sqlite3_errmsg
1415
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;)Ljava/lang/String;
1416
+ */
1417
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1errmsg
1418
+ (JNIEnv *, jclass, jobject);
1419
+
1420
+ /*
1421
+ * Class: org_sqlite_jni_capi_CApi
1422
+ * Method: sqlite3_error_offset
1423
+ * Signature: (J)I
1424
+ */
1425
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1error_1offset
1426
+ (JNIEnv *, jclass, jlong);
1427
+
1428
+ /*
1429
+ * Class: org_sqlite_jni_capi_CApi
1430
+ * Method: sqlite3_errstr
1431
+ * Signature: (I)Ljava/lang/String;
1432
+ */
1433
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1errstr
1434
+ (JNIEnv *, jclass, jint);
1435
+
1436
+ /*
1437
+ * Class: org_sqlite_jni_capi_CApi
1438
+ * Method: sqlite3_expanded_sql
1439
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Ljava/lang/String;
1440
+ */
1441
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1expanded_1sql
1442
+ (JNIEnv *, jclass, jobject);
1443
+
1444
+ /*
1445
+ * Class: org_sqlite_jni_capi_CApi
1446
+ * Method: sqlite3_extended_errcode
1447
+ * Signature: (J)I
1448
+ */
1449
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1extended_1errcode
1450
+ (JNIEnv *, jclass, jlong);
1451
+
1452
+ /*
1453
+ * Class: org_sqlite_jni_capi_CApi
1454
+ * Method: sqlite3_extended_result_codes
1455
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;Z)I
1456
+ */
1457
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1extended_1result_1codes
1458
+ (JNIEnv *, jclass, jobject, jboolean);
1459
+
1460
+ /*
1461
+ * Class: org_sqlite_jni_capi_CApi
1462
+ * Method: sqlite3_get_autocommit
1463
+ * Signature: (J)Z
1464
+ */
1465
+ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1get_1autocommit
1466
+ (JNIEnv *, jclass, jlong);
1467
+
1468
+ /*
1469
+ * Class: org_sqlite_jni_capi_CApi
1470
+ * Method: sqlite3_get_auxdata
1471
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;I)Ljava/lang/Object;
1472
+ */
1473
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1get_1auxdata
1474
+ (JNIEnv *, jclass, jobject, jint);
1475
+
1476
+ /*
1477
+ * Class: org_sqlite_jni_capi_CApi
1478
+ * Method: sqlite3_finalize
1479
+ * Signature: (J)I
1480
+ */
1481
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1finalize
1482
+ (JNIEnv *, jclass, jlong);
1483
+
1484
+ /*
1485
+ * Class: org_sqlite_jni_capi_CApi
1486
+ * Method: sqlite3_initialize
1487
+ * Signature: ()I
1488
+ */
1489
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1initialize
1490
+ (JNIEnv *, jclass);
1491
+
1492
+ /*
1493
+ * Class: org_sqlite_jni_capi_CApi
1494
+ * Method: sqlite3_interrupt
1495
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;)V
1496
+ */
1497
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1interrupt
1498
+ (JNIEnv *, jclass, jobject);
1499
+
1500
+ /*
1501
+ * Class: org_sqlite_jni_capi_CApi
1502
+ * Method: sqlite3_is_interrupted
1503
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;)Z
1504
+ */
1505
+ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1is_1interrupted
1506
+ (JNIEnv *, jclass, jobject);
1507
+
1508
+ /*
1509
+ * Class: org_sqlite_jni_capi_CApi
1510
+ * Method: sqlite3_keyword_check
1511
+ * Signature: (Ljava/lang/String;)Z
1512
+ */
1513
+ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1keyword_1check
1514
+ (JNIEnv *, jclass, jstring);
1515
+
1516
+ /*
1517
+ * Class: org_sqlite_jni_capi_CApi
1518
+ * Method: sqlite3_keyword_count
1519
+ * Signature: ()I
1520
+ */
1521
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1keyword_1count
1522
+ (JNIEnv *, jclass);
1523
+
1524
+ /*
1525
+ * Class: org_sqlite_jni_capi_CApi
1526
+ * Method: sqlite3_keyword_name
1527
+ * Signature: (I)Ljava/lang/String;
1528
+ */
1529
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1keyword_1name
1530
+ (JNIEnv *, jclass, jint);
1531
+
1532
+ /*
1533
+ * Class: org_sqlite_jni_capi_CApi
1534
+ * Method: sqlite3_last_insert_rowid
1535
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;)J
1536
+ */
1537
+ JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1last_1insert_1rowid
1538
+ (JNIEnv *, jclass, jobject);
1539
+
1540
+ /*
1541
+ * Class: org_sqlite_jni_capi_CApi
1542
+ * Method: sqlite3_libversion
1543
+ * Signature: ()Ljava/lang/String;
1544
+ */
1545
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1libversion
1546
+ (JNIEnv *, jclass);
1547
+
1548
+ /*
1549
+ * Class: org_sqlite_jni_capi_CApi
1550
+ * Method: sqlite3_libversion_number
1551
+ * Signature: ()I
1552
+ */
1553
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1libversion_1number
1554
+ (JNIEnv *, jclass);
1555
+
1556
+ /*
1557
+ * Class: org_sqlite_jni_capi_CApi
1558
+ * Method: sqlite3_limit
1559
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;II)I
1560
+ */
1561
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1limit
1562
+ (JNIEnv *, jclass, jobject, jint, jint);
1563
+
1564
+ /*
1565
+ * Class: org_sqlite_jni_capi_CApi
1566
+ * Method: sqlite3_normalized_sql
1567
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Ljava/lang/String;
1568
+ */
1569
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1normalized_1sql
1570
+ (JNIEnv *, jclass, jobject);
1571
+
1572
+ /*
1573
+ * Class: org_sqlite_jni_capi_CApi
1574
+ * Method: sqlite3_open
1575
+ * Signature: (Ljava/lang/String;Lorg/sqlite/jni/capi/OutputPointer/sqlite3;)I
1576
+ */
1577
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1open
1578
+ (JNIEnv *, jclass, jstring, jobject);
1579
+
1580
+ /*
1581
+ * Class: org_sqlite_jni_capi_CApi
1582
+ * Method: sqlite3_open_v2
1583
+ * Signature: (Ljava/lang/String;Lorg/sqlite/jni/capi/OutputPointer/sqlite3;ILjava/lang/String;)I
1584
+ */
1585
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1open_1v2
1586
+ (JNIEnv *, jclass, jstring, jobject, jint, jstring);
1587
+
1588
+ /*
1589
+ * Class: org_sqlite_jni_capi_CApi
1590
+ * Method: sqlite3_prepare
1591
+ * Signature: (J[BILorg/sqlite/jni/capi/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I
1592
+ */
1593
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1prepare
1594
+ (JNIEnv *, jclass, jlong, jbyteArray, jint, jobject, jobject);
1595
+
1596
+ /*
1597
+ * Class: org_sqlite_jni_capi_CApi
1598
+ * Method: sqlite3_prepare_v2
1599
+ * Signature: (J[BILorg/sqlite/jni/capi/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I
1600
+ */
1601
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1prepare_1v2
1602
+ (JNIEnv *, jclass, jlong, jbyteArray, jint, jobject, jobject);
1603
+
1604
+ /*
1605
+ * Class: org_sqlite_jni_capi_CApi
1606
+ * Method: sqlite3_prepare_v3
1607
+ * Signature: (J[BIILorg/sqlite/jni/capi/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I
1608
+ */
1609
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1prepare_1v3
1610
+ (JNIEnv *, jclass, jlong, jbyteArray, jint, jint, jobject, jobject);
1611
+
1612
+ /*
1613
+ * Class: org_sqlite_jni_capi_CApi
1614
+ * Method: sqlite3_preupdate_blobwrite
1615
+ * Signature: (J)I
1616
+ */
1617
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1blobwrite
1618
+ (JNIEnv *, jclass, jlong);
1619
+
1620
+ /*
1621
+ * Class: org_sqlite_jni_capi_CApi
1622
+ * Method: sqlite3_preupdate_count
1623
+ * Signature: (J)I
1624
+ */
1625
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1count
1626
+ (JNIEnv *, jclass, jlong);
1627
+
1628
+ /*
1629
+ * Class: org_sqlite_jni_capi_CApi
1630
+ * Method: sqlite3_preupdate_depth
1631
+ * Signature: (J)I
1632
+ */
1633
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1depth
1634
+ (JNIEnv *, jclass, jlong);
1635
+
1636
+ /*
1637
+ * Class: org_sqlite_jni_capi_CApi
1638
+ * Method: sqlite3_preupdate_hook
1639
+ * Signature: (JLorg/sqlite/jni/capi/PreupdateHookCallback;)Lorg/sqlite/jni/capi/PreupdateHookCallback;
1640
+ */
1641
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1hook
1642
+ (JNIEnv *, jclass, jlong, jobject);
1643
+
1644
+ /*
1645
+ * Class: org_sqlite_jni_capi_CApi
1646
+ * Method: sqlite3_preupdate_new
1647
+ * Signature: (JILorg/sqlite/jni/capi/OutputPointer/sqlite3_value;)I
1648
+ */
1649
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1new
1650
+ (JNIEnv *, jclass, jlong, jint, jobject);
1651
+
1652
+ /*
1653
+ * Class: org_sqlite_jni_capi_CApi
1654
+ * Method: sqlite3_preupdate_old
1655
+ * Signature: (JILorg/sqlite/jni/capi/OutputPointer/sqlite3_value;)I
1656
+ */
1657
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1old
1658
+ (JNIEnv *, jclass, jlong, jint, jobject);
1659
+
1660
+ /*
1661
+ * Class: org_sqlite_jni_capi_CApi
1662
+ * Method: sqlite3_progress_handler
1663
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;ILorg/sqlite/jni/capi/ProgressHandlerCallback;)V
1664
+ */
1665
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1progress_1handler
1666
+ (JNIEnv *, jclass, jobject, jint, jobject);
1667
+
1668
+ /*
1669
+ * Class: org_sqlite_jni_capi_CApi
1670
+ * Method: sqlite3_randomness
1671
+ * Signature: ([B)V
1672
+ */
1673
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1randomness
1674
+ (JNIEnv *, jclass, jbyteArray);
1675
+
1676
+ /*
1677
+ * Class: org_sqlite_jni_capi_CApi
1678
+ * Method: sqlite3_release_memory
1679
+ * Signature: (I)I
1680
+ */
1681
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1release_1memory
1682
+ (JNIEnv *, jclass, jint);
1683
+
1684
+ /*
1685
+ * Class: org_sqlite_jni_capi_CApi
1686
+ * Method: sqlite3_reset
1687
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)I
1688
+ */
1689
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1reset
1690
+ (JNIEnv *, jclass, jobject);
1691
+
1692
+ /*
1693
+ * Class: org_sqlite_jni_capi_CApi
1694
+ * Method: sqlite3_reset_auto_extension
1695
+ * Signature: ()V
1696
+ */
1697
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1reset_1auto_1extension
1698
+ (JNIEnv *, jclass);
1699
+
1700
+ /*
1701
+ * Class: org_sqlite_jni_capi_CApi
1702
+ * Method: sqlite3_result_double
1703
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;D)V
1704
+ */
1705
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1double
1706
+ (JNIEnv *, jclass, jobject, jdouble);
1707
+
1708
+ /*
1709
+ * Class: org_sqlite_jni_capi_CApi
1710
+ * Method: sqlite3_result_error
1711
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;[BI)V
1712
+ */
1713
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1error
1714
+ (JNIEnv *, jclass, jobject, jbyteArray, jint);
1715
+
1716
+ /*
1717
+ * Class: org_sqlite_jni_capi_CApi
1718
+ * Method: sqlite3_result_error_toobig
1719
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;)V
1720
+ */
1721
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1error_1toobig
1722
+ (JNIEnv *, jclass, jobject);
1723
+
1724
+ /*
1725
+ * Class: org_sqlite_jni_capi_CApi
1726
+ * Method: sqlite3_result_error_nomem
1727
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;)V
1728
+ */
1729
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1error_1nomem
1730
+ (JNIEnv *, jclass, jobject);
1731
+
1732
+ /*
1733
+ * Class: org_sqlite_jni_capi_CApi
1734
+ * Method: sqlite3_result_error_code
1735
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;I)V
1736
+ */
1737
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1error_1code
1738
+ (JNIEnv *, jclass, jobject, jint);
1739
+
1740
+ /*
1741
+ * Class: org_sqlite_jni_capi_CApi
1742
+ * Method: sqlite3_result_int
1743
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;I)V
1744
+ */
1745
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1int
1746
+ (JNIEnv *, jclass, jobject, jint);
1747
+
1748
+ /*
1749
+ * Class: org_sqlite_jni_capi_CApi
1750
+ * Method: sqlite3_result_int64
1751
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;J)V
1752
+ */
1753
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1int64
1754
+ (JNIEnv *, jclass, jobject, jlong);
1755
+
1756
+ /*
1757
+ * Class: org_sqlite_jni_capi_CApi
1758
+ * Method: sqlite3_result_java_object
1759
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;Ljava/lang/Object;)V
1760
+ */
1761
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1java_1object
1762
+ (JNIEnv *, jclass, jobject, jobject);
1763
+
1764
+ /*
1765
+ * Class: org_sqlite_jni_capi_CApi
1766
+ * Method: sqlite3_result_nio_buffer
1767
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;Ljava/nio/ByteBuffer;II)V
1768
+ */
1769
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1nio_1buffer
1770
+ (JNIEnv *, jclass, jobject, jobject, jint, jint);
1771
+
1772
+ /*
1773
+ * Class: org_sqlite_jni_capi_CApi
1774
+ * Method: sqlite3_result_null
1775
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;)V
1776
+ */
1777
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1null
1778
+ (JNIEnv *, jclass, jobject);
1779
+
1780
+ /*
1781
+ * Class: org_sqlite_jni_capi_CApi
1782
+ * Method: sqlite3_result_subtype
1783
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;I)V
1784
+ */
1785
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1subtype
1786
+ (JNIEnv *, jclass, jobject, jint);
1787
+
1788
+ /*
1789
+ * Class: org_sqlite_jni_capi_CApi
1790
+ * Method: sqlite3_result_value
1791
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;Lorg/sqlite/jni/capi/sqlite3_value;)V
1792
+ */
1793
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1value
1794
+ (JNIEnv *, jclass, jobject, jobject);
1795
+
1796
+ /*
1797
+ * Class: org_sqlite_jni_capi_CApi
1798
+ * Method: sqlite3_result_zeroblob
1799
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;I)V
1800
+ */
1801
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1zeroblob
1802
+ (JNIEnv *, jclass, jobject, jint);
1803
+
1804
+ /*
1805
+ * Class: org_sqlite_jni_capi_CApi
1806
+ * Method: sqlite3_result_zeroblob64
1807
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;J)I
1808
+ */
1809
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1zeroblob64
1810
+ (JNIEnv *, jclass, jobject, jlong);
1811
+
1812
+ /*
1813
+ * Class: org_sqlite_jni_capi_CApi
1814
+ * Method: sqlite3_result_blob
1815
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;[BI)V
1816
+ */
1817
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1blob
1818
+ (JNIEnv *, jclass, jobject, jbyteArray, jint);
1819
+
1820
+ /*
1821
+ * Class: org_sqlite_jni_capi_CApi
1822
+ * Method: sqlite3_result_blob64
1823
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;[BJ)V
1824
+ */
1825
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1blob64
1826
+ (JNIEnv *, jclass, jobject, jbyteArray, jlong);
1827
+
1828
+ /*
1829
+ * Class: org_sqlite_jni_capi_CApi
1830
+ * Method: sqlite3_result_text
1831
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;[BI)V
1832
+ */
1833
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1text
1834
+ (JNIEnv *, jclass, jobject, jbyteArray, jint);
1835
+
1836
+ /*
1837
+ * Class: org_sqlite_jni_capi_CApi
1838
+ * Method: sqlite3_result_text64
1839
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;[BJI)V
1840
+ */
1841
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1text64
1842
+ (JNIEnv *, jclass, jobject, jbyteArray, jlong, jint);
1843
+
1844
+ /*
1845
+ * Class: org_sqlite_jni_capi_CApi
1846
+ * Method: sqlite3_rollback_hook
1847
+ * Signature: (JLorg/sqlite/jni/capi/RollbackHookCallback;)Lorg/sqlite/jni/capi/RollbackHookCallback;
1848
+ */
1849
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1rollback_1hook
1850
+ (JNIEnv *, jclass, jlong, jobject);
1851
+
1852
+ /*
1853
+ * Class: org_sqlite_jni_capi_CApi
1854
+ * Method: sqlite3_set_authorizer
1855
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;Lorg/sqlite/jni/capi/AuthorizerCallback;)I
1856
+ */
1857
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1set_1authorizer
1858
+ (JNIEnv *, jclass, jobject, jobject);
1859
+
1860
+ /*
1861
+ * Class: org_sqlite_jni_capi_CApi
1862
+ * Method: sqlite3_set_auxdata
1863
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;ILjava/lang/Object;)V
1864
+ */
1865
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1set_1auxdata
1866
+ (JNIEnv *, jclass, jobject, jint, jobject);
1867
+
1868
+ /*
1869
+ * Class: org_sqlite_jni_capi_CApi
1870
+ * Method: sqlite3_set_last_insert_rowid
1871
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;J)V
1872
+ */
1873
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1set_1last_1insert_1rowid
1874
+ (JNIEnv *, jclass, jobject, jlong);
1875
+
1876
+ /*
1877
+ * Class: org_sqlite_jni_capi_CApi
1878
+ * Method: sqlite3_shutdown
1879
+ * Signature: ()I
1880
+ */
1881
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1shutdown
1882
+ (JNIEnv *, jclass);
1883
+
1884
+ /*
1885
+ * Class: org_sqlite_jni_capi_CApi
1886
+ * Method: sqlite3_sleep
1887
+ * Signature: (I)I
1888
+ */
1889
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1sleep
1890
+ (JNIEnv *, jclass, jint);
1891
+
1892
+ /*
1893
+ * Class: org_sqlite_jni_capi_CApi
1894
+ * Method: sqlite3_sourceid
1895
+ * Signature: ()Ljava/lang/String;
1896
+ */
1897
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1sourceid
1898
+ (JNIEnv *, jclass);
1899
+
1900
+ /*
1901
+ * Class: org_sqlite_jni_capi_CApi
1902
+ * Method: sqlite3_sql
1903
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Ljava/lang/String;
1904
+ */
1905
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1sql
1906
+ (JNIEnv *, jclass, jobject);
1907
+
1908
+ /*
1909
+ * Class: org_sqlite_jni_capi_CApi
1910
+ * Method: sqlite3_status
1911
+ * Signature: (ILorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;Z)I
1912
+ */
1913
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1status
1914
+ (JNIEnv *, jclass, jint, jobject, jobject, jboolean);
1915
+
1916
+ /*
1917
+ * Class: org_sqlite_jni_capi_CApi
1918
+ * Method: sqlite3_status64
1919
+ * Signature: (ILorg/sqlite/jni/capi/OutputPointer/Int64;Lorg/sqlite/jni/capi/OutputPointer/Int64;Z)I
1920
+ */
1921
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1status64
1922
+ (JNIEnv *, jclass, jint, jobject, jobject, jboolean);
1923
+
1924
+ /*
1925
+ * Class: org_sqlite_jni_capi_CApi
1926
+ * Method: sqlite3_step
1927
+ * Signature: (J)I
1928
+ */
1929
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1step
1930
+ (JNIEnv *, jclass, jlong);
1931
+
1932
+ /*
1933
+ * Class: org_sqlite_jni_capi_CApi
1934
+ * Method: sqlite3_stmt_busy
1935
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Z
1936
+ */
1937
+ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1stmt_1busy
1938
+ (JNIEnv *, jclass, jobject);
1939
+
1940
+ /*
1941
+ * Class: org_sqlite_jni_capi_CApi
1942
+ * Method: sqlite3_stmt_explain
1943
+ * Signature: (JI)I
1944
+ */
1945
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1stmt_1explain
1946
+ (JNIEnv *, jclass, jlong, jint);
1947
+
1948
+ /*
1949
+ * Class: org_sqlite_jni_capi_CApi
1950
+ * Method: sqlite3_stmt_isexplain
1951
+ * Signature: (J)I
1952
+ */
1953
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1stmt_1isexplain
1954
+ (JNIEnv *, jclass, jlong);
1955
+
1956
+ /*
1957
+ * Class: org_sqlite_jni_capi_CApi
1958
+ * Method: sqlite3_stmt_readonly
1959
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Z
1960
+ */
1961
+ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1stmt_1readonly
1962
+ (JNIEnv *, jclass, jobject);
1963
+
1964
+ /*
1965
+ * Class: org_sqlite_jni_capi_CApi
1966
+ * Method: sqlite3_stmt_status
1967
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;IZ)I
1968
+ */
1969
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1stmt_1status
1970
+ (JNIEnv *, jclass, jobject, jint, jboolean);
1971
+
1972
+ /*
1973
+ * Class: org_sqlite_jni_capi_CApi
1974
+ * Method: sqlite3_strglob
1975
+ * Signature: ([B[B)I
1976
+ */
1977
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1strglob
1978
+ (JNIEnv *, jclass, jbyteArray, jbyteArray);
1979
+
1980
+ /*
1981
+ * Class: org_sqlite_jni_capi_CApi
1982
+ * Method: sqlite3_strlike
1983
+ * Signature: ([B[BI)I
1984
+ */
1985
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1strlike
1986
+ (JNIEnv *, jclass, jbyteArray, jbyteArray, jint);
1987
+
1988
+ /*
1989
+ * Class: org_sqlite_jni_capi_CApi
1990
+ * Method: sqlite3_system_errno
1991
+ * Signature: (J)I
1992
+ */
1993
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1system_1errno
1994
+ (JNIEnv *, jclass, jlong);
1995
+
1996
+ /*
1997
+ * Class: org_sqlite_jni_capi_CApi
1998
+ * Method: sqlite3_table_column_metadata
1999
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/sqlite/jni/capi/OutputPointer/String;Lorg/sqlite/jni/capi/OutputPointer/String;Lorg/sqlite/jni/capi/OutputPointer/Bool;Lorg/sqlite/jni/capi/OutputPointer/Bool;Lorg/sqlite/jni/capi/OutputPointer/Bool;)I
2000
+ */
2001
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1table_1column_1metadata
2002
+ (JNIEnv *, jclass, jobject, jstring, jstring, jstring, jobject, jobject, jobject, jobject, jobject);
2003
+
2004
+ /*
2005
+ * Class: org_sqlite_jni_capi_CApi
2006
+ * Method: sqlite3_threadsafe
2007
+ * Signature: ()I
2008
+ */
2009
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1threadsafe
2010
+ (JNIEnv *, jclass);
2011
+
2012
+ /*
2013
+ * Class: org_sqlite_jni_capi_CApi
2014
+ * Method: sqlite3_total_changes
2015
+ * Signature: (J)I
2016
+ */
2017
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1total_1changes
2018
+ (JNIEnv *, jclass, jlong);
2019
+
2020
+ /*
2021
+ * Class: org_sqlite_jni_capi_CApi
2022
+ * Method: sqlite3_total_changes64
2023
+ * Signature: (J)J
2024
+ */
2025
+ JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1total_1changes64
2026
+ (JNIEnv *, jclass, jlong);
2027
+
2028
+ /*
2029
+ * Class: org_sqlite_jni_capi_CApi
2030
+ * Method: sqlite3_trace_v2
2031
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;ILorg/sqlite/jni/capi/TraceV2Callback;)I
2032
+ */
2033
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1trace_1v2
2034
+ (JNIEnv *, jclass, jobject, jint, jobject);
2035
+
2036
+ /*
2037
+ * Class: org_sqlite_jni_capi_CApi
2038
+ * Method: sqlite3_txn_state
2039
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;)I
2040
+ */
2041
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1txn_1state
2042
+ (JNIEnv *, jclass, jobject, jstring);
2043
+
2044
+ /*
2045
+ * Class: org_sqlite_jni_capi_CApi
2046
+ * Method: sqlite3_update_hook
2047
+ * Signature: (JLorg/sqlite/jni/capi/UpdateHookCallback;)Lorg/sqlite/jni/capi/UpdateHookCallback;
2048
+ */
2049
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1update_1hook
2050
+ (JNIEnv *, jclass, jlong, jobject);
2051
+
2052
+ /*
2053
+ * Class: org_sqlite_jni_capi_CApi
2054
+ * Method: sqlite3_value_blob
2055
+ * Signature: (J)[B
2056
+ */
2057
+ JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1blob
2058
+ (JNIEnv *, jclass, jlong);
2059
+
2060
+ /*
2061
+ * Class: org_sqlite_jni_capi_CApi
2062
+ * Method: sqlite3_value_bytes
2063
+ * Signature: (J)I
2064
+ */
2065
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1bytes
2066
+ (JNIEnv *, jclass, jlong);
2067
+
2068
+ /*
2069
+ * Class: org_sqlite_jni_capi_CApi
2070
+ * Method: sqlite3_value_bytes16
2071
+ * Signature: (J)I
2072
+ */
2073
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1bytes16
2074
+ (JNIEnv *, jclass, jlong);
2075
+
2076
+ /*
2077
+ * Class: org_sqlite_jni_capi_CApi
2078
+ * Method: sqlite3_value_double
2079
+ * Signature: (J)D
2080
+ */
2081
+ JNIEXPORT jdouble JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1double
2082
+ (JNIEnv *, jclass, jlong);
2083
+
2084
+ /*
2085
+ * Class: org_sqlite_jni_capi_CApi
2086
+ * Method: sqlite3_value_dup
2087
+ * Signature: (J)Lorg/sqlite/jni/capi/sqlite3_value;
2088
+ */
2089
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1dup
2090
+ (JNIEnv *, jclass, jlong);
2091
+
2092
+ /*
2093
+ * Class: org_sqlite_jni_capi_CApi
2094
+ * Method: sqlite3_value_encoding
2095
+ * Signature: (J)I
2096
+ */
2097
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1encoding
2098
+ (JNIEnv *, jclass, jlong);
2099
+
2100
+ /*
2101
+ * Class: org_sqlite_jni_capi_CApi
2102
+ * Method: sqlite3_value_free
2103
+ * Signature: (J)V
2104
+ */
2105
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1free
2106
+ (JNIEnv *, jclass, jlong);
2107
+
2108
+ /*
2109
+ * Class: org_sqlite_jni_capi_CApi
2110
+ * Method: sqlite3_value_frombind
2111
+ * Signature: (J)Z
2112
+ */
2113
+ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1frombind
2114
+ (JNIEnv *, jclass, jlong);
2115
+
2116
+ /*
2117
+ * Class: org_sqlite_jni_capi_CApi
2118
+ * Method: sqlite3_value_int
2119
+ * Signature: (J)I
2120
+ */
2121
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1int
2122
+ (JNIEnv *, jclass, jlong);
2123
+
2124
+ /*
2125
+ * Class: org_sqlite_jni_capi_CApi
2126
+ * Method: sqlite3_value_int64
2127
+ * Signature: (J)J
2128
+ */
2129
+ JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1int64
2130
+ (JNIEnv *, jclass, jlong);
2131
+
2132
+ /*
2133
+ * Class: org_sqlite_jni_capi_CApi
2134
+ * Method: sqlite3_value_java_object
2135
+ * Signature: (J)Ljava/lang/Object;
2136
+ */
2137
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1java_1object
2138
+ (JNIEnv *, jclass, jlong);
2139
+
2140
+ /*
2141
+ * Class: org_sqlite_jni_capi_CApi
2142
+ * Method: sqlite3_value_nio_buffer
2143
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3_value;)Ljava/nio/ByteBuffer;
2144
+ */
2145
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1nio_1buffer
2146
+ (JNIEnv *, jclass, jobject);
2147
+
2148
+ /*
2149
+ * Class: org_sqlite_jni_capi_CApi
2150
+ * Method: sqlite3_value_nochange
2151
+ * Signature: (J)I
2152
+ */
2153
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1nochange
2154
+ (JNIEnv *, jclass, jlong);
2155
+
2156
+ /*
2157
+ * Class: org_sqlite_jni_capi_CApi
2158
+ * Method: sqlite3_value_numeric_type
2159
+ * Signature: (J)I
2160
+ */
2161
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1numeric_1type
2162
+ (JNIEnv *, jclass, jlong);
2163
+
2164
+ /*
2165
+ * Class: org_sqlite_jni_capi_CApi
2166
+ * Method: sqlite3_value_subtype
2167
+ * Signature: (J)I
2168
+ */
2169
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1subtype
2170
+ (JNIEnv *, jclass, jlong);
2171
+
2172
+ /*
2173
+ * Class: org_sqlite_jni_capi_CApi
2174
+ * Method: sqlite3_value_text
2175
+ * Signature: (J)[B
2176
+ */
2177
+ JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1text
2178
+ (JNIEnv *, jclass, jlong);
2179
+
2180
+ /*
2181
+ * Class: org_sqlite_jni_capi_CApi
2182
+ * Method: sqlite3_value_text16
2183
+ * Signature: (J)Ljava/lang/String;
2184
+ */
2185
+ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1text16
2186
+ (JNIEnv *, jclass, jlong);
2187
+
2188
+ /*
2189
+ * Class: org_sqlite_jni_capi_CApi
2190
+ * Method: sqlite3_value_type
2191
+ * Signature: (J)I
2192
+ */
2193
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1type
2194
+ (JNIEnv *, jclass, jlong);
2195
+
2196
+ /*
2197
+ * Class: org_sqlite_jni_capi_CApi
2198
+ * Method: sqlite3_jni_internal_details
2199
+ * Signature: ()V
2200
+ */
2201
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1jni_1internal_1details
2202
+ (JNIEnv *, jclass);
2203
+
2204
+ #ifdef __cplusplus
2205
+ }
2206
+ #endif
2207
+ #endif
2208
+ /* DO NOT EDIT THIS FILE - it is machine generated */
2209
+ #include <jni.h>
2210
+ /* Header for class org_sqlite_jni_capi_SQLTester */
2211
+
2212
+ #ifndef _Included_org_sqlite_jni_capi_SQLTester
2213
+ #define _Included_org_sqlite_jni_capi_SQLTester
2214
+ #ifdef __cplusplus
2215
+ extern "C" {
2216
+ #endif
2217
+ /*
2218
+ * Class: org_sqlite_jni_capi_SQLTester
2219
+ * Method: strglob
2220
+ * Signature: ([B[B)I
2221
+ */
2222
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_SQLTester_strglob
2223
+ (JNIEnv *, jclass, jbyteArray, jbyteArray);
2224
+
2225
+ /*
2226
+ * Class: org_sqlite_jni_capi_SQLTester
2227
+ * Method: installCustomExtensions
2228
+ * Signature: ()V
2229
+ */
2230
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_SQLTester_installCustomExtensions
2231
+ (JNIEnv *, jclass);
2232
+
2233
+ #ifdef __cplusplus
2234
+ }
2235
+ #endif
2236
+ #endif
2237
+ /* DO NOT EDIT THIS FILE - it is machine generated */
2238
+ #include <jni.h>
2239
+ /* Header for class org_sqlite_jni_fts5_Fts5ExtensionApi */
2240
+
2241
+ #ifndef _Included_org_sqlite_jni_fts5_Fts5ExtensionApi
2242
+ #define _Included_org_sqlite_jni_fts5_Fts5ExtensionApi
2243
+ #ifdef __cplusplus
2244
+ extern "C" {
2245
+ #endif
2246
+ /*
2247
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2248
+ * Method: getInstance
2249
+ * Signature: ()Lorg/sqlite/jni/fts5/Fts5ExtensionApi;
2250
+ */
2251
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_getInstance
2252
+ (JNIEnv *, jclass);
2253
+
2254
+ /*
2255
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2256
+ * Method: xColumnCount
2257
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;)I
2258
+ */
2259
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xColumnCount
2260
+ (JNIEnv *, jobject, jobject);
2261
+
2262
+ /*
2263
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2264
+ * Method: xColumnSize
2265
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/capi/OutputPointer/Int32;)I
2266
+ */
2267
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xColumnSize
2268
+ (JNIEnv *, jobject, jobject, jint, jobject);
2269
+
2270
+ /*
2271
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2272
+ * Method: xColumnText
2273
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/capi/OutputPointer/String;)I
2274
+ */
2275
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xColumnText
2276
+ (JNIEnv *, jobject, jobject, jint, jobject);
2277
+
2278
+ /*
2279
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2280
+ * Method: xColumnTotalSize
2281
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/capi/OutputPointer/Int64;)I
2282
+ */
2283
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xColumnTotalSize
2284
+ (JNIEnv *, jobject, jobject, jint, jobject);
2285
+
2286
+ /*
2287
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2288
+ * Method: xGetAuxdata
2289
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Z)Ljava/lang/Object;
2290
+ */
2291
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xGetAuxdata
2292
+ (JNIEnv *, jobject, jobject, jboolean);
2293
+
2294
+ /*
2295
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2296
+ * Method: xInst
2297
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I
2298
+ */
2299
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xInst
2300
+ (JNIEnv *, jobject, jobject, jint, jobject, jobject, jobject);
2301
+
2302
+ /*
2303
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2304
+ * Method: xInstCount
2305
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I
2306
+ */
2307
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xInstCount
2308
+ (JNIEnv *, jobject, jobject, jobject);
2309
+
2310
+ /*
2311
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2312
+ * Method: xPhraseCount
2313
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;)I
2314
+ */
2315
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseCount
2316
+ (JNIEnv *, jobject, jobject);
2317
+
2318
+ /*
2319
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2320
+ * Method: xPhraseFirst
2321
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I
2322
+ */
2323
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseFirst
2324
+ (JNIEnv *, jobject, jobject, jint, jobject, jobject, jobject);
2325
+
2326
+ /*
2327
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2328
+ * Method: xPhraseFirstColumn
2329
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I
2330
+ */
2331
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseFirstColumn
2332
+ (JNIEnv *, jobject, jobject, jint, jobject, jobject);
2333
+
2334
+ /*
2335
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2336
+ * Method: xPhraseNext
2337
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;)V
2338
+ */
2339
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseNext
2340
+ (JNIEnv *, jobject, jobject, jobject, jobject, jobject);
2341
+
2342
+ /*
2343
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2344
+ * Method: xPhraseNextColumn
2345
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/capi/OutputPointer/Int32;)V
2346
+ */
2347
+ JNIEXPORT void JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseNextColumn
2348
+ (JNIEnv *, jobject, jobject, jobject, jobject);
2349
+
2350
+ /*
2351
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2352
+ * Method: xPhraseSize
2353
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;I)I
2354
+ */
2355
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseSize
2356
+ (JNIEnv *, jobject, jobject, jint);
2357
+
2358
+ /*
2359
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2360
+ * Method: xQueryPhrase
2361
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/fts5/Fts5ExtensionApi/XQueryPhraseCallback;)I
2362
+ */
2363
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xQueryPhrase
2364
+ (JNIEnv *, jobject, jobject, jint, jobject);
2365
+
2366
+ /*
2367
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2368
+ * Method: xRowCount
2369
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/capi/OutputPointer/Int64;)I
2370
+ */
2371
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xRowCount
2372
+ (JNIEnv *, jobject, jobject, jobject);
2373
+
2374
+ /*
2375
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2376
+ * Method: xRowid
2377
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;)J
2378
+ */
2379
+ JNIEXPORT jlong JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xRowid
2380
+ (JNIEnv *, jobject, jobject);
2381
+
2382
+ /*
2383
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2384
+ * Method: xSetAuxdata
2385
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Ljava/lang/Object;)I
2386
+ */
2387
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xSetAuxdata
2388
+ (JNIEnv *, jobject, jobject, jobject);
2389
+
2390
+ /*
2391
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2392
+ * Method: xTokenize
2393
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;[BLorg/sqlite/jni/fts5/XTokenizeCallback;)I
2394
+ */
2395
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xTokenize
2396
+ (JNIEnv *, jobject, jobject, jbyteArray, jobject);
2397
+
2398
+ /*
2399
+ * Class: org_sqlite_jni_fts5_Fts5ExtensionApi
2400
+ * Method: xUserData
2401
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;)Ljava/lang/Object;
2402
+ */
2403
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xUserData
2404
+ (JNIEnv *, jobject, jobject);
2405
+
2406
+ #ifdef __cplusplus
2407
+ }
2408
+ #endif
2409
+ #endif
2410
+ /* DO NOT EDIT THIS FILE - it is machine generated */
2411
+ #include <jni.h>
2412
+ /* Header for class org_sqlite_jni_fts5_fts5_api */
2413
+
2414
+ #ifndef _Included_org_sqlite_jni_fts5_fts5_api
2415
+ #define _Included_org_sqlite_jni_fts5_fts5_api
2416
+ #ifdef __cplusplus
2417
+ extern "C" {
2418
+ #endif
2419
+ #undef org_sqlite_jni_fts5_fts5_api_iVersion
2420
+ #define org_sqlite_jni_fts5_fts5_api_iVersion 2L
2421
+ /*
2422
+ * Class: org_sqlite_jni_fts5_fts5_api
2423
+ * Method: getInstanceForDb
2424
+ * Signature: (Lorg/sqlite/jni/capi/sqlite3;)Lorg/sqlite/jni/fts5/fts5_api;
2425
+ */
2426
+ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_fts5_fts5_1api_getInstanceForDb
2427
+ (JNIEnv *, jclass, jobject);
2428
+
2429
+ /*
2430
+ * Class: org_sqlite_jni_fts5_fts5_api
2431
+ * Method: xCreateFunction
2432
+ * Signature: (Ljava/lang/String;Ljava/lang/Object;Lorg/sqlite/jni/fts5/fts5_extension_function;)I
2433
+ */
2434
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_fts5_1api_xCreateFunction
2435
+ (JNIEnv *, jobject, jstring, jobject, jobject);
2436
+
2437
+ #ifdef __cplusplus
2438
+ }
2439
+ #endif
2440
+ #endif
2441
+ /* DO NOT EDIT THIS FILE - it is machine generated */
2442
+ #include <jni.h>
2443
+ /* Header for class org_sqlite_jni_fts5_fts5_tokenizer */
2444
+
2445
+ #ifndef _Included_org_sqlite_jni_fts5_fts5_tokenizer
2446
+ #define _Included_org_sqlite_jni_fts5_fts5_tokenizer
2447
+ #ifdef __cplusplus
2448
+ extern "C" {
2449
+ #endif
2450
+ /*
2451
+ * Class: org_sqlite_jni_fts5_fts5_tokenizer
2452
+ * Method: xTokenize
2453
+ * Signature: (Lorg/sqlite/jni/fts5/Fts5Tokenizer;I[BLorg/sqlite/jni/fts5/XTokenizeCallback;)I
2454
+ */
2455
+ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_fts5_1tokenizer_xTokenize
2456
+ (JNIEnv *, jobject, jobject, jint, jbyteArray, jobject);
2457
+
2458
+ #ifdef __cplusplus
2459
+ }
2460
+ #endif
2461
+ #endif
local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/SQLTester/index.html ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en-us">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
+ <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
7
+ <!--link rel="stylesheet" href="../common/emscripten.css"/-->
8
+ <link rel="stylesheet" href="../common/testing.css"/>
9
+ <title>SQLTester</title>
10
+ </head>
11
+ <style>
12
+ fieldset {
13
+ display: flex;
14
+ flex-direction: row;
15
+ padding-right: 1em;
16
+ }
17
+ fieldset > :not(.legend) {
18
+ display: flex;
19
+ flex-direction: row;
20
+ padding-right: 1em;
21
+ }
22
+ </style>
23
+ <body>
24
+ <h1>SQLTester for JS/WASM</h1>
25
+ <p>This app reads in a build-time-defined set of SQLTester test
26
+ scripts and runs them through the test suite.
27
+ </p>
28
+ <fieldset>
29
+ <legend>Options</legend>
30
+ <span class='input-wrapper'>
31
+ <input type='checkbox' id='cb-log-reverse' checked>
32
+ <label for='cb-log-reverse'>Reverse log order?</label>
33
+ </span>
34
+ <input type='button' id='btn-run-tests' value='Run tests'/>
35
+ </fieldset>
36
+ <div id='test-output'>Test output will go here.</div>
37
+ <!--script src='SQLTester.run.mjs' type='module'></script-->
38
+ <script>
39
+ (async function(){
40
+ const W = new Worker('SQLTester.run.mjs',{
41
+ type: 'module'
42
+ });
43
+ const wPost = (type,payload)=>W.postMessage({type,payload});
44
+ const mapToString = (v)=>{
45
+ switch(typeof v){
46
+ case 'string': return v;
47
+ case 'number': case 'boolean':
48
+ case 'undefined': case 'bigint':
49
+ return ''+v;
50
+ default: break;
51
+ }
52
+ if(null===v) return 'null';
53
+ if(v instanceof Error){
54
+ v = {
55
+ message: v.message,
56
+ stack: v.stack,
57
+ errorClass: v.name
58
+ };
59
+ }
60
+ return JSON.stringify(v,undefined,2);
61
+ };
62
+ const normalizeArgs = (args)=>args.map(mapToString);
63
+ const logTarget = document.querySelector('#test-output');
64
+ const logClass = function(cssClass,...args){
65
+ const ln = document.createElement('div');
66
+ if(cssClass){
67
+ for(const c of (Array.isArray(cssClass) ? cssClass : [cssClass])){
68
+ ln.classList.add(c);
69
+ }
70
+ }
71
+ ln.append(document.createTextNode(normalizeArgs(args).join(' ')));
72
+ logTarget.append(ln);
73
+ };
74
+ {
75
+ const cbReverse = document.querySelector('#cb-log-reverse');
76
+ const cbReverseKey = 'SQLTester:cb-log-reverse';
77
+ const cbReverseIt = ()=>{
78
+ logTarget.classList[cbReverse.checked ? 'add' : 'remove']('reverse');
79
+ };
80
+ cbReverse.addEventListener('change', cbReverseIt, true);
81
+ cbReverseIt();
82
+ }
83
+
84
+ const btnRun = document.querySelector('#btn-run-tests');
85
+ const runTests = ()=>{
86
+ btnRun.setAttribute('disabled','disabled');
87
+ wPost('run-tests');
88
+ logTarget.innerText = 'Running tests...';
89
+ }
90
+ btnRun.addEventListener('click', runTests);
91
+ const log2 = function f(...args){
92
+ logClass('', ...args);
93
+ return f;
94
+ };
95
+ const log = function f(...args){
96
+ logClass('','index.html:',...args);
97
+ return f;
98
+ };
99
+
100
+ const timerId = setTimeout( ()=>{
101
+ logClass('error',"The SQLTester module is taking an unusually ",
102
+ "long time to load. More information may be available",
103
+ "in the dev console.");
104
+ }, 3000 /* assuming localhost */ );
105
+
106
+ W.onmessage = function({data}){
107
+ switch(data.type){
108
+ case 'stdout': log2(data.payload.message); break;
109
+ case 'tests-end':
110
+ btnRun.removeAttribute('disabled');
111
+ delete data.payload.nTest;
112
+ log("test results:",data.payload);
113
+ break;
114
+ case 'is-ready':
115
+ clearTimeout(timerId);
116
+ runTests(); break;
117
+ default:
118
+ log("unhandled onmessage",data);
119
+ break;
120
+ }
121
+ };
122
+ })();
123
+ </script>
124
+ </body>
125
+ </html>
local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/SQLTester/touint8array.c ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ** 2023-08-29
3
+ **
4
+ ** The author disclaims copyright to this source code. In place of
5
+ ** a legal notice, here is a blessing:
6
+ **
7
+ ** May you do good and not evil.
8
+ ** May you find forgiveness for yourself and forgive others.
9
+ ** May you share freely, never taking more than you give.
10
+ **
11
+ *************************************************************************
12
+ ** This file contains a tool for writing out the contents of stdin as
13
+ ** a comma-separated list of numbers, one per byte.
14
+ */
15
+
16
+ #include <stdio.h>
17
+ int main(int argc, char const **argv){
18
+ int i;
19
+ int rc = 0, colWidth = 30;
20
+ int ch;
21
+ printf("[");
22
+ for( i=0; EOF!=(ch = fgetc(stdin)); ++i ){
23
+ if( 0!=i ) printf(",");
24
+ if( i && 0==(i%colWidth) ) puts("");
25
+ printf("%d",ch);
26
+ }
27
+ printf("]");
28
+ return rc;
29
+ }
local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/api/post-js-header.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ post-js-header.js is to be prepended to other code to create
3
+ post-js.js for use with Emscripten's --post-js flag. This code
4
+ requires that it be running in that context. The Emscripten
5
+ environment must have been set up already but it will not have
6
+ loaded its WASM when the code in this file is run. The function it
7
+ installs will be run after the WASM module is loaded, at which
8
+ point the sqlite3 JS API bits will get set up.
9
+ */
10
+ if(!Module.postRun) Module.postRun = [];
11
+ Module.postRun.push(function(Module/*the Emscripten-style module object*/){
12
+ 'use strict';
13
+ /* This function will contain at least the following:
14
+
15
+ - post-js-header.js (this file)
16
+ - sqlite3-api-prologue.js => Bootstrapping bits to attach the rest to
17
+ - common/whwasmutil.js => Replacements for much of Emscripten's glue
18
+ - jaccwaby/jaccwabyt.js => Jaccwabyt (C/JS struct binding)
19
+ - sqlite3-api-glue.js => glues previous parts together
20
+ - sqlite3-api-oo.js => SQLite3 OO API #1
21
+ - sqlite3-api-worker1.js => Worker-based API
22
+ - sqlite3-vfs-helper.c-pp.js => Utilities for VFS impls
23
+ - sqlite3-vtab-helper.c-pp.js => Utilities for virtual table impls
24
+ - sqlite3-vfs-opfs.c-pp.js => OPFS VFS
25
+ - sqlite3-vfs-opfs-sahpool.c-pp.js => OPFS SAHPool VFS
26
+ - sqlite3-api-cleanup.js => final API cleanup
27
+ - post-js-footer.js => closes this postRun() function
28
+ */
local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js ADDED
@@ -0,0 +1,1457 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //#ifnot target=node
2
+ /*
3
+ 2022-09-18
4
+
5
+ The author disclaims copyright to this source code. In place of a
6
+ legal notice, here is a blessing:
7
+
8
+ * May you do good and not evil.
9
+ * May you find forgiveness for yourself and forgive others.
10
+ * May you share freely, never taking more than you give.
11
+
12
+ ***********************************************************************
13
+
14
+ This file holds the synchronous half of an sqlite3_vfs
15
+ implementation which proxies, in a synchronous fashion, the
16
+ asynchronous Origin-Private FileSystem (OPFS) APIs using a second
17
+ Worker, implemented in sqlite3-opfs-async-proxy.js. This file is
18
+ intended to be appended to the main sqlite3 JS deliverable somewhere
19
+ after sqlite3-api-oo1.js and before sqlite3-api-cleanup.js.
20
+ */
21
+ 'use strict';
22
+ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
23
+ /**
24
+ installOpfsVfs() returns a Promise which, on success, installs an
25
+ sqlite3_vfs named "opfs", suitable for use with all sqlite3 APIs
26
+ which accept a VFS. It is intended to be called via
27
+ sqlite3ApiBootstrap.initializers or an equivalent mechanism.
28
+
29
+ The installed VFS uses the Origin-Private FileSystem API for
30
+ all file storage. On error it is rejected with an exception
31
+ explaining the problem. Reasons for rejection include, but are
32
+ not limited to:
33
+
34
+ - The counterpart Worker (see below) could not be loaded.
35
+
36
+ - The environment does not support OPFS. That includes when
37
+ this function is called from the main window thread.
38
+
39
+ Significant notes and limitations:
40
+
41
+ - The OPFS features used here are only available in dedicated Worker
42
+ threads. This file tries to detect that case, resulting in a
43
+ rejected Promise if those features do not seem to be available.
44
+
45
+ - It requires the SharedArrayBuffer and Atomics classes, and the
46
+ former is only available if the HTTP server emits the so-called
47
+ COOP and COEP response headers. These features are required for
48
+ proxying OPFS's synchronous API via the synchronous interface
49
+ required by the sqlite3_vfs API.
50
+
51
+ - This function may only be called a single time. When called, this
52
+ function removes itself from the sqlite3 object.
53
+
54
+ All arguments to this function are for internal/development purposes
55
+ only. They do not constitute a public API and may change at any
56
+ time.
57
+
58
+ The argument may optionally be a plain object with the following
59
+ configuration options:
60
+
61
+ - proxyUri: name of the async proxy JS file.
62
+
63
+ - verbose (=2): an integer 0-3. 0 disables all logging, 1 enables
64
+ logging of errors. 2 enables logging of warnings and errors. 3
65
+ additionally enables debugging info. Logging is performed
66
+ via the sqlite3.config.{log|warn|error}() functions.
67
+
68
+ - sanityChecks (=false): if true, some basic sanity tests are run on
69
+ the OPFS VFS API after it's initialized, before the returned
70
+ Promise resolves. This is only intended for testing and
71
+ development of the VFS, not client-side use.
72
+
73
+ On success, the Promise resolves to the top-most sqlite3 namespace
74
+ object and that object gets a new object installed in its
75
+ `opfs` property, containing several OPFS-specific utilities.
76
+ */
77
+ const installOpfsVfs = function callee(options){
78
+ if(!globalThis.SharedArrayBuffer
79
+ || !globalThis.Atomics){
80
+ return Promise.reject(
81
+ new Error("Cannot install OPFS: Missing SharedArrayBuffer and/or Atomics. "+
82
+ "The server must emit the COOP/COEP response headers to enable those. "+
83
+ "See https://sqlite.org/wasm/doc/trunk/persistence.md#coop-coep")
84
+ );
85
+ }else if('undefined'===typeof WorkerGlobalScope){
86
+ return Promise.reject(
87
+ new Error("The OPFS sqlite3_vfs cannot run in the main thread "+
88
+ "because it requires Atomics.wait().")
89
+ );
90
+ }else if(!globalThis.FileSystemHandle ||
91
+ !globalThis.FileSystemDirectoryHandle ||
92
+ !globalThis.FileSystemFileHandle ||
93
+ !globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle ||
94
+ !navigator?.storage?.getDirectory){
95
+ return Promise.reject(
96
+ new Error("Missing required OPFS APIs.")
97
+ );
98
+ }
99
+ if(!options || 'object'!==typeof options){
100
+ options = Object.create(null);
101
+ }
102
+ const urlParams = new URL(globalThis.location.href).searchParams;
103
+ if(urlParams.has('opfs-disable')){
104
+ //sqlite3.config.warn('Explicitly not installing "opfs" VFS due to opfs-disable flag.');
105
+ return Promise.resolve(sqlite3);
106
+ }
107
+ if(undefined===options.verbose){
108
+ options.verbose = urlParams.has('opfs-verbose')
109
+ ? (+urlParams.get('opfs-verbose') || 2) : 1;
110
+ }
111
+ if(undefined===options.sanityChecks){
112
+ options.sanityChecks = urlParams.has('opfs-sanity-check');
113
+ }
114
+ if(undefined===options.proxyUri){
115
+ options.proxyUri = callee.defaultProxyUri;
116
+ }
117
+
118
+ //sqlite3.config.warn("OPFS options =",options,globalThis.location);
119
+
120
+ if('function' === typeof options.proxyUri){
121
+ options.proxyUri = options.proxyUri();
122
+ }
123
+ const thePromise = new Promise(function(promiseResolve_, promiseReject_){
124
+ const loggers = [
125
+ sqlite3.config.error,
126
+ sqlite3.config.warn,
127
+ sqlite3.config.log
128
+ ];
129
+ const logImpl = (level,...args)=>{
130
+ if(options.verbose>level) loggers[level]("OPFS syncer:",...args);
131
+ };
132
+ const log = (...args)=>logImpl(2, ...args);
133
+ const warn = (...args)=>logImpl(1, ...args);
134
+ const error = (...args)=>logImpl(0, ...args);
135
+ const toss = sqlite3.util.toss;
136
+ const capi = sqlite3.capi;
137
+ const util = sqlite3.util;
138
+ const wasm = sqlite3.wasm;
139
+ const sqlite3_vfs = capi.sqlite3_vfs;
140
+ const sqlite3_file = capi.sqlite3_file;
141
+ const sqlite3_io_methods = capi.sqlite3_io_methods;
142
+ /**
143
+ Generic utilities for working with OPFS. This will get filled out
144
+ by the Promise setup and, on success, installed as sqlite3.opfs.
145
+
146
+ ACHTUNG: do not rely on these APIs in client code. They are
147
+ experimental and subject to change or removal as the
148
+ OPFS-specific sqlite3_vfs evolves.
149
+ */
150
+ const opfsUtil = Object.create(null);
151
+
152
+ /**
153
+ Returns true if _this_ thread has access to the OPFS APIs.
154
+ */
155
+ const thisThreadHasOPFS = ()=>{
156
+ return globalThis.FileSystemHandle &&
157
+ globalThis.FileSystemDirectoryHandle &&
158
+ globalThis.FileSystemFileHandle &&
159
+ globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle &&
160
+ navigator?.storage?.getDirectory;
161
+ };
162
+
163
+ /**
164
+ Not part of the public API. Solely for internal/development
165
+ use.
166
+ */
167
+ opfsUtil.metrics = {
168
+ dump: function(){
169
+ let k, n = 0, t = 0, w = 0;
170
+ for(k in state.opIds){
171
+ const m = metrics[k];
172
+ n += m.count;
173
+ t += m.time;
174
+ w += m.wait;
175
+ m.avgTime = (m.count && m.time) ? (m.time / m.count) : 0;
176
+ m.avgWait = (m.count && m.wait) ? (m.wait / m.count) : 0;
177
+ }
178
+ sqlite3.config.log(globalThis.location.href,
179
+ "metrics for",globalThis.location.href,":",metrics,
180
+ "\nTotal of",n,"op(s) for",t,
181
+ "ms (incl. "+w+" ms of waiting on the async side)");
182
+ sqlite3.config.log("Serialization metrics:",metrics.s11n);
183
+ W.postMessage({type:'opfs-async-metrics'});
184
+ },
185
+ reset: function(){
186
+ let k;
187
+ const r = (m)=>(m.count = m.time = m.wait = 0);
188
+ for(k in state.opIds){
189
+ r(metrics[k] = Object.create(null));
190
+ }
191
+ let s = metrics.s11n = Object.create(null);
192
+ s = s.serialize = Object.create(null);
193
+ s.count = s.time = 0;
194
+ s = metrics.s11n.deserialize = Object.create(null);
195
+ s.count = s.time = 0;
196
+ }
197
+ }/*metrics*/;
198
+ const opfsIoMethods = new sqlite3_io_methods();
199
+ const opfsVfs = new sqlite3_vfs()
200
+ .addOnDispose( ()=>opfsIoMethods.dispose());
201
+ let promiseWasRejected = undefined;
202
+ const promiseReject = (err)=>{
203
+ promiseWasRejected = true;
204
+ opfsVfs.dispose();
205
+ return promiseReject_(err);
206
+ };
207
+ const promiseResolve = ()=>{
208
+ promiseWasRejected = false;
209
+ return promiseResolve_(sqlite3);
210
+ };
211
+ const W =
212
+ //#if target=es6-bundler-friendly
213
+ new Worker(new URL("sqlite3-opfs-async-proxy.js", import.meta.url));
214
+ //#elif target=es6-module
215
+ new Worker(new URL(options.proxyUri, import.meta.url));
216
+ //#else
217
+ new Worker(options.proxyUri);
218
+ //#endif
219
+ setTimeout(()=>{
220
+ /* At attempt to work around a browser-specific quirk in which
221
+ the Worker load is failing in such a way that we neither
222
+ resolve nor reject it. This workaround gives that resolve/reject
223
+ a time limit and rejects if that timer expires. Discussion:
224
+ https://sqlite.org/forum/forumpost/a708c98dcb3ef */
225
+ if(undefined===promiseWasRejected){
226
+ promiseReject(
227
+ new Error("Timeout while waiting for OPFS async proxy worker.")
228
+ );
229
+ }
230
+ }, 4000);
231
+ W._originalOnError = W.onerror /* will be restored later */;
232
+ W.onerror = function(err){
233
+ // The error object doesn't contain any useful info when the
234
+ // failure is, e.g., that the remote script is 404.
235
+ error("Error initializing OPFS asyncer:",err);
236
+ promiseReject(new Error("Loading OPFS async Worker failed for unknown reasons."));
237
+ };
238
+ const pDVfs = capi.sqlite3_vfs_find(null)/*pointer to default VFS*/;
239
+ const dVfs = pDVfs
240
+ ? new sqlite3_vfs(pDVfs)
241
+ : null /* dVfs will be null when sqlite3 is built with
242
+ SQLITE_OS_OTHER. */;
243
+ opfsIoMethods.$iVersion = 1;
244
+ opfsVfs.$iVersion = 2/*yes, two*/;
245
+ opfsVfs.$szOsFile = capi.sqlite3_file.structInfo.sizeof;
246
+ opfsVfs.$mxPathname = 1024/* sure, why not? The OPFS name length limit
247
+ is undocumented/unspecified. */;
248
+ opfsVfs.$zName = wasm.allocCString("opfs");
249
+ // All C-side memory of opfsVfs is zeroed out, but just to be explicit:
250
+ opfsVfs.$xDlOpen = opfsVfs.$xDlError = opfsVfs.$xDlSym = opfsVfs.$xDlClose = null;
251
+ opfsVfs.addOnDispose(
252
+ '$zName', opfsVfs.$zName,
253
+ 'cleanup default VFS wrapper', ()=>(dVfs ? dVfs.dispose() : null)
254
+ );
255
+ /**
256
+ Pedantic sidebar about opfsVfs.ondispose: the entries in that array
257
+ are items to clean up when opfsVfs.dispose() is called, but in this
258
+ environment it will never be called. The VFS instance simply
259
+ hangs around until the WASM module instance is cleaned up. We
260
+ "could" _hypothetically_ clean it up by "importing" an
261
+ sqlite3_os_end() impl into the wasm build, but the shutdown order
262
+ of the wasm engine and the JS one are undefined so there is no
263
+ guaranty that the opfsVfs instance would be available in one
264
+ environment or the other when sqlite3_os_end() is called (_if_ it
265
+ gets called at all in a wasm build, which is undefined).
266
+ */
267
+ /**
268
+ State which we send to the async-api Worker or share with it.
269
+ This object must initially contain only cloneable or sharable
270
+ objects. After the worker's "inited" message arrives, other types
271
+ of data may be added to it.
272
+
273
+ For purposes of Atomics.wait() and Atomics.notify(), we use a
274
+ SharedArrayBuffer with one slot reserved for each of the API
275
+ proxy's methods. The sync side of the API uses Atomics.wait()
276
+ on the corresponding slot and the async side uses
277
+ Atomics.notify() on that slot.
278
+
279
+ The approach of using a single SAB to serialize comms for all
280
+ instances might(?) lead to deadlock situations in multi-db
281
+ cases. We should probably have one SAB here with a single slot
282
+ for locking a per-file initialization step and then allocate a
283
+ separate SAB like the above one for each file. That will
284
+ require a bit of acrobatics but should be feasible. The most
285
+ problematic part is that xOpen() would have to use
286
+ postMessage() to communicate its SharedArrayBuffer, and mixing
287
+ that approach with Atomics.wait/notify() gets a bit messy.
288
+ */
289
+ const state = Object.create(null);
290
+ state.verbose = options.verbose;
291
+ state.littleEndian = (()=>{
292
+ const buffer = new ArrayBuffer(2);
293
+ new DataView(buffer).setInt16(0, 256, true /* ==>littleEndian */);
294
+ // Int16Array uses the platform's endianness.
295
+ return new Int16Array(buffer)[0] === 256;
296
+ })();
297
+ /**
298
+ asyncIdleWaitTime is how long (ms) to wait, in the async proxy,
299
+ for each Atomics.wait() when waiting on inbound VFS API calls.
300
+ We need to wake up periodically to give the thread a chance to
301
+ do other things. If this is too high (e.g. 500ms) then even two
302
+ workers/tabs can easily run into locking errors. Some multiple
303
+ of this value is also used for determining how long to wait on
304
+ lock contention to free up.
305
+ */
306
+ state.asyncIdleWaitTime = 150;
307
+
308
+ /**
309
+ Whether the async counterpart should log exceptions to
310
+ the serialization channel. That produces a great deal of
311
+ noise for seemingly innocuous things like xAccess() checks
312
+ for missing files, so this option may have one of 3 values:
313
+
314
+ 0 = no exception logging.
315
+
316
+ 1 = only log exceptions for "significant" ops like xOpen(),
317
+ xRead(), and xWrite().
318
+
319
+ 2 = log all exceptions.
320
+ */
321
+ state.asyncS11nExceptions = 1;
322
+ /* Size of file I/O buffer block. 64k = max sqlite3 page size, and
323
+ xRead/xWrite() will never deal in blocks larger than that. */
324
+ state.fileBufferSize = 1024 * 64;
325
+ state.sabS11nOffset = state.fileBufferSize;
326
+ /**
327
+ The size of the block in our SAB for serializing arguments and
328
+ result values. Needs to be large enough to hold serialized
329
+ values of any of the proxied APIs. Filenames are the largest
330
+ part but are limited to opfsVfs.$mxPathname bytes. We also
331
+ store exceptions there, so it needs to be long enough to hold
332
+ a reasonably long exception string.
333
+ */
334
+ state.sabS11nSize = opfsVfs.$mxPathname * 2;
335
+ /**
336
+ The SAB used for all data I/O between the synchronous and
337
+ async halves (file i/o and arg/result s11n).
338
+ */
339
+ state.sabIO = new SharedArrayBuffer(
340
+ state.fileBufferSize/* file i/o block */
341
+ + state.sabS11nSize/* argument/result serialization block */
342
+ );
343
+ state.opIds = Object.create(null);
344
+ const metrics = Object.create(null);
345
+ {
346
+ /* Indexes for use in our SharedArrayBuffer... */
347
+ let i = 0;
348
+ /* SAB slot used to communicate which operation is desired
349
+ between both workers. This worker writes to it and the other
350
+ listens for changes. */
351
+ state.opIds.whichOp = i++;
352
+ /* Slot for storing return values. This worker listens to that
353
+ slot and the other worker writes to it. */
354
+ state.opIds.rc = i++;
355
+ /* Each function gets an ID which this worker writes to
356
+ the whichOp slot. The async-api worker uses Atomic.wait()
357
+ on the whichOp slot to figure out which operation to run
358
+ next. */
359
+ state.opIds.xAccess = i++;
360
+ state.opIds.xClose = i++;
361
+ state.opIds.xDelete = i++;
362
+ state.opIds.xDeleteNoWait = i++;
363
+ state.opIds.xFileSize = i++;
364
+ state.opIds.xLock = i++;
365
+ state.opIds.xOpen = i++;
366
+ state.opIds.xRead = i++;
367
+ state.opIds.xSleep = i++;
368
+ state.opIds.xSync = i++;
369
+ state.opIds.xTruncate = i++;
370
+ state.opIds.xUnlock = i++;
371
+ state.opIds.xWrite = i++;
372
+ state.opIds.mkdir = i++;
373
+ state.opIds['opfs-async-metrics'] = i++;
374
+ state.opIds['opfs-async-shutdown'] = i++;
375
+ /* The retry slot is used by the async part for wait-and-retry
376
+ semantics. Though we could hypothetically use the xSleep slot
377
+ for that, doing so might lead to undesired side effects. */
378
+ state.opIds.retry = i++;
379
+ state.sabOP = new SharedArrayBuffer(
380
+ i * 4/* ==sizeof int32, noting that Atomics.wait() and friends
381
+ can only function on Int32Array views of an SAB. */);
382
+ opfsUtil.metrics.reset();
383
+ }
384
+ /**
385
+ SQLITE_xxx constants to export to the async worker
386
+ counterpart...
387
+ */
388
+ state.sq3Codes = Object.create(null);
389
+ [
390
+ 'SQLITE_ACCESS_EXISTS',
391
+ 'SQLITE_ACCESS_READWRITE',
392
+ 'SQLITE_BUSY',
393
+ 'SQLITE_CANTOPEN',
394
+ 'SQLITE_ERROR',
395
+ 'SQLITE_IOERR',
396
+ 'SQLITE_IOERR_ACCESS',
397
+ 'SQLITE_IOERR_CLOSE',
398
+ 'SQLITE_IOERR_DELETE',
399
+ 'SQLITE_IOERR_FSYNC',
400
+ 'SQLITE_IOERR_LOCK',
401
+ 'SQLITE_IOERR_READ',
402
+ 'SQLITE_IOERR_SHORT_READ',
403
+ 'SQLITE_IOERR_TRUNCATE',
404
+ 'SQLITE_IOERR_UNLOCK',
405
+ 'SQLITE_IOERR_WRITE',
406
+ 'SQLITE_LOCK_EXCLUSIVE',
407
+ 'SQLITE_LOCK_NONE',
408
+ 'SQLITE_LOCK_PENDING',
409
+ 'SQLITE_LOCK_RESERVED',
410
+ 'SQLITE_LOCK_SHARED',
411
+ 'SQLITE_LOCKED',
412
+ 'SQLITE_MISUSE',
413
+ 'SQLITE_NOTFOUND',
414
+ 'SQLITE_OPEN_CREATE',
415
+ 'SQLITE_OPEN_DELETEONCLOSE',
416
+ 'SQLITE_OPEN_MAIN_DB',
417
+ 'SQLITE_OPEN_READONLY'
418
+ ].forEach((k)=>{
419
+ if(undefined === (state.sq3Codes[k] = capi[k])){
420
+ toss("Maintenance required: not found:",k);
421
+ }
422
+ });
423
+ state.opfsFlags = Object.assign(Object.create(null),{
424
+ /**
425
+ Flag for use with xOpen(). URI flag "opfs-unlock-asap=1"
426
+ enables this. See defaultUnlockAsap, below.
427
+ */
428
+ OPFS_UNLOCK_ASAP: 0x01,
429
+ /**
430
+ Flag for use with xOpen(). URI flag "delete-before-open=1"
431
+ tells the VFS to delete the db file before attempting to open
432
+ it. This can be used, e.g., to replace a db which has been
433
+ corrupted (without forcing us to expose a delete/unlink()
434
+ function in the public API).
435
+
436
+ Failure to unlink the file is ignored but may lead to
437
+ downstream errors. An unlink can fail if, e.g., another tab
438
+ has the handle open.
439
+
440
+ It goes without saying that deleting a file out from under another
441
+ instance results in Undefined Behavior.
442
+ */
443
+ OPFS_UNLINK_BEFORE_OPEN: 0x02,
444
+ /**
445
+ If true, any async routine which implicitly acquires a sync
446
+ access handle (i.e. an OPFS lock) will release that lock at
447
+ the end of the call which acquires it. If false, such
448
+ "autolocks" are not released until the VFS is idle for some
449
+ brief amount of time.
450
+
451
+ The benefit of enabling this is much higher concurrency. The
452
+ down-side is much-reduced performance (as much as a 4x decrease
453
+ in speedtest1).
454
+ */
455
+ defaultUnlockAsap: false
456
+ });
457
+
458
+ /**
459
+ Runs the given operation (by name) in the async worker
460
+ counterpart, waits for its response, and returns the result
461
+ which the async worker writes to SAB[state.opIds.rc]. The
462
+ 2nd and subsequent arguments must be the aruguments for the
463
+ async op.
464
+ */
465
+ const opRun = (op,...args)=>{
466
+ const opNdx = state.opIds[op] || toss("Invalid op ID:",op);
467
+ state.s11n.serialize(...args);
468
+ Atomics.store(state.sabOPView, state.opIds.rc, -1);
469
+ Atomics.store(state.sabOPView, state.opIds.whichOp, opNdx);
470
+ Atomics.notify(state.sabOPView, state.opIds.whichOp)
471
+ /* async thread will take over here */;
472
+ const t = performance.now();
473
+ while('not-equal'!==Atomics.wait(state.sabOPView, state.opIds.rc, -1)){
474
+ /*
475
+ The reason for this loop is buried in the details of a long
476
+ discussion at:
477
+
478
+ https://github.com/sqlite/sqlite-wasm/issues/12
479
+
480
+ Summary: in at least one browser flavor, under high loads,
481
+ the wait()/notify() pairings can get out of sync. Calling
482
+ wait() here until it returns 'not-equal' gets them back in
483
+ sync.
484
+ */
485
+ }
486
+ /* When the above wait() call returns 'not-equal', the async
487
+ half will have completed the operation and reported its results
488
+ in the state.opIds.rc slot of the SAB. */
489
+ const rc = Atomics.load(state.sabOPView, state.opIds.rc);
490
+ metrics[op].wait += performance.now() - t;
491
+ if(rc && state.asyncS11nExceptions){
492
+ const err = state.s11n.deserialize();
493
+ if(err) error(op+"() async error:",...err);
494
+ }
495
+ return rc;
496
+ };
497
+
498
+ /**
499
+ Not part of the public API. Only for test/development use.
500
+ */
501
+ opfsUtil.debug = {
502
+ asyncShutdown: ()=>{
503
+ warn("Shutting down OPFS async listener. The OPFS VFS will no longer work.");
504
+ opRun('opfs-async-shutdown');
505
+ },
506
+ asyncRestart: ()=>{
507
+ warn("Attempting to restart OPFS VFS async listener. Might work, might not.");
508
+ W.postMessage({type: 'opfs-async-restart'});
509
+ }
510
+ };
511
+
512
+ const initS11n = ()=>{
513
+ /**
514
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
515
+ ACHTUNG: this code is 100% duplicated in the other half of
516
+ this proxy! The documentation is maintained in the
517
+ "synchronous half".
518
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
519
+
520
+ This proxy de/serializes cross-thread function arguments and
521
+ output-pointer values via the state.sabIO SharedArrayBuffer,
522
+ using the region defined by (state.sabS11nOffset,
523
+ state.sabS11nOffset + state.sabS11nSize]. Only one dataset is
524
+ recorded at a time.
525
+
526
+ This is not a general-purpose format. It only supports the
527
+ range of operations, and data sizes, needed by the
528
+ sqlite3_vfs and sqlite3_io_methods operations. Serialized
529
+ data are transient and this serialization algorithm may
530
+ change at any time.
531
+
532
+ The data format can be succinctly summarized as:
533
+
534
+ Nt...Td...D
535
+
536
+ Where:
537
+
538
+ - N = number of entries (1 byte)
539
+
540
+ - t = type ID of first argument (1 byte)
541
+
542
+ - ...T = type IDs of the 2nd and subsequent arguments (1 byte
543
+ each).
544
+
545
+ - d = raw bytes of first argument (per-type size).
546
+
547
+ - ...D = raw bytes of the 2nd and subsequent arguments (per-type
548
+ size).
549
+
550
+ All types except strings have fixed sizes. Strings are stored
551
+ using their TextEncoder/TextDecoder representations. It would
552
+ arguably make more sense to store them as Int16Arrays of
553
+ their JS character values, but how best/fastest to get that
554
+ in and out of string form is an open point. Initial
555
+ experimentation with that approach did not gain us any speed.
556
+
557
+ Historical note: this impl was initially about 1% this size by
558
+ using using JSON.stringify/parse(), but using fit-to-purpose
559
+ serialization saves considerable runtime.
560
+ */
561
+ if(state.s11n) return state.s11n;
562
+ const textDecoder = new TextDecoder(),
563
+ textEncoder = new TextEncoder('utf-8'),
564
+ viewU8 = new Uint8Array(state.sabIO, state.sabS11nOffset, state.sabS11nSize),
565
+ viewDV = new DataView(state.sabIO, state.sabS11nOffset, state.sabS11nSize);
566
+ state.s11n = Object.create(null);
567
+ /* Only arguments and return values of these types may be
568
+ serialized. This covers the whole range of types needed by the
569
+ sqlite3_vfs API. */
570
+ const TypeIds = Object.create(null);
571
+ TypeIds.number = { id: 1, size: 8, getter: 'getFloat64', setter: 'setFloat64' };
572
+ TypeIds.bigint = { id: 2, size: 8, getter: 'getBigInt64', setter: 'setBigInt64' };
573
+ TypeIds.boolean = { id: 3, size: 4, getter: 'getInt32', setter: 'setInt32' };
574
+ TypeIds.string = { id: 4 };
575
+
576
+ const getTypeId = (v)=>(
577
+ TypeIds[typeof v]
578
+ || toss("Maintenance required: this value type cannot be serialized.",v)
579
+ );
580
+ const getTypeIdById = (tid)=>{
581
+ switch(tid){
582
+ case TypeIds.number.id: return TypeIds.number;
583
+ case TypeIds.bigint.id: return TypeIds.bigint;
584
+ case TypeIds.boolean.id: return TypeIds.boolean;
585
+ case TypeIds.string.id: return TypeIds.string;
586
+ default: toss("Invalid type ID:",tid);
587
+ }
588
+ };
589
+
590
+ /**
591
+ Returns an array of the deserialized state stored by the most
592
+ recent serialize() operation (from from this thread or the
593
+ counterpart thread), or null if the serialization buffer is
594
+ empty. If passed a truthy argument, the serialization buffer
595
+ is cleared after deserialization.
596
+ */
597
+ state.s11n.deserialize = function(clear=false){
598
+ ++metrics.s11n.deserialize.count;
599
+ const t = performance.now();
600
+ const argc = viewU8[0];
601
+ const rc = argc ? [] : null;
602
+ if(argc){
603
+ const typeIds = [];
604
+ let offset = 1, i, n, v;
605
+ for(i = 0; i < argc; ++i, ++offset){
606
+ typeIds.push(getTypeIdById(viewU8[offset]));
607
+ }
608
+ for(i = 0; i < argc; ++i){
609
+ const t = typeIds[i];
610
+ if(t.getter){
611
+ v = viewDV[t.getter](offset, state.littleEndian);
612
+ offset += t.size;
613
+ }else{/*String*/
614
+ n = viewDV.getInt32(offset, state.littleEndian);
615
+ offset += 4;
616
+ v = textDecoder.decode(viewU8.slice(offset, offset+n));
617
+ offset += n;
618
+ }
619
+ rc.push(v);
620
+ }
621
+ }
622
+ if(clear) viewU8[0] = 0;
623
+ //log("deserialize:",argc, rc);
624
+ metrics.s11n.deserialize.time += performance.now() - t;
625
+ return rc;
626
+ };
627
+
628
+ /**
629
+ Serializes all arguments to the shared buffer for consumption
630
+ by the counterpart thread.
631
+
632
+ This routine is only intended for serializing OPFS VFS
633
+ arguments and (in at least one special case) result values,
634
+ and the buffer is sized to be able to comfortably handle
635
+ those.
636
+
637
+ If passed no arguments then it zeroes out the serialization
638
+ state.
639
+ */
640
+ state.s11n.serialize = function(...args){
641
+ const t = performance.now();
642
+ ++metrics.s11n.serialize.count;
643
+ if(args.length){
644
+ //log("serialize():",args);
645
+ const typeIds = [];
646
+ let i = 0, offset = 1;
647
+ viewU8[0] = args.length & 0xff /* header = # of args */;
648
+ for(; i < args.length; ++i, ++offset){
649
+ /* Write the TypeIds.id value into the next args.length
650
+ bytes. */
651
+ typeIds.push(getTypeId(args[i]));
652
+ viewU8[offset] = typeIds[i].id;
653
+ }
654
+ for(i = 0; i < args.length; ++i) {
655
+ /* Deserialize the following bytes based on their
656
+ corresponding TypeIds.id from the header. */
657
+ const t = typeIds[i];
658
+ if(t.setter){
659
+ viewDV[t.setter](offset, args[i], state.littleEndian);
660
+ offset += t.size;
661
+ }else{/*String*/
662
+ const s = textEncoder.encode(args[i]);
663
+ viewDV.setInt32(offset, s.byteLength, state.littleEndian);
664
+ offset += 4;
665
+ viewU8.set(s, offset);
666
+ offset += s.byteLength;
667
+ }
668
+ }
669
+ //log("serialize() result:",viewU8.slice(0,offset));
670
+ }else{
671
+ viewU8[0] = 0;
672
+ }
673
+ metrics.s11n.serialize.time += performance.now() - t;
674
+ };
675
+ return state.s11n;
676
+ }/*initS11n()*/;
677
+
678
+ /**
679
+ Generates a random ASCII string len characters long, intended for
680
+ use as a temporary file name.
681
+ */
682
+ const randomFilename = function f(len=16){
683
+ if(!f._chars){
684
+ f._chars = "abcdefghijklmnopqrstuvwxyz"+
685
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"+
686
+ "012346789";
687
+ f._n = f._chars.length;
688
+ }
689
+ const a = [];
690
+ let i = 0;
691
+ for( ; i < len; ++i){
692
+ const ndx = Math.random() * (f._n * 64) % f._n | 0;
693
+ a[i] = f._chars[ndx];
694
+ }
695
+ return a.join("");
696
+ /*
697
+ An alternative impl. with an unpredictable length
698
+ but much simpler:
699
+
700
+ Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(36)
701
+ */
702
+ };
703
+
704
+ /**
705
+ Map of sqlite3_file pointers to objects constructed by xOpen().
706
+ */
707
+ const __openFiles = Object.create(null);
708
+
709
+ const opTimer = Object.create(null);
710
+ opTimer.op = undefined;
711
+ opTimer.start = undefined;
712
+ const mTimeStart = (op)=>{
713
+ opTimer.start = performance.now();
714
+ opTimer.op = op;
715
+ ++metrics[op].count;
716
+ };
717
+ const mTimeEnd = ()=>(
718
+ metrics[opTimer.op].time += performance.now() - opTimer.start
719
+ );
720
+
721
+ /**
722
+ Impls for the sqlite3_io_methods methods. Maintenance reminder:
723
+ members are in alphabetical order to simplify finding them.
724
+ */
725
+ const ioSyncWrappers = {
726
+ xCheckReservedLock: function(pFile,pOut){
727
+ /**
728
+ As of late 2022, only a single lock can be held on an OPFS
729
+ file. We have no way of checking whether any _other_ db
730
+ connection has a lock except by trying to obtain and (on
731
+ success) release a sync-handle for it, but doing so would
732
+ involve an inherent race condition. For the time being,
733
+ pending a better solution, we simply report whether the
734
+ given pFile is open.
735
+
736
+ Update 2024-06-12: based on forum discussions, this
737
+ function now always sets pOut to 0 (false):
738
+
739
+ https://sqlite.org/forum/forumpost/a2f573b00cda1372
740
+ */
741
+ wasm.poke(pOut, 0, 'i32');
742
+ return 0;
743
+ },
744
+ xClose: function(pFile){
745
+ mTimeStart('xClose');
746
+ let rc = 0;
747
+ const f = __openFiles[pFile];
748
+ if(f){
749
+ delete __openFiles[pFile];
750
+ rc = opRun('xClose', pFile);
751
+ if(f.sq3File) f.sq3File.dispose();
752
+ }
753
+ mTimeEnd();
754
+ return rc;
755
+ },
756
+ xDeviceCharacteristics: function(pFile){
757
+ return capi.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN;
758
+ },
759
+ xFileControl: function(pFile, opId, pArg){
760
+ /*mTimeStart('xFileControl');
761
+ mTimeEnd();*/
762
+ return capi.SQLITE_NOTFOUND;
763
+ },
764
+ xFileSize: function(pFile,pSz64){
765
+ mTimeStart('xFileSize');
766
+ let rc = opRun('xFileSize', pFile);
767
+ if(0==rc){
768
+ try {
769
+ const sz = state.s11n.deserialize()[0];
770
+ wasm.poke(pSz64, sz, 'i64');
771
+ }catch(e){
772
+ error("Unexpected error reading xFileSize() result:",e);
773
+ rc = state.sq3Codes.SQLITE_IOERR;
774
+ }
775
+ }
776
+ mTimeEnd();
777
+ return rc;
778
+ },
779
+ xLock: function(pFile,lockType){
780
+ mTimeStart('xLock');
781
+ const f = __openFiles[pFile];
782
+ let rc = 0;
783
+ /* All OPFS locks are exclusive locks. If xLock() has
784
+ previously succeeded, do nothing except record the lock
785
+ type. If no lock is active, have the async counterpart
786
+ lock the file. */
787
+ if( !f.lockType ) {
788
+ rc = opRun('xLock', pFile, lockType);
789
+ if( 0===rc ) f.lockType = lockType;
790
+ }else{
791
+ f.lockType = lockType;
792
+ }
793
+ mTimeEnd();
794
+ return rc;
795
+ },
796
+ xRead: function(pFile,pDest,n,offset64){
797
+ mTimeStart('xRead');
798
+ const f = __openFiles[pFile];
799
+ let rc;
800
+ try {
801
+ rc = opRun('xRead',pFile, n, Number(offset64));
802
+ if(0===rc || capi.SQLITE_IOERR_SHORT_READ===rc){
803
+ /**
804
+ Results get written to the SharedArrayBuffer f.sabView.
805
+ Because the heap is _not_ a SharedArrayBuffer, we have
806
+ to copy the results. TypedArray.set() seems to be the
807
+ fastest way to copy this. */
808
+ wasm.heap8u().set(f.sabView.subarray(0, n), pDest);
809
+ }
810
+ }catch(e){
811
+ error("xRead(",arguments,") failed:",e,f);
812
+ rc = capi.SQLITE_IOERR_READ;
813
+ }
814
+ mTimeEnd();
815
+ return rc;
816
+ },
817
+ xSync: function(pFile,flags){
818
+ mTimeStart('xSync');
819
+ ++metrics.xSync.count;
820
+ const rc = opRun('xSync', pFile, flags);
821
+ mTimeEnd();
822
+ return rc;
823
+ },
824
+ xTruncate: function(pFile,sz64){
825
+ mTimeStart('xTruncate');
826
+ const rc = opRun('xTruncate', pFile, Number(sz64));
827
+ mTimeEnd();
828
+ return rc;
829
+ },
830
+ xUnlock: function(pFile,lockType){
831
+ mTimeStart('xUnlock');
832
+ const f = __openFiles[pFile];
833
+ let rc = 0;
834
+ if( capi.SQLITE_LOCK_NONE === lockType
835
+ && f.lockType ){
836
+ rc = opRun('xUnlock', pFile, lockType);
837
+ }
838
+ if( 0===rc ) f.lockType = lockType;
839
+ mTimeEnd();
840
+ return rc;
841
+ },
842
+ xWrite: function(pFile,pSrc,n,offset64){
843
+ mTimeStart('xWrite');
844
+ const f = __openFiles[pFile];
845
+ let rc;
846
+ try {
847
+ f.sabView.set(wasm.heap8u().subarray(pSrc, pSrc+n));
848
+ rc = opRun('xWrite', pFile, n, Number(offset64));
849
+ }catch(e){
850
+ error("xWrite(",arguments,") failed:",e,f);
851
+ rc = capi.SQLITE_IOERR_WRITE;
852
+ }
853
+ mTimeEnd();
854
+ return rc;
855
+ }
856
+ }/*ioSyncWrappers*/;
857
+
858
+ /**
859
+ Impls for the sqlite3_vfs methods. Maintenance reminder: members
860
+ are in alphabetical order to simplify finding them.
861
+ */
862
+ const vfsSyncWrappers = {
863
+ xAccess: function(pVfs,zName,flags,pOut){
864
+ mTimeStart('xAccess');
865
+ const rc = opRun('xAccess', wasm.cstrToJs(zName));
866
+ wasm.poke( pOut, (rc ? 0 : 1), 'i32' );
867
+ mTimeEnd();
868
+ return 0;
869
+ },
870
+ xCurrentTime: function(pVfs,pOut){
871
+ /* If it turns out that we need to adjust for timezone, see:
872
+ https://stackoverflow.com/a/11760121/1458521 */
873
+ wasm.poke(pOut, 2440587.5 + (new Date().getTime()/86400000),
874
+ 'double');
875
+ return 0;
876
+ },
877
+ xCurrentTimeInt64: function(pVfs,pOut){
878
+ wasm.poke(pOut, (2440587.5 * 86400000) + new Date().getTime(),
879
+ 'i64');
880
+ return 0;
881
+ },
882
+ xDelete: function(pVfs, zName, doSyncDir){
883
+ mTimeStart('xDelete');
884
+ const rc = opRun('xDelete', wasm.cstrToJs(zName), doSyncDir, false);
885
+ mTimeEnd();
886
+ return rc;
887
+ },
888
+ xFullPathname: function(pVfs,zName,nOut,pOut){
889
+ /* Until/unless we have some notion of "current dir"
890
+ in OPFS, simply copy zName to pOut... */
891
+ const i = wasm.cstrncpy(pOut, zName, nOut);
892
+ return i<nOut ? 0 : capi.SQLITE_CANTOPEN
893
+ /*CANTOPEN is required by the docs but SQLITE_RANGE would be a closer match*/;
894
+ },
895
+ xGetLastError: function(pVfs,nOut,pOut){
896
+ /* TODO: store exception.message values from the async
897
+ partner in a dedicated SharedArrayBuffer, noting that we'd have
898
+ to encode them... TextEncoder can do that for us. */
899
+ warn("OPFS xGetLastError() has nothing sensible to return.");
900
+ return 0;
901
+ },
902
+ //xSleep is optionally defined below
903
+ xOpen: function f(pVfs, zName, pFile, flags, pOutFlags){
904
+ mTimeStart('xOpen');
905
+ let opfsFlags = 0;
906
+ if(0===zName){
907
+ zName = randomFilename();
908
+ }else if(wasm.isPtr(zName)){
909
+ if(capi.sqlite3_uri_boolean(zName, "opfs-unlock-asap", 0)){
910
+ /* -----------------------^^^^^ MUST pass the untranslated
911
+ C-string here. */
912
+ opfsFlags |= state.opfsFlags.OPFS_UNLOCK_ASAP;
913
+ }
914
+ if(capi.sqlite3_uri_boolean(zName, "delete-before-open", 0)){
915
+ opfsFlags |= state.opfsFlags.OPFS_UNLINK_BEFORE_OPEN;
916
+ }
917
+ zName = wasm.cstrToJs(zName);
918
+ //warn("xOpen zName =",zName, "opfsFlags =",opfsFlags);
919
+ }
920
+ const fh = Object.create(null);
921
+ fh.fid = pFile;
922
+ fh.filename = zName;
923
+ fh.sab = new SharedArrayBuffer(state.fileBufferSize);
924
+ fh.flags = flags;
925
+ fh.readOnly = !(sqlite3.SQLITE_OPEN_CREATE & flags)
926
+ && !!(flags & capi.SQLITE_OPEN_READONLY);
927
+ const rc = opRun('xOpen', pFile, zName, flags, opfsFlags);
928
+ if(!rc){
929
+ /* Recall that sqlite3_vfs::xClose() will be called, even on
930
+ error, unless pFile->pMethods is NULL. */
931
+ if(fh.readOnly){
932
+ wasm.poke(pOutFlags, capi.SQLITE_OPEN_READONLY, 'i32');
933
+ }
934
+ __openFiles[pFile] = fh;
935
+ fh.sabView = state.sabFileBufView;
936
+ fh.sq3File = new sqlite3_file(pFile);
937
+ fh.sq3File.$pMethods = opfsIoMethods.pointer;
938
+ fh.lockType = capi.SQLITE_LOCK_NONE;
939
+ }
940
+ mTimeEnd();
941
+ return rc;
942
+ }/*xOpen()*/
943
+ }/*vfsSyncWrappers*/;
944
+
945
+ if(dVfs){
946
+ opfsVfs.$xRandomness = dVfs.$xRandomness;
947
+ opfsVfs.$xSleep = dVfs.$xSleep;
948
+ }
949
+ if(!opfsVfs.$xRandomness){
950
+ /* If the default VFS has no xRandomness(), add a basic JS impl... */
951
+ vfsSyncWrappers.xRandomness = function(pVfs, nOut, pOut){
952
+ const heap = wasm.heap8u();
953
+ let i = 0;
954
+ for(; i < nOut; ++i) heap[pOut + i] = (Math.random()*255000) & 0xFF;
955
+ return i;
956
+ };
957
+ }
958
+ if(!opfsVfs.$xSleep){
959
+ /* If we can inherit an xSleep() impl from the default VFS then
960
+ assume it's sane and use it, otherwise install a JS-based
961
+ one. */
962
+ vfsSyncWrappers.xSleep = function(pVfs,ms){
963
+ Atomics.wait(state.sabOPView, state.opIds.xSleep, 0, ms);
964
+ return 0;
965
+ };
966
+ }
967
+
968
+ /**
969
+ Expects an OPFS file path. It gets resolved, such that ".."
970
+ components are properly expanded, and returned. If the 2nd arg
971
+ is true, the result is returned as an array of path elements,
972
+ else an absolute path string is returned.
973
+ */
974
+ opfsUtil.getResolvedPath = function(filename,splitIt){
975
+ const p = new URL(filename, "file://irrelevant").pathname;
976
+ return splitIt ? p.split('/').filter((v)=>!!v) : p;
977
+ };
978
+
979
+ /**
980
+ Takes the absolute path to a filesystem element. Returns an
981
+ array of [handleOfContainingDir, filename]. If the 2nd argument
982
+ is truthy then each directory element leading to the file is
983
+ created along the way. Throws if any creation or resolution
984
+ fails.
985
+ */
986
+ opfsUtil.getDirForFilename = async function f(absFilename, createDirs = false){
987
+ const path = opfsUtil.getResolvedPath(absFilename, true);
988
+ const filename = path.pop();
989
+ let dh = opfsUtil.rootDirectory;
990
+ for(const dirName of path){
991
+ if(dirName){
992
+ dh = await dh.getDirectoryHandle(dirName, {create: !!createDirs});
993
+ }
994
+ }
995
+ return [dh, filename];
996
+ };
997
+
998
+ /**
999
+ Creates the given directory name, recursively, in
1000
+ the OPFS filesystem. Returns true if it succeeds or the
1001
+ directory already exists, else false.
1002
+ */
1003
+ opfsUtil.mkdir = async function(absDirName){
1004
+ try {
1005
+ await opfsUtil.getDirForFilename(absDirName+"/filepart", true);
1006
+ return true;
1007
+ }catch(e){
1008
+ //sqlite3.config.warn("mkdir(",absDirName,") failed:",e);
1009
+ return false;
1010
+ }
1011
+ };
1012
+ /**
1013
+ Checks whether the given OPFS filesystem entry exists,
1014
+ returning true if it does, false if it doesn't or if an
1015
+ exception is intercepted while trying to make the
1016
+ determination.
1017
+ */
1018
+ opfsUtil.entryExists = async function(fsEntryName){
1019
+ try {
1020
+ const [dh, fn] = await opfsUtil.getDirForFilename(fsEntryName);
1021
+ await dh.getFileHandle(fn);
1022
+ return true;
1023
+ }catch(e){
1024
+ return false;
1025
+ }
1026
+ };
1027
+
1028
+ /**
1029
+ Generates a random ASCII string, intended for use as a
1030
+ temporary file name. Its argument is the length of the string,
1031
+ defaulting to 16.
1032
+ */
1033
+ opfsUtil.randomFilename = randomFilename;
1034
+
1035
+ /**
1036
+ Returns a promise which resolves to an object which represents
1037
+ all files and directories in the OPFS tree. The top-most object
1038
+ has two properties: `dirs` is an array of directory entries
1039
+ (described below) and `files` is a list of file names for all
1040
+ files in that directory.
1041
+
1042
+ Traversal starts at sqlite3.opfs.rootDirectory.
1043
+
1044
+ Each `dirs` entry is an object in this form:
1045
+
1046
+ ```
1047
+ { name: directoryName,
1048
+ dirs: [...subdirs],
1049
+ files: [...file names]
1050
+ }
1051
+ ```
1052
+
1053
+ The `files` and `subdirs` entries are always set but may be
1054
+ empty arrays.
1055
+
1056
+ The returned object has the same structure but its `name` is
1057
+ an empty string. All returned objects are created with
1058
+ Object.create(null), so have no prototype.
1059
+
1060
+ Design note: the entries do not contain more information,
1061
+ e.g. file sizes, because getting such info is not only
1062
+ expensive but is subject to locking-related errors.
1063
+ */
1064
+ opfsUtil.treeList = async function(){
1065
+ const doDir = async function callee(dirHandle,tgt){
1066
+ tgt.name = dirHandle.name;
1067
+ tgt.dirs = [];
1068
+ tgt.files = [];
1069
+ for await (const handle of dirHandle.values()){
1070
+ if('directory' === handle.kind){
1071
+ const subDir = Object.create(null);
1072
+ tgt.dirs.push(subDir);
1073
+ await callee(handle, subDir);
1074
+ }else{
1075
+ tgt.files.push(handle.name);
1076
+ }
1077
+ }
1078
+ };
1079
+ const root = Object.create(null);
1080
+ await doDir(opfsUtil.rootDirectory, root);
1081
+ return root;
1082
+ };
1083
+
1084
+ /**
1085
+ Irrevocably deletes _all_ files in the current origin's OPFS.
1086
+ Obviously, this must be used with great caution. It may throw
1087
+ an exception if removal of anything fails (e.g. a file is
1088
+ locked), but the precise conditions under which the underlying
1089
+ APIs will throw are not documented (so we cannot tell you what
1090
+ they are).
1091
+ */
1092
+ opfsUtil.rmfr = async function(){
1093
+ const dir = opfsUtil.rootDirectory, opt = {recurse: true};
1094
+ for await (const handle of dir.values()){
1095
+ dir.removeEntry(handle.name, opt);
1096
+ }
1097
+ };
1098
+
1099
+ /**
1100
+ Deletes the given OPFS filesystem entry. As this environment
1101
+ has no notion of "current directory", the given name must be an
1102
+ absolute path. If the 2nd argument is truthy, deletion is
1103
+ recursive (use with caution!).
1104
+
1105
+ The returned Promise resolves to true if the deletion was
1106
+ successful, else false (but...). The OPFS API reports the
1107
+ reason for the failure only in human-readable form, not
1108
+ exceptions which can be type-checked to determine the
1109
+ failure. Because of that...
1110
+
1111
+ If the final argument is truthy then this function will
1112
+ propagate any exception on error, rather than returning false.
1113
+ */
1114
+ opfsUtil.unlink = async function(fsEntryName, recursive = false,
1115
+ throwOnError = false){
1116
+ try {
1117
+ const [hDir, filenamePart] =
1118
+ await opfsUtil.getDirForFilename(fsEntryName, false);
1119
+ await hDir.removeEntry(filenamePart, {recursive});
1120
+ return true;
1121
+ }catch(e){
1122
+ if(throwOnError){
1123
+ throw new Error("unlink(",arguments[0],") failed: "+e.message,{
1124
+ cause: e
1125
+ });
1126
+ }
1127
+ return false;
1128
+ }
1129
+ };
1130
+
1131
+ /**
1132
+ Traverses the OPFS filesystem, calling a callback for each
1133
+ entry. The argument may be either a callback function or an
1134
+ options object with any of the following properties:
1135
+
1136
+ - `callback`: function which gets called for each filesystem
1137
+ entry. It gets passed 3 arguments: 1) the
1138
+ FileSystemFileHandle or FileSystemDirectoryHandle of each
1139
+ entry (noting that both are instanceof FileSystemHandle). 2)
1140
+ the FileSystemDirectoryHandle of the parent directory. 3) the
1141
+ current depth level, with 0 being at the top of the tree
1142
+ relative to the starting directory. If the callback returns a
1143
+ literal false, as opposed to any other falsy value, traversal
1144
+ stops without an error. Any exceptions it throws are
1145
+ propagated. Results are undefined if the callback manipulate
1146
+ the filesystem (e.g. removing or adding entries) because the
1147
+ how OPFS iterators behave in the face of such changes is
1148
+ undocumented.
1149
+
1150
+ - `recursive` [bool=true]: specifies whether to recurse into
1151
+ subdirectories or not. Whether recursion is depth-first or
1152
+ breadth-first is unspecified!
1153
+
1154
+ - `directory` [FileSystemDirectoryEntry=sqlite3.opfs.rootDirectory]
1155
+ specifies the starting directory.
1156
+
1157
+ If this function is passed a function, it is assumed to be the
1158
+ callback.
1159
+
1160
+ Returns a promise because it has to (by virtue of being async)
1161
+ but that promise has no specific meaning: the traversal it
1162
+ performs is synchronous. The promise must be used to catch any
1163
+ exceptions propagated by the callback, however.
1164
+ */
1165
+ opfsUtil.traverse = async function(opt){
1166
+ const defaultOpt = {
1167
+ recursive: true,
1168
+ directory: opfsUtil.rootDirectory
1169
+ };
1170
+ if('function'===typeof opt){
1171
+ opt = {callback:opt};
1172
+ }
1173
+ opt = Object.assign(defaultOpt, opt||{});
1174
+ const doDir = async function callee(dirHandle, depth){
1175
+ for await (const handle of dirHandle.values()){
1176
+ if(false === opt.callback(handle, dirHandle, depth)) return false;
1177
+ else if(opt.recursive && 'directory' === handle.kind){
1178
+ if(false === await callee(handle, depth + 1)) break;
1179
+ }
1180
+ }
1181
+ };
1182
+ doDir(opt.directory, 0);
1183
+ };
1184
+
1185
+ /**
1186
+ impl of importDb() when it's given a function as its second
1187
+ argument.
1188
+ */
1189
+ const importDbChunked = async function(filename, callback){
1190
+ const [hDir, fnamePart] = await opfsUtil.getDirForFilename(filename, true);
1191
+ const hFile = await hDir.getFileHandle(fnamePart, {create:true});
1192
+ let sah = await hFile.createSyncAccessHandle();
1193
+ let nWrote = 0, chunk, checkedHeader = false, err = false;
1194
+ try{
1195
+ sah.truncate(0);
1196
+ while( undefined !== (chunk = await callback()) ){
1197
+ if(chunk instanceof ArrayBuffer) chunk = new Uint8Array(chunk);
1198
+ if( 0===nWrote && chunk.byteLength>=15 ){
1199
+ util.affirmDbHeader(chunk);
1200
+ checkedHeader = true;
1201
+ }
1202
+ sah.write(chunk, {at: nWrote});
1203
+ nWrote += chunk.byteLength;
1204
+ }
1205
+ if( nWrote < 512 || 0!==nWrote % 512 ){
1206
+ toss("Input size",nWrote,"is not correct for an SQLite database.");
1207
+ }
1208
+ if( !checkedHeader ){
1209
+ const header = new Uint8Array(20);
1210
+ sah.read( header, {at: 0} );
1211
+ util.affirmDbHeader( header );
1212
+ }
1213
+ sah.write(new Uint8Array([1,1]), {at: 18}/*force db out of WAL mode*/);
1214
+ return nWrote;
1215
+ }catch(e){
1216
+ await sah.close();
1217
+ sah = undefined;
1218
+ await hDir.removeEntry( fnamePart ).catch(()=>{});
1219
+ throw e;
1220
+ }finally {
1221
+ if( sah ) await sah.close();
1222
+ }
1223
+ };
1224
+
1225
+ /**
1226
+ Asynchronously imports the given bytes (a byte array or
1227
+ ArrayBuffer) into the given database file.
1228
+
1229
+ Results are undefined if the given db name refers to an opened
1230
+ db.
1231
+
1232
+ If passed a function for its second argument, its behaviour
1233
+ changes: imports its data in chunks fed to it by the given
1234
+ callback function. It calls the callback (which may be async)
1235
+ repeatedly, expecting either a Uint8Array or ArrayBuffer (to
1236
+ denote new input) or undefined (to denote EOF). For so long as
1237
+ the callback continues to return non-undefined, it will append
1238
+ incoming data to the given VFS-hosted database file. When
1239
+ called this way, the resolved value of the returned Promise is
1240
+ the number of bytes written to the target file.
1241
+
1242
+ It very specifically requires the input to be an SQLite3
1243
+ database and throws if that's not the case. It does so in
1244
+ order to prevent this function from taking on a larger scope
1245
+ than it is specifically intended to. i.e. we do not want it to
1246
+ become a convenience for importing arbitrary files into OPFS.
1247
+
1248
+ This routine rewrites the database header bytes in the output
1249
+ file (not the input array) to force disabling of WAL mode.
1250
+
1251
+ On error this throws and the state of the input file is
1252
+ undefined (it depends on where the exception was triggered).
1253
+
1254
+ On success, resolves to the number of bytes written.
1255
+ */
1256
+ opfsUtil.importDb = async function(filename, bytes){
1257
+ if( bytes instanceof Function ){
1258
+ return importDbChunked(filename, bytes);
1259
+ }
1260
+ if(bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes);
1261
+ util.affirmIsDb(bytes);
1262
+ const n = bytes.byteLength;
1263
+ const [hDir, fnamePart] = await opfsUtil.getDirForFilename(filename, true);
1264
+ let sah, err, nWrote = 0;
1265
+ try {
1266
+ const hFile = await hDir.getFileHandle(fnamePart, {create:true});
1267
+ sah = await hFile.createSyncAccessHandle();
1268
+ sah.truncate(0);
1269
+ nWrote = sah.write(bytes, {at: 0});
1270
+ if(nWrote != n){
1271
+ toss("Expected to write "+n+" bytes but wrote "+nWrote+".");
1272
+ }
1273
+ sah.write(new Uint8Array([1,1]), {at: 18}) /* force db out of WAL mode */;
1274
+ return nWrote;
1275
+ }catch(e){
1276
+ if( sah ){ await sah.close(); sah = undefined; }
1277
+ await hDir.removeEntry( fnamePart ).catch(()=>{});
1278
+ throw e;
1279
+ }finally{
1280
+ if( sah ) await sah.close();
1281
+ }
1282
+ };
1283
+
1284
+ if(sqlite3.oo1){
1285
+ const OpfsDb = function(...args){
1286
+ const opt = sqlite3.oo1.DB.dbCtorHelper.normalizeArgs(...args);
1287
+ opt.vfs = opfsVfs.$zName;
1288
+ sqlite3.oo1.DB.dbCtorHelper.call(this, opt);
1289
+ };
1290
+ OpfsDb.prototype = Object.create(sqlite3.oo1.DB.prototype);
1291
+ sqlite3.oo1.OpfsDb = OpfsDb;
1292
+ OpfsDb.importDb = opfsUtil.importDb;
1293
+ sqlite3.oo1.DB.dbCtorHelper.setVfsPostOpenCallback(
1294
+ opfsVfs.pointer,
1295
+ function(oo1Db, sqlite3){
1296
+ /* Set a relatively high default busy-timeout handler to
1297
+ help OPFS dbs deal with multi-tab/multi-worker
1298
+ contention. */
1299
+ sqlite3.capi.sqlite3_busy_timeout(oo1Db, 10000);
1300
+ }
1301
+ );
1302
+ }/*extend sqlite3.oo1*/
1303
+
1304
+ const sanityCheck = function(){
1305
+ const scope = wasm.scopedAllocPush();
1306
+ const sq3File = new sqlite3_file();
1307
+ try{
1308
+ const fid = sq3File.pointer;
1309
+ const openFlags = capi.SQLITE_OPEN_CREATE
1310
+ | capi.SQLITE_OPEN_READWRITE
1311
+ //| capi.SQLITE_OPEN_DELETEONCLOSE
1312
+ | capi.SQLITE_OPEN_MAIN_DB;
1313
+ const pOut = wasm.scopedAlloc(8);
1314
+ const dbFile = "/sanity/check/file"+randomFilename(8);
1315
+ const zDbFile = wasm.scopedAllocCString(dbFile);
1316
+ let rc;
1317
+ state.s11n.serialize("This is ä string.");
1318
+ rc = state.s11n.deserialize();
1319
+ log("deserialize() says:",rc);
1320
+ if("This is ä string."!==rc[0]) toss("String d13n error.");
1321
+ vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut);
1322
+ rc = wasm.peek(pOut,'i32');
1323
+ log("xAccess(",dbFile,") exists ?=",rc);
1324
+ rc = vfsSyncWrappers.xOpen(opfsVfs.pointer, zDbFile,
1325
+ fid, openFlags, pOut);
1326
+ log("open rc =",rc,"state.sabOPView[xOpen] =",
1327
+ state.sabOPView[state.opIds.xOpen]);
1328
+ if(0!==rc){
1329
+ error("open failed with code",rc);
1330
+ return;
1331
+ }
1332
+ vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut);
1333
+ rc = wasm.peek(pOut,'i32');
1334
+ if(!rc) toss("xAccess() failed to detect file.");
1335
+ rc = ioSyncWrappers.xSync(sq3File.pointer, 0);
1336
+ if(rc) toss('sync failed w/ rc',rc);
1337
+ rc = ioSyncWrappers.xTruncate(sq3File.pointer, 1024);
1338
+ if(rc) toss('truncate failed w/ rc',rc);
1339
+ wasm.poke(pOut,0,'i64');
1340
+ rc = ioSyncWrappers.xFileSize(sq3File.pointer, pOut);
1341
+ if(rc) toss('xFileSize failed w/ rc',rc);
1342
+ log("xFileSize says:",wasm.peek(pOut, 'i64'));
1343
+ rc = ioSyncWrappers.xWrite(sq3File.pointer, zDbFile, 10, 1);
1344
+ if(rc) toss("xWrite() failed!");
1345
+ const readBuf = wasm.scopedAlloc(16);
1346
+ rc = ioSyncWrappers.xRead(sq3File.pointer, readBuf, 6, 2);
1347
+ wasm.poke(readBuf+6,0);
1348
+ let jRead = wasm.cstrToJs(readBuf);
1349
+ log("xRead() got:",jRead);
1350
+ if("sanity"!==jRead) toss("Unexpected xRead() value.");
1351
+ if(vfsSyncWrappers.xSleep){
1352
+ log("xSleep()ing before close()ing...");
1353
+ vfsSyncWrappers.xSleep(opfsVfs.pointer,2000);
1354
+ log("waking up from xSleep()");
1355
+ }
1356
+ rc = ioSyncWrappers.xClose(fid);
1357
+ log("xClose rc =",rc,"sabOPView =",state.sabOPView);
1358
+ log("Deleting file:",dbFile);
1359
+ vfsSyncWrappers.xDelete(opfsVfs.pointer, zDbFile, 0x1234);
1360
+ vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut);
1361
+ rc = wasm.peek(pOut,'i32');
1362
+ if(rc) toss("Expecting 0 from xAccess(",dbFile,") after xDelete().");
1363
+ warn("End of OPFS sanity checks.");
1364
+ }finally{
1365
+ sq3File.dispose();
1366
+ wasm.scopedAllocPop(scope);
1367
+ }
1368
+ }/*sanityCheck()*/;
1369
+
1370
+ W.onmessage = function({data}){
1371
+ //log("Worker.onmessage:",data);
1372
+ switch(data.type){
1373
+ case 'opfs-unavailable':
1374
+ /* Async proxy has determined that OPFS is unavailable. There's
1375
+ nothing more for us to do here. */
1376
+ promiseReject(new Error(data.payload.join(' ')));
1377
+ break;
1378
+ case 'opfs-async-loaded':
1379
+ /* Arrives as soon as the asyc proxy finishes loading.
1380
+ Pass our config and shared state on to the async
1381
+ worker. */
1382
+ W.postMessage({type: 'opfs-async-init',args: state});
1383
+ break;
1384
+ case 'opfs-async-inited': {
1385
+ /* Indicates that the async partner has received the 'init'
1386
+ and has finished initializing, so the real work can
1387
+ begin... */
1388
+ if(true===promiseWasRejected){
1389
+ break /* promise was already rejected via timer */;
1390
+ }
1391
+ try {
1392
+ sqlite3.vfs.installVfs({
1393
+ io: {struct: opfsIoMethods, methods: ioSyncWrappers},
1394
+ vfs: {struct: opfsVfs, methods: vfsSyncWrappers}
1395
+ });
1396
+ state.sabOPView = new Int32Array(state.sabOP);
1397
+ state.sabFileBufView = new Uint8Array(state.sabIO, 0, state.fileBufferSize);
1398
+ state.sabS11nView = new Uint8Array(state.sabIO, state.sabS11nOffset, state.sabS11nSize);
1399
+ initS11n();
1400
+ if(options.sanityChecks){
1401
+ warn("Running sanity checks because of opfs-sanity-check URL arg...");
1402
+ sanityCheck();
1403
+ }
1404
+ if(thisThreadHasOPFS()){
1405
+ navigator.storage.getDirectory().then((d)=>{
1406
+ W.onerror = W._originalOnError;
1407
+ delete W._originalOnError;
1408
+ sqlite3.opfs = opfsUtil;
1409
+ opfsUtil.rootDirectory = d;
1410
+ log("End of OPFS sqlite3_vfs setup.", opfsVfs);
1411
+ promiseResolve();
1412
+ }).catch(promiseReject);
1413
+ }else{
1414
+ promiseResolve();
1415
+ }
1416
+ }catch(e){
1417
+ error(e);
1418
+ promiseReject(e);
1419
+ }
1420
+ break;
1421
+ }
1422
+ default: {
1423
+ const errMsg = (
1424
+ "Unexpected message from the OPFS async worker: " +
1425
+ JSON.stringify(data)
1426
+ );
1427
+ error(errMsg);
1428
+ promiseReject(new Error(errMsg));
1429
+ break;
1430
+ }
1431
+ }/*switch(data.type)*/
1432
+ }/*W.onmessage()*/;
1433
+ })/*thePromise*/;
1434
+ return thePromise;
1435
+ }/*installOpfsVfs()*/;
1436
+ installOpfsVfs.defaultProxyUri =
1437
+ "sqlite3-opfs-async-proxy.js";
1438
+ globalThis.sqlite3ApiBootstrap.initializersAsync.push(async (sqlite3)=>{
1439
+ try{
1440
+ let proxyJs = installOpfsVfs.defaultProxyUri;
1441
+ if(sqlite3.scriptInfo.sqlite3Dir){
1442
+ installOpfsVfs.defaultProxyUri =
1443
+ sqlite3.scriptInfo.sqlite3Dir + proxyJs;
1444
+ //sqlite3.config.warn("installOpfsVfs.defaultProxyUri =",installOpfsVfs.defaultProxyUri);
1445
+ }
1446
+ return installOpfsVfs().catch((e)=>{
1447
+ sqlite3.config.warn("Ignoring inability to install OPFS sqlite3_vfs:",e.message);
1448
+ });
1449
+ }catch(e){
1450
+ sqlite3.config.error("installOpfsVfs() exception:",e);
1451
+ return Promise.reject(e);
1452
+ }
1453
+ });
1454
+ }/*sqlite3ApiBootstrap.initializers.push()*/);
1455
+ //#else
1456
+ /* The OPFS VFS parts are elided from builds targeting node.js. */
1457
+ //#endif target=node
local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //#ifnot omit-oo1
2
+ /*
3
+ 2022-08-24
4
+
5
+ The author disclaims copyright to this source code. In place of a
6
+ legal notice, here is a blessing:
7
+
8
+ * May you do good and not evil.
9
+ * May you find forgiveness for yourself and forgive others.
10
+ * May you share freely, never taking more than you give.
11
+
12
+ ***********************************************************************
13
+
14
+ This file implements a Promise-based proxy for the sqlite3 Worker
15
+ API #1. It is intended to be included either from the main thread or
16
+ a Worker, but only if (A) the environment supports nested Workers
17
+ and (B) it's _not_ a Worker which loads the sqlite3 WASM/JS
18
+ module. This file's features will load that module and provide a
19
+ slightly simpler client-side interface than the slightly-lower-level
20
+ Worker API does.
21
+
22
+ This script necessarily exposes one global symbol, but clients may
23
+ freely `delete` that symbol after calling it.
24
+ */
25
+ 'use strict';
26
+ /**
27
+ Configures an sqlite3 Worker API #1 Worker such that it can be
28
+ manipulated via a Promise-based interface and returns a factory
29
+ function which returns Promises for communicating with the worker.
30
+ This proxy has an _almost_ identical interface to the normal
31
+ worker API, with any exceptions documented below.
32
+
33
+ It requires a configuration object with the following properties:
34
+
35
+ - `worker` (required): a Worker instance which loads
36
+ `sqlite3-worker1.js` or a functional equivalent. Note that the
37
+ promiser factory replaces the worker.onmessage property. This
38
+ config option may alternately be a function, in which case this
39
+ function re-assigns this property with the result of calling that
40
+ function, enabling delayed instantiation of a Worker.
41
+
42
+ - `onready` (optional, but...): this callback is called with no
43
+ arguments when the worker fires its initial
44
+ 'sqlite3-api'/'worker1-ready' message, which it does when
45
+ sqlite3.initWorker1API() completes its initialization. This is the
46
+ simplest way to tell the worker to kick off work at the earliest
47
+ opportunity, and the only way to know when the worker module has
48
+ completed loading. The irony of using a callback for this, instead
49
+ of returning a promise from sqlite3Worker1Promiser() is not lost on
50
+ the developers: see sqlite3Worker1Promiser.v2() which uses a
51
+ Promise instead.
52
+
53
+ - `onunhandled` (optional): a callback which gets passed the
54
+ message event object for any worker.onmessage() events which
55
+ are not handled by this proxy. Ideally that "should" never
56
+ happen, as this proxy aims to handle all known message types.
57
+
58
+ - `generateMessageId` (optional): a function which, when passed an
59
+ about-to-be-posted message object, generates a _unique_ message ID
60
+ for the message, which this API then assigns as the messageId
61
+ property of the message. It _must_ generate unique IDs on each call
62
+ so that dispatching can work. If not defined, a default generator
63
+ is used (which should be sufficient for most or all cases).
64
+
65
+ - `debug` (optional): a console.debug()-style function for logging
66
+ information about messages.
67
+
68
+ This function returns a stateful factory function with the
69
+ following interfaces:
70
+
71
+ - Promise function(messageType, messageArgs)
72
+ - Promise function({message object})
73
+
74
+ The first form expects the "type" and "args" values for a Worker
75
+ message. The second expects an object in the form {type:...,
76
+ args:...} plus any other properties the client cares to set. This
77
+ function will always set the `messageId` property on the object,
78
+ even if it's already set, and will set the `dbId` property to the
79
+ current database ID if it is _not_ set in the message object.
80
+
81
+ The function throws on error.
82
+
83
+ The function installs a temporary message listener, posts a
84
+ message to the configured Worker, and handles the message's
85
+ response via the temporary message listener. The then() callback
86
+ of the returned Promise is passed the `message.data` property from
87
+ the resulting message, i.e. the payload from the worker, stripped
88
+ of the lower-level event state which the onmessage() handler
89
+ receives.
90
+
91
+ Example usage:
92
+
93
+ ```
94
+ const config = {...};
95
+ const sq3Promiser = sqlite3Worker1Promiser(config);
96
+ sq3Promiser('open', {filename:"/foo.db"}).then(function(msg){
97
+ console.log("open response",msg); // => {type:'open', result: {filename:'/foo.db'}, ...}
98
+ });
99
+ sq3Promiser({type:'close'}).then((msg)=>{
100
+ console.log("close response",msg); // => {type:'close', result: {filename:'/foo.db'}, ...}
101
+ });
102
+ ```
103
+
104
+ Differences from Worker API #1:
105
+
106
+ - exec's {callback: STRING} option does not work via this
107
+ interface (it triggers an exception), but {callback: function}
108
+ does and works exactly like the STRING form does in the Worker:
109
+ the callback is called one time for each row of the result set,
110
+ passed the same worker message format as the worker API emits:
111
+
112
+ {type:typeString,
113
+ row:VALUE,
114
+ rowNumber:1-based-#,
115
+ columnNames: array}
116
+
117
+ Where `typeString` is an internally-synthesized message type string
118
+ used temporarily for worker message dispatching. It can be ignored
119
+ by all client code except that which tests this API. The `row`
120
+ property contains the row result in the form implied by the
121
+ `rowMode` option (defaulting to `'array'`). The `rowNumber` is a
122
+ 1-based integer value incremented by 1 on each call into the
123
+ callback.
124
+
125
+ At the end of the result set, the same event is fired with
126
+ (row=undefined, rowNumber=null) to indicate that
127
+ the end of the result set has been reached. Note that the rows
128
+ arrive via worker-posted messages, with all the implications
129
+ of that.
130
+
131
+ Notable shortcomings:
132
+
133
+ - This API was not designed with ES6 modules in mind. Neither Firefox
134
+ nor Safari support, as of March 2023, the {type:"module"} flag to the
135
+ Worker constructor, so that particular usage is not something we're going
136
+ to target for the time being:
137
+
138
+ https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker
139
+ */
140
+ globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig){
141
+ // Inspired by: https://stackoverflow.com/a/52439530
142
+ if(1===arguments.length && 'function'===typeof arguments[0]){
143
+ const f = config;
144
+ config = Object.assign(Object.create(null), callee.defaultConfig);
145
+ config.onready = f;
146
+ }else{
147
+ config = Object.assign(Object.create(null), callee.defaultConfig, config);
148
+ }
149
+ const handlerMap = Object.create(null);
150
+ const noop = function(){};
151
+ const err = config.onerror
152
+ || noop /* config.onerror is intentionally undocumented
153
+ pending finding a less ambiguous name */;
154
+ const debug = config.debug || noop;
155
+ const idTypeMap = config.generateMessageId ? undefined : Object.create(null);
156
+ const genMsgId = config.generateMessageId || function(msg){
157
+ return msg.type+'#'+(idTypeMap[msg.type] = (idTypeMap[msg.type]||0) + 1);
158
+ };
159
+ const toss = (...args)=>{throw new Error(args.join(' '))};
160
+ if(!config.worker) config.worker = callee.defaultConfig.worker;
161
+ if('function'===typeof config.worker) config.worker = config.worker();
162
+ let dbId;
163
+ let promiserFunc;
164
+ config.worker.onmessage = function(ev){
165
+ ev = ev.data;
166
+ debug('worker1.onmessage',ev);
167
+ let msgHandler = handlerMap[ev.messageId];
168
+ if(!msgHandler){
169
+ if(ev && 'sqlite3-api'===ev.type && 'worker1-ready'===ev.result) {
170
+ /*fired one time when the Worker1 API initializes*/
171
+ if(config.onready) config.onready(promiserFunc);
172
+ return;
173
+ }
174
+ msgHandler = handlerMap[ev.type] /* check for exec per-row callback */;
175
+ if(msgHandler && msgHandler.onrow){
176
+ msgHandler.onrow(ev);
177
+ return;
178
+ }
179
+ if(config.onunhandled) config.onunhandled(arguments[0]);
180
+ else err("sqlite3Worker1Promiser() unhandled worker message:",ev);
181
+ return;
182
+ }
183
+ delete handlerMap[ev.messageId];
184
+ switch(ev.type){
185
+ case 'error':
186
+ msgHandler.reject(ev);
187
+ return;
188
+ case 'open':
189
+ if(!dbId) dbId = ev.dbId;
190
+ break;
191
+ case 'close':
192
+ if(ev.dbId===dbId) dbId = undefined;
193
+ break;
194
+ default:
195
+ break;
196
+ }
197
+ try {msgHandler.resolve(ev)}
198
+ catch(e){msgHandler.reject(e)}
199
+ }/*worker.onmessage()*/;
200
+ return promiserFunc = function(/*(msgType, msgArgs) || (msgEnvelope)*/){
201
+ let msg;
202
+ if(1===arguments.length){
203
+ msg = arguments[0];
204
+ }else if(2===arguments.length){
205
+ msg = Object.create(null);
206
+ msg.type = arguments[0];
207
+ msg.args = arguments[1];
208
+ msg.dbId = msg.args.dbId;
209
+ }else{
210
+ toss("Invalid arguments for sqlite3Worker1Promiser()-created factory.");
211
+ }
212
+ if(!msg.dbId && msg.type!=='open') msg.dbId = dbId;
213
+ msg.messageId = genMsgId(msg);
214
+ msg.departureTime = performance.now();
215
+ const proxy = Object.create(null);
216
+ proxy.message = msg;
217
+ let rowCallbackId /* message handler ID for exec on-row callback proxy */;
218
+ if('exec'===msg.type && msg.args){
219
+ if('function'===typeof msg.args.callback){
220
+ rowCallbackId = msg.messageId+':row';
221
+ proxy.onrow = msg.args.callback;
222
+ msg.args.callback = rowCallbackId;
223
+ handlerMap[rowCallbackId] = proxy;
224
+ }else if('string' === typeof msg.args.callback){
225
+ toss("exec callback may not be a string when using the Promise interface.");
226
+ /**
227
+ Design note: the reason for this limitation is that this
228
+ API takes over worker.onmessage() and the client has no way
229
+ of adding their own message-type handlers to it. Per-row
230
+ callbacks are implemented as short-lived message.type
231
+ mappings for worker.onmessage().
232
+
233
+ We "could" work around this by providing a new
234
+ config.fallbackMessageHandler (or some such) which contains
235
+ a map of event type names to callbacks. Seems like overkill
236
+ for now, seeing as the client can pass callback functions
237
+ to this interface (whereas the string-form "callback" is
238
+ needed for the over-the-Worker interface).
239
+ */
240
+ }
241
+ }
242
+ //debug("requestWork", msg);
243
+ let p = new Promise(function(resolve, reject){
244
+ proxy.resolve = resolve;
245
+ proxy.reject = reject;
246
+ handlerMap[msg.messageId] = proxy;
247
+ debug("Posting",msg.type,"message to Worker dbId="+(dbId||'default')+':',msg);
248
+ config.worker.postMessage(msg);
249
+ });
250
+ if(rowCallbackId) p = p.finally(()=>delete handlerMap[rowCallbackId]);
251
+ return p;
252
+ };
253
+ }/*sqlite3Worker1Promiser()*/;
254
+
255
+ globalThis.sqlite3Worker1Promiser.defaultConfig = {
256
+ worker: function(){
257
+ //#if target=es6-module
258
+ return new Worker(new URL("sqlite3-worker1-bundler-friendly.mjs", import.meta.url),{
259
+ type: 'module'
260
+ });
261
+ //#else
262
+ let theJs = "sqlite3-worker1.js";
263
+ if(this.currentScript){
264
+ const src = this.currentScript.src.split('/');
265
+ src.pop();
266
+ theJs = src.join('/')+'/' + theJs;
267
+ //sqlite3.config.warn("promiser currentScript, theJs =",this.currentScript,theJs);
268
+ }else if(globalThis.location){
269
+ //sqlite3.config.warn("promiser globalThis.location =",globalThis.location);
270
+ const urlParams = new URL(globalThis.location.href).searchParams;
271
+ if(urlParams.has('sqlite3.dir')){
272
+ theJs = urlParams.get('sqlite3.dir') + '/' + theJs;
273
+ }
274
+ }
275
+ return new Worker(theJs + globalThis.location.search);
276
+ //#endif
277
+ }
278
+ //#ifnot target=es6-module
279
+ .bind({
280
+ currentScript: globalThis?.document?.currentScript
281
+ })
282
+ //#endif
283
+ ,
284
+ onerror: (...args)=>console.error('worker1 promiser error',...args)
285
+ }/*defaultConfig*/;
286
+
287
+ /**
288
+ sqlite3Worker1Promiser.v2(), added in 3.46, works identically to
289
+ sqlite3Worker1Promiser() except that it returns a Promise instead
290
+ of relying an an onready callback in the config object. The Promise
291
+ resolves to the same factory function which
292
+ sqlite3Worker1Promiser() returns.
293
+
294
+ If config is-a function or is an object which contains an onready
295
+ function, that function is replaced by a proxy which will resolve
296
+ after calling the original function and will reject if that
297
+ function throws.
298
+ */
299
+ sqlite3Worker1Promiser.v2 = function(config){
300
+ let oldFunc;
301
+ if( 'function' == typeof config ){
302
+ oldFunc = config;
303
+ config = {};
304
+ }else if('function'===typeof config?.onready){
305
+ oldFunc = config.onready;
306
+ delete config.onready;
307
+ }
308
+ const promiseProxy = Object.create(null);
309
+ config = Object.assign((config || Object.create(null)),{
310
+ onready: async function(func){
311
+ try {
312
+ if( oldFunc ) await oldFunc(func);
313
+ promiseProxy.resolve(func);
314
+ }
315
+ catch(e){promiseProxy.reject(e)}
316
+ }
317
+ });
318
+ const p = new Promise(function(resolve,reject){
319
+ promiseProxy.resolve = resolve;
320
+ promiseProxy.reject = reject;
321
+ });
322
+ try{
323
+ this.original(config);
324
+ }catch(e){
325
+ promiseProxy.reject(e);
326
+ }
327
+ return p;
328
+ }.bind({
329
+ /* We do this because clients are
330
+ recommended to delete globalThis.sqlite3Worker1Promiser. */
331
+ original: sqlite3Worker1Promiser
332
+ });
333
+
334
+ //#if target=es6-module
335
+ /**
336
+ When built as a module, we export sqlite3Worker1Promiser.v2()
337
+ instead of sqlite3Worker1Promise() because (A) its interface is more
338
+ conventional for ESM usage and (B) the ESM option export option for
339
+ this API did not exist until v2 was created, so there's no backwards
340
+ incompatibility.
341
+ */
342
+ export default sqlite3Worker1Promiser.v2;
343
+ //#endif /* target=es6-module */
344
+ //#else
345
+ /* Built with the omit-oo1 flag. */
346
+ //#endif ifnot omit-oo1
local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/common/SqliteTestUtil.js ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ 2022-05-22
3
+
4
+ The author disclaims copyright to this source code. In place of a
5
+ legal notice, here is a blessing:
6
+
7
+ * May you do good and not evil.
8
+ * May you find forgiveness for yourself and forgive others.
9
+ * May you share freely, never taking more than you give.
10
+
11
+ ***********************************************************************
12
+
13
+ This file contains bootstrapping code used by various test scripts
14
+ which live in this file's directory.
15
+ */
16
+ 'use strict';
17
+ (function(self){
18
+ /* querySelectorAll() proxy */
19
+ const EAll = function(/*[element=document,] cssSelector*/){
20
+ return (arguments.length>1 ? arguments[0] : document)
21
+ .querySelectorAll(arguments[arguments.length-1]);
22
+ };
23
+ /* querySelector() proxy */
24
+ const E = function(/*[element=document,] cssSelector*/){
25
+ return (arguments.length>1 ? arguments[0] : document)
26
+ .querySelector(arguments[arguments.length-1]);
27
+ };
28
+
29
+ /**
30
+ Helpers for writing sqlite3-specific tests.
31
+ */
32
+ self.SqliteTestUtil = {
33
+ /** Running total of the number of tests run via
34
+ this API. */
35
+ counter: 0,
36
+ /**
37
+ If expr is a function, it is called and its result
38
+ is returned, coerced to a bool, else expr, coerced to
39
+ a bool, is returned.
40
+ */
41
+ toBool: function(expr){
42
+ return (expr instanceof Function) ? !!expr() : !!expr;
43
+ },
44
+ /** abort() if expr is false. If expr is a function, it
45
+ is called and its result is evaluated.
46
+ */
47
+ assert: function f(expr, msg){
48
+ if(!f._){
49
+ f._ = ('undefined'===typeof abort
50
+ ? (msg)=>{throw new Error(msg)}
51
+ : abort);
52
+ }
53
+ ++this.counter;
54
+ if(!this.toBool(expr)){
55
+ f._(msg || "Assertion failed.");
56
+ }
57
+ return this;
58
+ },
59
+ /** Identical to assert() but throws instead of calling
60
+ abort(). */
61
+ affirm: function(expr, msg){
62
+ ++this.counter;
63
+ if(!this.toBool(expr)) throw new Error(msg || "Affirmation failed.");
64
+ return this;
65
+ },
66
+ /** Calls f() and squelches any exception it throws. If it
67
+ does not throw, this function throws. */
68
+ mustThrow: function(f, msg){
69
+ ++this.counter;
70
+ let err;
71
+ try{ f(); } catch(e){err=e;}
72
+ if(!err) throw new Error(msg || "Expected exception.");
73
+ return this;
74
+ },
75
+ /**
76
+ Works like mustThrow() but expects filter to be a regex,
77
+ function, or string to match/filter the resulting exception
78
+ against. If f() does not throw, this test fails and an Error is
79
+ thrown. If filter is a regex, the test passes if
80
+ filter.test(error.message) passes. If it's a function, the test
81
+ passes if filter(error) returns truthy. If it's a string, the
82
+ test passes if the filter matches the exception message
83
+ precisely. In all other cases the test fails, throwing an
84
+ Error.
85
+
86
+ If it throws, msg is used as the error report unless it's falsy,
87
+ in which case a default is used.
88
+ */
89
+ mustThrowMatching: function(f, filter, msg){
90
+ ++this.counter;
91
+ let err;
92
+ try{ f(); } catch(e){err=e;}
93
+ if(!err) throw new Error(msg || "Expected exception.");
94
+ let pass = false;
95
+ if(filter instanceof RegExp) pass = filter.test(err.message);
96
+ else if(filter instanceof Function) pass = filter(err);
97
+ else if('string' === typeof filter) pass = (err.message === filter);
98
+ if(!pass){
99
+ throw new Error(msg || ("Filter rejected this exception: "+err.message));
100
+ }
101
+ return this;
102
+ },
103
+ /** Throws if expr is truthy or expr is a function and expr()
104
+ returns truthy. */
105
+ throwIf: function(expr, msg){
106
+ ++this.counter;
107
+ if(this.toBool(expr)) throw new Error(msg || "throwIf() failed");
108
+ return this;
109
+ },
110
+ /** Throws if expr is falsy or expr is a function and expr()
111
+ returns falsy. */
112
+ throwUnless: function(expr, msg){
113
+ ++this.counter;
114
+ if(!this.toBool(expr)) throw new Error(msg || "throwUnless() failed");
115
+ return this;
116
+ },
117
+
118
+ /**
119
+ Parses window.location.search-style string into an object
120
+ containing key/value pairs of URL arguments (already
121
+ urldecoded). The object is created using Object.create(null),
122
+ so contains only parsed-out properties and has no prototype
123
+ (and thus no inherited properties).
124
+
125
+ If the str argument is not passed (arguments.length==0) then
126
+ window.location.search.substring(1) is used by default. If
127
+ neither str is passed in nor window exists then false is returned.
128
+
129
+ On success it returns an Object containing the key/value pairs
130
+ parsed from the string. Keys which have no value are treated
131
+ has having the boolean true value.
132
+
133
+ Pedantic licensing note: this code has appeared in other source
134
+ trees, but was originally written by the same person who pasted
135
+ it into those trees.
136
+ */
137
+ processUrlArgs: function(str) {
138
+ if( 0 === arguments.length ) {
139
+ if( ('undefined' === typeof window) ||
140
+ !window.location ||
141
+ !window.location.search ) return false;
142
+ else str = (''+window.location.search).substring(1);
143
+ }
144
+ if( ! str ) return false;
145
+ str = (''+str).split(/#/,2)[0]; // remove #... to avoid it being added as part of the last value.
146
+ const args = Object.create(null);
147
+ const sp = str.split(/&+/);
148
+ const rx = /^([^=]+)(=(.+))?/;
149
+ var i, m;
150
+ for( i in sp ) {
151
+ m = rx.exec( sp[i] );
152
+ if( ! m ) continue;
153
+ args[decodeURIComponent(m[1])] = (m[3] ? decodeURIComponent(m[3]) : true);
154
+ }
155
+ return args;
156
+ }
157
+ };
158
+
159
+ /**
160
+ This is a module object for use with the emscripten-installed
161
+ sqlite3InitModule() factory function.
162
+ */
163
+ self.sqlite3TestModule = {
164
+ /**
165
+ Array of functions to call after Emscripten has initialized the
166
+ wasm module. Each gets passed the Emscripten module object
167
+ (which is _this_ object).
168
+ */
169
+ postRun: [
170
+ /* function(theModule){...} */
171
+ ],
172
+ //onRuntimeInitialized: function(){},
173
+ /* Proxy for C-side stdout output. */
174
+ print: (...args)=>{console.log(...args)},
175
+ /* Proxy for C-side stderr output. */
176
+ printErr: (...args)=>{console.error(...args)},
177
+ /**
178
+ Called by the Emscripten module init bits to report loading
179
+ progress. It gets passed an empty argument when loading is done
180
+ (after onRuntimeInitialized() and any this.postRun callbacks
181
+ have been run).
182
+ */
183
+ setStatus: function f(text){
184
+ if(!f.last){
185
+ f.last = { text: '', step: 0 };
186
+ f.ui = {
187
+ status: E('#module-status'),
188
+ progress: E('#module-progress'),
189
+ spinner: E('#module-spinner')
190
+ };
191
+ }
192
+ if(text === f.last.text) return;
193
+ f.last.text = text;
194
+ if(f.ui.progress){
195
+ f.ui.progress.value = f.last.step;
196
+ f.ui.progress.max = f.last.step + 1;
197
+ }
198
+ ++f.last.step;
199
+ if(text) {
200
+ f.ui.status.classList.remove('hidden');
201
+ f.ui.status.innerText = text;
202
+ }else{
203
+ if(f.ui.progress){
204
+ f.ui.progress.remove();
205
+ f.ui.spinner.remove();
206
+ delete f.ui.progress;
207
+ delete f.ui.spinner;
208
+ }
209
+ f.ui.status.classList.add('hidden');
210
+ }
211
+ },
212
+ /**
213
+ Config options used by the Emscripten-dependent initialization
214
+ which happens via this.initSqlite3(). This object gets
215
+ (indirectly) passed to sqlite3ApiBootstrap() to configure the
216
+ sqlite3 API.
217
+ */
218
+ sqlite3ApiConfig: {
219
+ wasmfsOpfsDir: "/opfs"
220
+ },
221
+ /**
222
+ Intended to be called by apps which need to call the
223
+ Emscripten-installed sqlite3InitModule() routine. This function
224
+ temporarily installs this.sqlite3ApiConfig into the self
225
+ object, calls it sqlite3InitModule(), and removes
226
+ self.sqlite3ApiConfig after initialization is done. Returns the
227
+ promise from sqlite3InitModule(), and the next then() handler
228
+ will get the sqlite3 API object as its argument.
229
+ */
230
+ initSqlite3: function(){
231
+ self.sqlite3ApiConfig = this.sqlite3ApiConfig;
232
+ return self.sqlite3InitModule(this).finally(()=>delete self.sqlite3ApiConfig);
233
+ }
234
+ };
235
+ })(self/*window or worker*/);
local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/common/testing.css ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body {
2
+ display: flex;
3
+ flex-direction: column;
4
+ flex-wrap: wrap;
5
+ }
6
+ textarea {
7
+ font-family: monospace;
8
+ }
9
+ header {
10
+ font-size: 130%;
11
+ font-weight: bold;
12
+ }
13
+ .hidden, .initially-hidden {
14
+ position: absolute !important;
15
+ opacity: 0 !important;
16
+ pointer-events: none !important;
17
+ display: none !important;
18
+ }
19
+ fieldset.options {
20
+ font-size: 75%;
21
+ }
22
+ fieldset > legend {
23
+ padding: 0 0.5em;
24
+ }
25
+ span.labeled-input {
26
+ padding: 0.25em;
27
+ margin: 0.25em 0.5em;
28
+ border-radius: 0.25em;
29
+ white-space: nowrap;
30
+ background: #0002;
31
+ }
32
+ .center { text-align: center; }
33
+ .error {
34
+ color: red;
35
+ background-color: yellow;
36
+ }
37
+ .strong { font-weight: 700 }
38
+ .warning { color: firebrick; }
39
+ .green { color: darkgreen; }
40
+ .tests-pass { background-color: green; color: white }
41
+ .tests-fail { background-color: red; color: yellow }
42
+ .faded { opacity: 0.5; }
43
+ .group-start {
44
+ color: blue;
45
+ background-color: skyblue;
46
+ font-weight: bold;
47
+ border-top: 1px dotted blue;
48
+ padding: 0.5em;
49
+ margin-top: 0.5em;
50
+ }
51
+ .group-end {
52
+ padding: 0.5em;
53
+ margin-bottom: 0.25em;
54
+ /*border-bottom: 1px dotted blue;*/
55
+ }
56
+ .group-end.green {
57
+ background: lightgreen;
58
+ border-bottom: 1px dotted green;
59
+ }
60
+ .one-test-line, .skipping-group {
61
+ margin-left: 3em;
62
+ }
63
+ .skipping-test, .skipping-group {
64
+ padding: 0.25em 0.5em;
65
+ background-color: #ffff73;
66
+ }
67
+ .skipping-test {
68
+ margin-left: 6em;
69
+ }
70
+ .one-test-summary {
71
+ margin-left: 6em;
72
+ }
73
+ .full-test-summary {
74
+ padding-bottom: 0.5em;
75
+ padding-top: 0.5em;
76
+ border-top: 1px solid black;
77
+ }
78
+ .input-wrapper {
79
+ white-space: nowrap;
80
+ display: flex;
81
+ align-items: center;
82
+ }
83
+ #test-output {
84
+ border: 1px inset;
85
+ border-radius: 0.25em;
86
+ padding: 0.25em;
87
+ /*max-height: 30em;*/
88
+ overflow: auto;
89
+ white-space: break-spaces;
90
+ display: flex; flex-direction: column;
91
+ font-family: monospace;
92
+ }
93
+ #test-output.reverse {
94
+ flex-direction: column-reverse;
95
+ }
96
+ label[for] { cursor: pointer }
97
+
98
+ h1 {
99
+ border-radius: 0.25em;
100
+ padding: 0.15em 0.25em;
101
+ }
102
+ h1:first-of-type {margin: 0 0 0.5em 0;}
local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/fiddle/fiddle.js ADDED
@@ -0,0 +1,822 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ 2022-05-20
3
+
4
+ The author disclaims copyright to this source code. In place of a
5
+ legal notice, here is a blessing:
6
+
7
+ * May you do good and not evil.
8
+ * May you find forgiveness for yourself and forgive others.
9
+ * May you share freely, never taking more than you give.
10
+
11
+ ***********************************************************************
12
+
13
+ This is the main entry point for the sqlite3 fiddle app. It sets up the
14
+ various UI bits, loads a Worker for the db connection, and manages the
15
+ communication between the UI and worker.
16
+ */
17
+ (function(){
18
+ 'use strict';
19
+ /* Recall that the 'self' symbol, except where locally
20
+ overwritten, refers to the global window or worker object. */
21
+
22
+ const storage = (function(NS/*namespace object in which to store this module*/){
23
+ /* Pedantic licensing note: this code originated in the Fossil SCM
24
+ source tree, where it has a different license, but the person who
25
+ ported it into sqlite is the same one who wrote it for fossil. */
26
+ 'use strict';
27
+ NS = NS||{};
28
+
29
+ /**
30
+ This module provides a basic wrapper around localStorage
31
+ or sessionStorage or a dummy proxy object if neither
32
+ of those are available.
33
+ */
34
+ const tryStorage = function f(obj){
35
+ if(!f.key) f.key = 'storage.access.check';
36
+ try{
37
+ obj.setItem(f.key, 'f');
38
+ const x = obj.getItem(f.key);
39
+ obj.removeItem(f.key);
40
+ if(x!=='f') throw new Error(f.key+" failed")
41
+ return obj;
42
+ }catch(e){
43
+ return undefined;
44
+ }
45
+ };
46
+
47
+ /** Internal storage impl for this module. */
48
+ const $storage =
49
+ tryStorage(window.localStorage)
50
+ || tryStorage(window.sessionStorage)
51
+ || tryStorage({
52
+ // A basic dummy xyzStorage stand-in
53
+ $$$:{},
54
+ setItem: function(k,v){this.$$$[k]=v},
55
+ getItem: function(k){
56
+ return this.$$$.hasOwnProperty(k) ? this.$$$[k] : undefined;
57
+ },
58
+ removeItem: function(k){delete this.$$$[k]},
59
+ clear: function(){this.$$$={}}
60
+ });
61
+
62
+ /**
63
+ For the dummy storage we need to differentiate between
64
+ $storage and its real property storage for hasOwnProperty()
65
+ to work properly...
66
+ */
67
+ const $storageHolder = $storage.hasOwnProperty('$$$') ? $storage.$$$ : $storage;
68
+
69
+ /**
70
+ A prefix which gets internally applied to all storage module
71
+ property keys so that localStorage and sessionStorage across the
72
+ same browser profile instance do not "leak" across multiple apps
73
+ being hosted by the same origin server. Such cross-polination is
74
+ still there but, with this key prefix applied, it won't be
75
+ immediately visible via the storage API.
76
+
77
+ With this in place we can justify using localStorage instead of
78
+ sessionStorage.
79
+
80
+ One implication of using localStorage and sessionStorage is that
81
+ their scope (the same "origin" and client application/profile)
82
+ allows multiple apps on the same origin to use the same
83
+ storage. Thus /appA/foo could then see changes made via
84
+ /appB/foo. The data do not cross user- or browser boundaries,
85
+ though, so it "might" arguably be called a
86
+ feature. storageKeyPrefix was added so that we can sandbox that
87
+ state for each separate app which shares an origin.
88
+
89
+ See: https://fossil-scm.org/forum/forumpost/4afc4d34de
90
+
91
+ Sidebar: it might seem odd to provide a key prefix and stick all
92
+ properties in the topmost level of the storage object. We do that
93
+ because adding a layer of object to sandbox each app would mean
94
+ (de)serializing that whole tree on every storage property change.
95
+ e.g. instead of storageObject.projectName.foo we have
96
+ storageObject[storageKeyPrefix+'foo']. That's soley for
97
+ efficiency's sake (in terms of battery life and
98
+ environment-internal storage-level effort).
99
+ */
100
+ const storageKeyPrefix = (
101
+ $storageHolder===$storage/*localStorage or sessionStorage*/
102
+ ? (
103
+ (NS.config ?
104
+ (NS.config.projectCode || NS.config.projectName
105
+ || NS.config.shortProjectName)
106
+ : false)
107
+ || window.location.pathname
108
+ )+'::' : (
109
+ '' /* transient storage */
110
+ )
111
+ );
112
+
113
+ /**
114
+ A proxy for localStorage or sessionStorage or a
115
+ page-instance-local proxy, if neither one is availble.
116
+
117
+ Which exact storage implementation is uses is unspecified, and
118
+ apps must not rely on it.
119
+ */
120
+ NS.storage = {
121
+ storageKeyPrefix: storageKeyPrefix,
122
+ /** Sets the storage key k to value v, implicitly converting
123
+ it to a string. */
124
+ set: (k,v)=>$storage.setItem(storageKeyPrefix+k,v),
125
+ /** Sets storage key k to JSON.stringify(v). */
126
+ setJSON: (k,v)=>$storage.setItem(storageKeyPrefix+k,JSON.stringify(v)),
127
+ /** Returns the value for the given storage key, or
128
+ dflt if the key is not found in the storage. */
129
+ get: (k,dflt)=>$storageHolder.hasOwnProperty(
130
+ storageKeyPrefix+k
131
+ ) ? $storage.getItem(storageKeyPrefix+k) : dflt,
132
+ /** Returns true if the given key has a value of "true". If the
133
+ key is not found, it returns true if the boolean value of dflt
134
+ is "true". (Remember that JS persistent storage values are all
135
+ strings.) */
136
+ getBool: function(k,dflt){
137
+ return 'true'===this.get(k,''+(!!dflt));
138
+ },
139
+ /** Returns the JSON.parse()'d value of the given
140
+ storage key's value, or dflt is the key is not
141
+ found or JSON.parse() fails. */
142
+ getJSON: function f(k,dflt){
143
+ try {
144
+ const x = this.get(k,f);
145
+ return x===f ? dflt : JSON.parse(x);
146
+ }
147
+ catch(e){return dflt}
148
+ },
149
+ /** Returns true if the storage contains the given key,
150
+ else false. */
151
+ contains: (k)=>$storageHolder.hasOwnProperty(storageKeyPrefix+k),
152
+ /** Removes the given key from the storage. Returns this. */
153
+ remove: function(k){
154
+ $storage.removeItem(storageKeyPrefix+k);
155
+ return this;
156
+ },
157
+ /** Clears ALL keys from the storage. Returns this. */
158
+ clear: function(){
159
+ this.keys().forEach((k)=>$storage.removeItem(/*w/o prefix*/k));
160
+ return this;
161
+ },
162
+ /** Returns an array of all keys currently in the storage. */
163
+ keys: ()=>Object.keys($storageHolder).filter((v)=>(v||'').startsWith(storageKeyPrefix)),
164
+ /** Returns true if this storage is transient (only available
165
+ until the page is reloaded), indicating that fileStorage
166
+ and sessionStorage are unavailable. */
167
+ isTransient: ()=>$storageHolder!==$storage,
168
+ /** Returns a symbolic name for the current storage mechanism. */
169
+ storageImplName: function(){
170
+ if($storage===window.localStorage) return 'localStorage';
171
+ else if($storage===window.sessionStorage) return 'sessionStorage';
172
+ else return 'transient';
173
+ },
174
+
175
+ /**
176
+ Returns a brief help text string for the currently-selected
177
+ storage type.
178
+ */
179
+ storageHelpDescription: function(){
180
+ return {
181
+ localStorage: "Browser-local persistent storage with an "+
182
+ "unspecified long-term lifetime (survives closing the browser, "+
183
+ "but maybe not a browser upgrade).",
184
+ sessionStorage: "Storage local to this browser tab, "+
185
+ "lost if this tab is closed.",
186
+ "transient": "Transient storage local to this invocation of this page."
187
+ }[this.storageImplName()];
188
+ }
189
+ };
190
+ return NS.storage;
191
+ })({})/*storage API setup*/;
192
+
193
+
194
+ /** Name of the stored copy of SqliteFiddle.config. */
195
+ const configStorageKey = 'sqlite3-fiddle-config';
196
+
197
+ /**
198
+ The SqliteFiddle object is intended to be the primary
199
+ app-level object for the main-thread side of the sqlite
200
+ fiddle application. It uses a worker thread to load the
201
+ sqlite WASM module and communicate with it.
202
+ */
203
+ const SF/*local convenience alias*/
204
+ = window.SqliteFiddle/*canonical name*/ = {
205
+ /* Config options. */
206
+ config: {
207
+ /* If true, SqliteFiddle.echo() will auto-scroll the
208
+ output widget to the bottom when it receives output,
209
+ else it won't. */
210
+ autoScrollOutput: true,
211
+ /* If true, the output area will be cleared before each
212
+ command is run, else it will not. */
213
+ autoClearOutput: false,
214
+ /* If true, SqliteFiddle.echo() will echo its output to
215
+ the console, in addition to its normal output widget.
216
+ That slows it down but is useful for testing. */
217
+ echoToConsole: false,
218
+ /* If true, display input/output areas side-by-side. */
219
+ sideBySide: true,
220
+ /* If true, swap positions of the input/output areas. */
221
+ swapInOut: false
222
+ },
223
+ /**
224
+ Emits the given text, followed by a line break, to the
225
+ output widget. If given more than one argument, they are
226
+ join()'d together with a space between each. As a special
227
+ case, if passed a single array, that array is used in place
228
+ of the arguments array (this is to facilitate receiving
229
+ lists of arguments via worker events).
230
+ */
231
+ echo: function f(text) {
232
+ /* Maintenance reminder: we currently require/expect a textarea
233
+ output element. It might be nice to extend this to behave
234
+ differently if the output element is a non-textarea element,
235
+ in which case it would need to append the given text as a TEXT
236
+ node and add a line break. */
237
+ if(!f._){
238
+ f._ = document.getElementById('output');
239
+ f._.value = ''; // clear browser cache
240
+ }
241
+ if(arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
242
+ else if(1===arguments.length && Array.isArray(text)) text = text.join(' ');
243
+ // These replacements are necessary if you render to raw HTML
244
+ //text = text.replace(/&/g, "&amp;");
245
+ //text = text.replace(/</g, "&lt;");
246
+ //text = text.replace(/>/g, "&gt;");
247
+ //text = text.replace('\n', '<br>', 'g');
248
+ if(null===text){/*special case: clear output*/
249
+ f._.value = '';
250
+ return;
251
+ }else if(this.echo._clearPending){
252
+ delete this.echo._clearPending;
253
+ f._.value = '';
254
+ }
255
+ if(this.config.echoToConsole) console.log(text);
256
+ if(this.jqTerm) this.jqTerm.echo(text);
257
+ f._.value += text + "\n";
258
+ if(this.config.autoScrollOutput){
259
+ f._.scrollTop = f._.scrollHeight;
260
+ }
261
+ },
262
+ _msgMap: {},
263
+ /** Adds a worker message handler for messages of the given
264
+ type. */
265
+ addMsgHandler: function f(type,callback){
266
+ if(Array.isArray(type)){
267
+ type.forEach((t)=>this.addMsgHandler(t, callback));
268
+ return this;
269
+ }
270
+ (this._msgMap.hasOwnProperty(type)
271
+ ? this._msgMap[type]
272
+ : (this._msgMap[type] = [])).push(callback);
273
+ return this;
274
+ },
275
+ /** Given a worker message, runs all handlers for msg.type. */
276
+ runMsgHandlers: function(msg){
277
+ const list = (this._msgMap.hasOwnProperty(msg.type)
278
+ ? this._msgMap[msg.type] : false);
279
+ if(!list){
280
+ console.warn("No handlers found for message type:",msg);
281
+ return false;
282
+ }
283
+ //console.debug("runMsgHandlers",msg);
284
+ list.forEach((f)=>f(msg));
285
+ return true;
286
+ },
287
+ /** Removes all message handlers for the given message type. */
288
+ clearMsgHandlers: function(type){
289
+ delete this._msgMap[type];
290
+ return this;
291
+ },
292
+ /* Posts a message in the form {type, data} to the db worker. Returns this. */
293
+ wMsg: function(type,data,transferables){
294
+ this.worker.postMessage({type, data}, transferables || []);
295
+ return this;
296
+ },
297
+ /**
298
+ Prompts for confirmation and, if accepted, deletes
299
+ all content and tables in the (transient) database.
300
+ */
301
+ resetDb: function(){
302
+ if(window.confirm("Really destroy all content and tables "
303
+ +"in the (transient) db?")){
304
+ this.wMsg('db-reset');
305
+ }
306
+ return this;
307
+ },
308
+ /** Stores this object's config in the browser's storage. */
309
+ storeConfig: function(){
310
+ storage.setJSON(configStorageKey,this.config);
311
+ }
312
+ };
313
+
314
+ if(1){ /* Restore SF.config */
315
+ const storedConfig = storage.getJSON(configStorageKey);
316
+ if(storedConfig){
317
+ /* Copy all properties to SF.config which are currently in
318
+ storedConfig. We don't bother copying any other
319
+ properties: those have been removed from the app in the
320
+ meantime. */
321
+ Object.keys(SF.config).forEach(function(k){
322
+ if(storedConfig.hasOwnProperty(k)){
323
+ SF.config[k] = storedConfig[k];
324
+ }
325
+ });
326
+ }
327
+ }
328
+
329
+ SF.worker = new Worker('fiddle-worker.js'+self.location.search);
330
+ SF.worker.onmessage = (ev)=>SF.runMsgHandlers(ev.data);
331
+ SF.addMsgHandler(['stdout', 'stderr'], (ev)=>SF.echo(ev.data));
332
+
333
+ /* querySelectorAll() proxy */
334
+ const EAll = function(/*[element=document,] cssSelector*/){
335
+ return (arguments.length>1 ? arguments[0] : document)
336
+ .querySelectorAll(arguments[arguments.length-1]);
337
+ };
338
+ /* querySelector() proxy */
339
+ const E = function(/*[element=document,] cssSelector*/){
340
+ return (arguments.length>1 ? arguments[0] : document)
341
+ .querySelector(arguments[arguments.length-1]);
342
+ };
343
+
344
+ /** Handles status updates from the Emscripten Module object. */
345
+ SF.addMsgHandler('module', function f(ev){
346
+ ev = ev.data;
347
+ if('status'!==ev.type){
348
+ console.warn("Unexpected module-type message:",ev);
349
+ return;
350
+ }
351
+ if(!f.ui){
352
+ f.ui = {
353
+ status: E('#module-status'),
354
+ progress: E('#module-progress'),
355
+ spinner: E('#module-spinner')
356
+ };
357
+ }
358
+ const msg = ev.data;
359
+ if(f.ui.progres){
360
+ progress.value = msg.step;
361
+ progress.max = msg.step + 1/*we don't know how many steps to expect*/;
362
+ }
363
+ if(1==msg.step){
364
+ f.ui.progress.classList.remove('hidden');
365
+ f.ui.spinner.classList.remove('hidden');
366
+ }
367
+ if(msg.text){
368
+ f.ui.status.classList.remove('hidden');
369
+ f.ui.status.innerText = msg.text;
370
+ }else{
371
+ if(f.ui.progress){
372
+ f.ui.progress.remove();
373
+ f.ui.spinner.remove();
374
+ delete f.ui.progress;
375
+ delete f.ui.spinner;
376
+ }
377
+ f.ui.status.classList.add('hidden');
378
+ /* The module can post messages about fatal problems,
379
+ e.g. an exit() being triggered or assertion failure,
380
+ after the last "load" message has arrived, so
381
+ leave f.ui.status and message listener intact. */
382
+ }
383
+ });
384
+
385
+ /**
386
+ The 'fiddle-ready' event is fired (with no payload) when the
387
+ wasm module has finished loading. Interestingly, that happens
388
+ _before_ the final module:status event */
389
+ SF.addMsgHandler('fiddle-ready', function(){
390
+ SF.clearMsgHandlers('fiddle-ready');
391
+ self.onSFLoaded();
392
+ });
393
+
394
+ /**
395
+ Performs all app initialization which must wait until after the
396
+ worker module is loaded. This function removes itself when it's
397
+ called.
398
+ */
399
+ self.onSFLoaded = function(){
400
+ delete this.onSFLoaded;
401
+ // Unhide all elements which start out hidden
402
+ EAll('.initially-hidden').forEach((e)=>e.classList.remove('initially-hidden'));
403
+ E('#btn-reset').addEventListener('click',()=>SF.resetDb());
404
+ const taInput = E('#input');
405
+ const btnClearIn = E('#btn-clear');
406
+ const selectExamples = E('#select-examples');
407
+ btnClearIn.addEventListener('click',function(){
408
+ taInput.value = '';
409
+ selectExamples.selectedIndex = 0;
410
+ },false);
411
+ // Ctrl-enter and shift-enter both run the current SQL.
412
+ taInput.addEventListener('keydown',function(ev){
413
+ if((ev.ctrlKey || ev.shiftKey) && 13 === ev.keyCode){
414
+ ev.preventDefault();
415
+ ev.stopPropagation();
416
+ btnShellExec.click();
417
+ }
418
+ }, false);
419
+ const taOutput = E('#output');
420
+ const btnClearOut = E('#btn-clear-output');
421
+ btnClearOut.addEventListener('click',function(){
422
+ taOutput.value = '';
423
+ if(SF.jqTerm) SF.jqTerm.clear();
424
+ },false);
425
+ const btnShellExec = E('#btn-shell-exec');
426
+ btnShellExec.addEventListener('click',function(ev){
427
+ let sql;
428
+ ev.preventDefault();
429
+ if(taInput.selectionStart<taInput.selectionEnd){
430
+ sql = taInput.value.substring(taInput.selectionStart,taInput.selectionEnd).trim();
431
+ }else{
432
+ sql = taInput.value.trim();
433
+ }
434
+ if(sql) SF.dbExec(sql);
435
+ },false);
436
+
437
+ const btnInterrupt = E("#btn-interrupt");
438
+ //btnInterrupt.classList.add('hidden');
439
+ /** To be called immediately before work is sent to the
440
+ worker. Updates some UI elements. The 'working'/'end'
441
+ event will apply the inverse, undoing the bits this
442
+ function does. This impl is not in the 'working'/'start'
443
+ event handler because that event is given to us
444
+ asynchronously _after_ we need to have performed this
445
+ work.
446
+ */
447
+ const preStartWork = function f(){
448
+ if(!f._){
449
+ const title = E('title');
450
+ f._ = {
451
+ btnLabel: btnShellExec.innerText,
452
+ pageTitle: title,
453
+ pageTitleOrig: title.innerText
454
+ };
455
+ }
456
+ f._.pageTitle.innerText = "[working...] "+f._.pageTitleOrig;
457
+ btnShellExec.setAttribute('disabled','disabled');
458
+ btnInterrupt.removeAttribute('disabled','disabled');
459
+ };
460
+
461
+ /* Sends the given text to the db module to evaluate as if it
462
+ had been entered in the sqlite3 CLI shell. If it's null or
463
+ empty, this is a no-op. */
464
+ SF.dbExec = function f(sql){
465
+ if(null!==sql && this.config.autoClearOutput){
466
+ this.echo._clearPending = true;
467
+ }
468
+ preStartWork();
469
+ this.wMsg('shellExec',sql);
470
+ };
471
+
472
+ SF.addMsgHandler('working',function f(ev){
473
+ switch(ev.data){
474
+ case 'start': /* See notes in preStartWork(). */; return;
475
+ case 'end':
476
+ preStartWork._.pageTitle.innerText = preStartWork._.pageTitleOrig;
477
+ btnShellExec.innerText = preStartWork._.btnLabel;
478
+ btnShellExec.removeAttribute('disabled');
479
+ btnInterrupt.setAttribute('disabled','disabled');
480
+ return;
481
+ }
482
+ console.warn("Unhandled 'working' event:",ev.data);
483
+ });
484
+
485
+ /* For each checkbox with data-csstgt, set up a handler which
486
+ toggles the given CSS class on the element matching
487
+ E(data-csstgt). */
488
+ EAll('input[type=checkbox][data-csstgt]')
489
+ .forEach(function(e){
490
+ const tgt = E(e.dataset.csstgt);
491
+ const cssClass = e.dataset.cssclass || 'error';
492
+ e.checked = tgt.classList.contains(cssClass);
493
+ e.addEventListener('change', function(){
494
+ tgt.classList[
495
+ this.checked ? 'add' : 'remove'
496
+ ](cssClass)
497
+ }, false);
498
+ });
499
+ /* For each checkbox with data-config=X, set up a binding to
500
+ SF.config[X]. These must be set up AFTER data-csstgt
501
+ checkboxes so that those two states can be synced properly. */
502
+ EAll('input[type=checkbox][data-config]')
503
+ .forEach(function(e){
504
+ const confVal = !!SF.config[e.dataset.config];
505
+ if(e.checked !== confVal){
506
+ /* Ensure that data-csstgt mappings (if any) get
507
+ synced properly. */
508
+ e.checked = confVal;
509
+ e.dispatchEvent(new Event('change'));
510
+ }
511
+ e.addEventListener('change', function(){
512
+ SF.config[this.dataset.config] = this.checked;
513
+ SF.storeConfig();
514
+ }, false);
515
+ });
516
+ /* For each button with data-cmd=X, map a click handler which
517
+ calls SF.dbExec(X). */
518
+ const cmdClick = function(){SF.dbExec(this.dataset.cmd);};
519
+ EAll('button[data-cmd]').forEach(
520
+ e => e.addEventListener('click', cmdClick, false)
521
+ );
522
+
523
+ btnInterrupt.addEventListener('click',function(){
524
+ SF.wMsg('interrupt');
525
+ });
526
+
527
+ /** Initiate a download of the db. */
528
+ const btnExport = E('#btn-export');
529
+ const eLoadDb = E('#load-db');
530
+ const btnLoadDb = E('#btn-load-db');
531
+ btnLoadDb.addEventListener('click', ()=>eLoadDb.click());
532
+ /**
533
+ Enables (if passed true) or disables all UI elements which
534
+ "might," if timed "just right," interfere with an
535
+ in-progress db import/export/exec operation.
536
+ */
537
+ const enableMutatingElements = function f(enable){
538
+ if(!f._elems){
539
+ f._elems = [
540
+ /* UI elements to disable while import/export are
541
+ running. Normally the export is fast enough
542
+ that this won't matter, but we really don't
543
+ want to be reading (from outside of sqlite) the
544
+ db when the user taps btnShellExec. */
545
+ btnShellExec, btnExport, eLoadDb
546
+ ];
547
+ }
548
+ f._elems.forEach( enable
549
+ ? (e)=>e.removeAttribute('disabled')
550
+ : (e)=>e.setAttribute('disabled','disabled') );
551
+ };
552
+ btnExport.addEventListener('click',function(){
553
+ enableMutatingElements(false);
554
+ SF.wMsg('db-export');
555
+ });
556
+ SF.addMsgHandler('db-export', function(ev){
557
+ enableMutatingElements(true);
558
+ ev = ev.data;
559
+ if(ev.error){
560
+ SF.echo("Export failed:",ev.error);
561
+ return;
562
+ }
563
+ const blob = new Blob([ev.buffer],
564
+ {type:"application/x-sqlite3"});
565
+ const a = document.createElement('a');
566
+ document.body.appendChild(a);
567
+ a.href = window.URL.createObjectURL(blob);
568
+ a.download = ev.filename;
569
+ a.addEventListener('click',function(){
570
+ setTimeout(function(){
571
+ SF.echo("Exported (possibly auto-downloaded):",ev.filename);
572
+ window.URL.revokeObjectURL(a.href);
573
+ a.remove();
574
+ },500);
575
+ });
576
+ a.click();
577
+ });
578
+ /**
579
+ Handle load/import of an external db file.
580
+ */
581
+ eLoadDb.addEventListener('change',function(){
582
+ const f = this.files[0];
583
+ const r = new FileReader();
584
+ const status = {loaded: 0, total: 0};
585
+ enableMutatingElements(false);
586
+ r.addEventListener('loadstart', function(){
587
+ SF.echo("Loading",f.name,"...");
588
+ });
589
+ r.addEventListener('progress', function(ev){
590
+ SF.echo("Loading progress:",ev.loaded,"of",ev.total,"bytes.");
591
+ });
592
+ const that = this;
593
+ r.addEventListener('load', function(){
594
+ enableMutatingElements(true);
595
+ SF.echo("Loaded",f.name+". Opening db...");
596
+ SF.wMsg('open',{
597
+ filename: f.name,
598
+ buffer: this.result
599
+ }, [this.result]);
600
+ });
601
+ r.addEventListener('error',function(){
602
+ enableMutatingElements(true);
603
+ SF.echo("Loading",f.name,"failed for unknown reasons.");
604
+ });
605
+ r.addEventListener('abort',function(){
606
+ enableMutatingElements(true);
607
+ SF.echo("Cancelled loading of",f.name+".");
608
+ });
609
+ r.readAsArrayBuffer(f);
610
+ });
611
+
612
+ EAll('fieldset.collapsible').forEach(function(fs){
613
+ const btnToggle = E(fs,'legend > .fieldset-toggle'),
614
+ content = EAll(fs,':scope > div');
615
+ btnToggle.addEventListener('click', function(){
616
+ fs.classList.toggle('collapsed');
617
+ content.forEach((d)=>d.classList.toggle('hidden'));
618
+ }, false);
619
+ });
620
+
621
+ /**
622
+ Given a DOM element, this routine measures its "effective
623
+ height", which is the bounding top/bottom range of this element
624
+ and all of its children, recursively. For some DOM structure
625
+ cases, a parent may have a reported height of 0 even though
626
+ children have non-0 sizes.
627
+
628
+ Returns 0 if !e or if the element really has no height.
629
+ */
630
+ const effectiveHeight = function f(e){
631
+ if(!e) return 0;
632
+ if(!f.measure){
633
+ f.measure = function callee(e, depth){
634
+ if(!e) return;
635
+ const m = e.getBoundingClientRect();
636
+ if(0===depth){
637
+ callee.top = m.top;
638
+ callee.bottom = m.bottom;
639
+ }else{
640
+ callee.top = m.top ? Math.min(callee.top, m.top) : callee.top;
641
+ callee.bottom = Math.max(callee.bottom, m.bottom);
642
+ }
643
+ Array.prototype.forEach.call(e.children,(e)=>callee(e,depth+1));
644
+ if(0===depth){
645
+ //console.debug("measure() height:",e.className, callee.top, callee.bottom, (callee.bottom - callee.top));
646
+ f.extra += callee.bottom - callee.top;
647
+ }
648
+ return f.extra;
649
+ };
650
+ }
651
+ f.extra = 0;
652
+ f.measure(e,0);
653
+ return f.extra;
654
+ };
655
+
656
+ /**
657
+ Returns a function, that, as long as it continues to be invoked,
658
+ will not be triggered. The function will be called after it stops
659
+ being called for N milliseconds. If `immediate` is passed, call
660
+ the callback immediately and hinder future invocations until at
661
+ least the given time has passed.
662
+
663
+ If passed only 1 argument, or passed a falsy 2nd argument,
664
+ the default wait time set in this function's $defaultDelay
665
+ property is used.
666
+
667
+ Source: underscore.js, by way of https://davidwalsh.name/javascript-debounce-function
668
+ */
669
+ const debounce = function f(func, wait, immediate) {
670
+ var timeout;
671
+ if(!wait) wait = f.$defaultDelay;
672
+ return function() {
673
+ const context = this, args = Array.prototype.slice.call(arguments);
674
+ const later = function() {
675
+ timeout = undefined;
676
+ if(!immediate) func.apply(context, args);
677
+ };
678
+ const callNow = immediate && !timeout;
679
+ clearTimeout(timeout);
680
+ timeout = setTimeout(later, wait);
681
+ if(callNow) func.apply(context, args);
682
+ };
683
+ };
684
+ debounce.$defaultDelay = 500 /*arbitrary*/;
685
+
686
+ const ForceResizeKludge = (function(){
687
+ /* Workaround for Safari mayhem regarding use of vh CSS
688
+ units.... We cannot use vh units to set the main view
689
+ size because Safari chokes on that, so we calculate
690
+ that height here. Larger than ~95% is too big for
691
+ Firefox on Android, causing the input area to move
692
+ off-screen. */
693
+ const appViews = EAll('.app-view');
694
+ const elemsToCount = [
695
+ /* Elements which we need to always count in the
696
+ visible body size. */
697
+ E('body > header'),
698
+ E('body > footer')
699
+ ];
700
+ const resized = function f(){
701
+ if(f.$disabled) return;
702
+ const wh = window.innerHeight;
703
+ var ht;
704
+ var extra = 0;
705
+ elemsToCount.forEach((e)=>e ? extra += effectiveHeight(e) : false);
706
+ ht = wh - extra;
707
+ appViews.forEach(function(e){
708
+ e.style.height =
709
+ e.style.maxHeight = [
710
+ "calc(", (ht>=100 ? ht : 100), "px",
711
+ " - 2em"/*fudge value*/,")"
712
+ /* ^^^^ hypothetically not needed, but both
713
+ Chrome/FF on Linux will force scrollbars on the
714
+ body if this value is too small. */
715
+ ].join('');
716
+ });
717
+ };
718
+ resized.$disabled = true/*gets deleted when setup is finished*/;
719
+ window.addEventListener('resize', debounce(resized, 250), false);
720
+ return resized;
721
+ })();
722
+
723
+ /** Set up a selection list of examples */
724
+ (function(){
725
+ const xElem = E('#select-examples');
726
+ const examples = [
727
+ {name: "Help", sql: [
728
+ "-- ================================================\n",
729
+ "-- Use ctrl-enter or shift-enter to execute sqlite3\n",
730
+ "-- shell commands and SQL.\n",
731
+ "-- If a subset of the text is currently selected,\n",
732
+ "-- only that part is executed.\n",
733
+ "-- ================================================\n",
734
+ ".help\n"
735
+ ]},
736
+ //{name: "Timer on", sql: ".timer on"},
737
+ // ^^^ re-enable if emscripten re-enables getrusage()
738
+ {name: "Box Mode", sql: ".mode box"},
739
+ {name: "Setup table T", sql:[
740
+ ".nullvalue NULL\n",
741
+ "CREATE TABLE t(a,b);\n",
742
+ "INSERT INTO t(a,b) VALUES('abc',123),('def',456),(NULL,789),('ghi',012);\n",
743
+ "SELECT * FROM t;\n"
744
+ ]},
745
+ {name: "sqlite_schema", sql: "select * from sqlite_schema"},
746
+ {name: "Mandelbrot", sql:[
747
+ "WITH RECURSIVE",
748
+ " xaxis(x) AS (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x<1.2),\n",
749
+ " yaxis(y) AS (VALUES(-1.0) UNION ALL SELECT y+0.1 FROM yaxis WHERE y<1.0),\n",
750
+ " m(iter, cx, cy, x, y) AS (\n",
751
+ " SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis\n",
752
+ " UNION ALL\n",
753
+ " SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m \n",
754
+ " WHERE (x*x + y*y) < 4.0 AND iter<28\n",
755
+ " ),\n",
756
+ " m2(iter, cx, cy) AS (\n",
757
+ " SELECT max(iter), cx, cy FROM m GROUP BY cx, cy\n",
758
+ " ),\n",
759
+ " a(t) AS (\n",
760
+ " SELECT group_concat( substr(' .+*#', 1+min(iter/7,4), 1), '') \n",
761
+ " FROM m2 GROUP BY cy\n",
762
+ " )\n",
763
+ "SELECT group_concat(rtrim(t),x'0a') as Mandelbrot FROM a;\n",
764
+ ]},
765
+ {name: "JSON pretty-print",
766
+ sql: "select json_pretty(json_object('ex',json('[52,3.14159]')))"
767
+ },
768
+ {name: "JSON pretty-print (with tabs)",
769
+ sql: "select json_pretty(json_object('ex',json('[52,3.14159]')),char(0x09))"
770
+ }
771
+ ];
772
+ const newOpt = function(lbl,val){
773
+ const o = document.createElement('option');
774
+ if(Array.isArray(val)) val = val.join('');
775
+ o.value = val;
776
+ if(!val) o.setAttribute('disabled',true);
777
+ o.appendChild(document.createTextNode(lbl));
778
+ xElem.appendChild(o);
779
+ };
780
+ newOpt("Examples (replaces input!)");
781
+ examples.forEach((o)=>newOpt(o.name, o.sql));
782
+ //xElem.setAttribute('disabled',true);
783
+ xElem.selectedIndex = 0;
784
+ xElem.addEventListener('change', function(){
785
+ taInput.value = '-- ' +
786
+ this.selectedOptions[0].innerText +
787
+ '\n' + this.value;
788
+ SF.dbExec(this.value);
789
+ });
790
+ })()/* example queries */;
791
+
792
+ //SF.echo(null/*clear any output generated by the init process*/);
793
+ if(window.jQuery && window.jQuery.terminal){
794
+ /* Set up the terminal-style view... */
795
+ const eTerm = window.jQuery('#view-terminal').empty();
796
+ SF.jqTerm = eTerm.terminal(SF.dbExec.bind(SF),{
797
+ prompt: 'sqlite> ',
798
+ greetings: false /* note that the docs incorrectly call this 'greeting' */
799
+ });
800
+ /* Set up a button to toggle the views... */
801
+ const head = E('header#titlebar');
802
+ const btnToggleView = document.createElement('button');
803
+ btnToggleView.appendChild(document.createTextNode("Toggle View"));
804
+ head.appendChild(btnToggleView);
805
+ btnToggleView.addEventListener('click',function f(){
806
+ EAll('.app-view').forEach(e=>e.classList.toggle('hidden'));
807
+ if(document.body.classList.toggle('terminal-mode')){
808
+ ForceResizeKludge();
809
+ }
810
+ }, false);
811
+ btnToggleView.click()/*default to terminal view*/;
812
+ }
813
+ SF.echo('This experimental app is provided in the hope that it',
814
+ 'may prove interesting or useful but is not an officially',
815
+ 'supported deliverable of the sqlite project. It is subject to',
816
+ 'any number of changes or outright removal at any time.\n');
817
+ const urlParams = new URL(self.location.href).searchParams;
818
+ SF.dbExec(urlParams.get('sql') || null);
819
+ delete ForceResizeKludge.$disabled;
820
+ ForceResizeKludge();
821
+ }/*onSFLoaded()*/;
822
+ })();
local-test-sqlite3-delta-02/afc-sqlite3/ext/wasm/tests/opfs/concurrency/index.html ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en-us">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
+ <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
7
+ <link rel="stylesheet" href="../../../common/testing.css"/>
8
+ <title>sqlite3 OPFS Worker concurrency tester</title>
9
+ <style>
10
+ body { display: revert; }
11
+ body > * {}
12
+ #test-output {
13
+ font-family: monospace;
14
+ }
15
+ </style>
16
+ </head>
17
+ <body>
18
+ <h1></h1>
19
+ <p>
20
+ OPFS concurrency tester using multiple independent Workers.
21
+ Disclaimer: concurrency in OPFS is currently a pain point!
22
+ </p>
23
+ <p>
24
+ URL flags: pass a number of workers using
25
+ the <code>workers=N</code> URL flag. Set the time between each
26
+ workload with <code>interval=N</code> (milliseconds). Set the
27
+ number of worker iterations with <code>iterations=N</code>.
28
+ Enable OPFS VFS verbosity with <code>verbose=1-3</code> (output
29
+ goes to the dev console). Disable/enable "unlock ASAP" mode
30
+ (higher concurrency, lower speed) with <code>unlock-asap=0-1</code>.
31
+ </p>
32
+ <p>Achtung: if it does not start to do anything within a couple of
33
+ seconds, check the dev console: Chrome sometimes fails to load
34
+ the wasm module due to "cannot allocate WasmMemory." Closing and
35
+ re-opening the tab usually resolves it, but sometimes restarting
36
+ the browser is required.
37
+ </p>
38
+ <p>
39
+ Links for various testing options: <ul id='testlinks'></ul>
40
+ </p>
41
+ <div class='input-wrapper'>
42
+ <input type='checkbox' id='cb-log-reverse'>
43
+ <label for='cb-log-reverse'>Reverse log order?</label>
44
+ </div>
45
+ <div id='test-output'></div>
46
+ <script>(function(){
47
+ document.querySelector('h1').innerHTML =
48
+ document.querySelector('title').innerHTML;
49
+ })();</script>
50
+ <script src="test.js?sqlite3.dir=../../../jswasm"></script>
51
+ </body>
52
+ </html>