AuroraRuntime/Source/AuProcAddresses.NT.cpp
Jamie Reece Wilson 6852fbddf1 [*] Improved high resolution timing on Windows 7, Windows 10 < RS4, and Windows10 >= RS4/Win11
Win7 test:
[2024-09-10 07:09:31] [Debug]  | Waiting 750 overshoot: 103600 NS
[2024-09-10 07:09:31] [Debug]  | bret: true
[2024-09-10 07:09:31] [Debug]  | Waiting 750 overshoot: 145200 NS
[2024-09-10 07:09:32] [Debug]  | bret: true
[2024-09-10 07:09:32] [Debug]  | Waiting 750 overshoot: 100000 NS
[2024-09-10 07:09:33] [Debug]  | bret: true
[2024-09-10 07:09:33] [Debug]  | Waiting 750 overshoot: 88000 NS
[2024-09-10 07:09:34] [Debug]  | bret: true
[2024-09-10 07:09:34] [Debug]  | Waiting 750 overshoot: 114500 NS
[2024-09-10 07:09:34] [Debug]  | bret: true
[2024-09-10 07:09:34] [Debug]  | Waiting 750 overshoot: 85000 NS
[2024-09-10 07:09:35] [Debug]  | bret: true
[2024-09-10 07:09:35] [Debug]  | Waiting 750 overshoot: 133500 NS
[2024-09-10 07:09:36] [Debug]  | bret: true
[2024-09-10 07:09:36] [Debug]  | Waiting 750 overshoot: 137600 NS
[2024-09-10 07:09:36] [Debug]  | bret: true
[2024-09-10 07:09:36] [Debug]  | Waiting 750 overshoot: 111800 NS
[2024-09-10 07:09:37] [Debug]  | bret: true
[2024-09-10 07:09:37] [Debug]  | Waiting 750 overshoot: 103100 NS
[2024-09-10 07:09:38] [Debug]  | bret: true
[2024-09-10 07:09:38] [Debug]  | Waiting 750 overshoot: 132100 NS
[2024-09-10 07:09:39] [Debug]  | bret: true
[2024-09-10 07:09:39] [Debug]  | Waiting 750 overshoot: 87900 NS
[2024-09-10 07:09:39] [Debug]  | bret: true
[2024-09-10 07:09:39] [Debug]  | Waiting 750 overshoot: 105000 NS
[2024-09-10 07:09:40] [Debug]  | Waiting 250 overshoot: 59100 NS
[2024-09-10 07:09:40] [Debug]  | Waiting 250 overshoot: 95000 NS
[2024-09-10 07:09:40] [Debug]  | Waiting 250 overshoot: 116100 NS
[2024-09-10 07:09:40] [Debug]  | Waiting 250 overshoot: 111600 NS
[2024-09-10 07:09:41] [Debug]  | Waiting 250 overshoot: 46600 NS
[2024-09-10 07:09:41] [Debug]  | Waiting 250 overshoot: 82300 NS
[2024-09-10 07:09:41] [Debug]  | Waiting 250 overshoot: 84700 NS
[2024-09-10 07:09:41] [Debug]  | Waiting 250 overshoot: 77400 NS
[2024-09-10 07:09:42] [Debug]  | Waiting 250 overshoot: 56500 NS
[2024-09-10 07:09:42] [Debug]  | Waiting 250 overshoot: 88500 NS
[2024-09-10 07:09:42] [Debug]  | Waiting 250 overshoot: 67100 NS
[2024-09-10 07:09:42] [Debug]  | Waiting 250 overshoot: 69200 NS
[2024-09-10 07:09:43] [Debug]  | Waiting 250 overshoot: 52500 NS
[2024-09-10 07:09:43] [Debug]  | Waiting 250 overshoot: 87300 NS
[2024-09-10 07:09:43] [Debug]  | Waiting 250 overshoot: 66600 NS
[2024-09-10 07:09:43] [Debug]  | Waiting 250 overshoot: 83700 NS
[2024-09-10 07:09:44] [Debug]  | Waiting 250 overshoot: 79700 NS
[2024-09-10 07:09:44] [Debug]  | Waiting 250 overshoot: 60300 NS
[2024-09-10 07:09:44] [Debug]  | Waiting 250 overshoot: 116800 NS
[2024-09-10 07:09:44] [Debug]  | Waiting 250 overshoot: 80500 NS
[2024-09-10 07:09:46] [Debug]  | Waiting 1250 overshoot: 75800 NS
[2024-09-10 07:09:47] [Debug]  | Waiting 1250 overshoot: 87500 NS
[2024-09-10 07:09:48] [Debug]  | Waiting 1250 overshoot: 5367700 NS
[2024-09-10 07:09:49] [Debug]  | Waiting 1250 overshoot: 103200 NS
[2024-09-10 07:09:51] [Debug]  | Waiting 1250 overshoot: 7424400 NS
[2024-09-10 07:09:52] [Debug]  | Waiting 1250 overshoot: 5281800 NS
[2024-09-10 07:09:53] [Debug]  | Waiting 1250 overshoot: 5673100 NS
[2024-09-10 07:09:54] [Debug]  | Waiting 1250 overshoot: 10185700 NS
[2024-09-10 07:09:55] [Debug]  | Waiting 1250 overshoot: 12369200 NS
[2024-09-10 07:09:57] [Debug]  | Waiting 1250 overshoot: 75800 NS
[2024-09-10 07:09:58] [Debug]  | Waiting 1250 overshoot: 96900 NS
[2024-09-10 07:09:59] [Debug]  | Waiting 1250 overshoot: 3663000 NS
[2024-09-10 07:10:00] [Debug]  | Waiting 1250 overshoot: 11713900 NS
[2024-09-10 07:10:02] [Debug]  | Waiting 1250 overshoot: 138500 NS
[2024-09-10 07:10:03] [Debug]  | Waiting 1250 overshoot: 9764800 NS
[2024-09-10 07:10:04] [Debug]  | Waiting 1250 overshoot: 8398700 NS
[2024-09-10 07:10:05] [Debug]  | Waiting 1250 overshoot: 8862000 NS
[2024-09-10 07:10:07] [Debug]  | Waiting 1250 overshoot: 3616900 NS
[2024-09-10 07:10:08] [Debug]  | Waiting 1250 overshoot: 6343400 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1250 overshoot: 9492100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 111900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 115700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 137100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 135000 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 219300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 127700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 87900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 862200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 107200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 80000 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 69800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 230000 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 72400 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 67100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 89000 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 80400 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 73200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 58100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 64100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 5 overshoot: 55700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 75100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 59900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 56100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 57300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 141700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 1089800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 183100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 328500 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 80200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 72200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 74800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 67900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 74000 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 65400 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 83400 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 85500 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 74600 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 73200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 79300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 10 overshoot: 74100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 77800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 93200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 71000 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 71300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 80700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 90700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 95200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 81500 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 79300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 90600 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 104000 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 99400 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 89600 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 106500 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 107800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 104300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 105300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 103900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 72900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 1 overshoot: 112300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 109600 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 112800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 75700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 103900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 104800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 109600 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 126700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 110700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 108500 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 96900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 111200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 118800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 115800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 137200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 65200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 233800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 106300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 126500 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 105100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting 2 overshoot: 104600 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 106300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 107200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 107000 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 102300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 97600 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 95800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 104800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 115900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 104900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 114200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 108900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 117400 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 106400 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 118400 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 348300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 113300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 125600 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 111800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 106300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .6 overshoot: 106700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 108000 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 82100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 116500 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 96500 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 99100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 78000 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 87500 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 103100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 99100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 114000 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 87800 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 101600 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 89300 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 76100 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 75700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 75900 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 90200 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 94700 NS
[2024-09-10 07:10:09] [Debug]  | Waiting .3 overshoot: 88000 NS
-----------------------------------------------------------------
[2024-09-10 07:16:32] [Debug]  | bret: true
[2024-09-10 07:16:32] [Debug]  | Waiting 750 overshoot: 65200 NS
[2024-09-10 07:16:33] [Debug]  | bret: true
[2024-09-10 07:16:33] [Debug]  | Waiting 750 overshoot: 73900 NS
[2024-09-10 07:16:34] [Debug]  | bret: true
[2024-09-10 07:16:34] [Debug]  | Waiting 750 overshoot: 66800 NS
[2024-09-10 07:16:34] [Debug]  | bret: true
[2024-09-10 07:16:34] [Debug]  | Waiting 750 overshoot: 63800 NS
[2024-09-10 07:16:35] [Debug]  | bret: true
[2024-09-10 07:16:35] [Debug]  | Waiting 750 overshoot: 84200 NS
[2024-09-10 07:16:36] [Debug]  | bret: true
[2024-09-10 07:16:36] [Debug]  | Waiting 750 overshoot: 138500 NS
[2024-09-10 07:16:37] [Debug]  | bret: true
[2024-09-10 07:16:37] [Debug]  | Waiting 750 overshoot: 85000 NS
[2024-09-10 07:16:37] [Debug]  | bret: true
[2024-09-10 07:16:37] [Debug]  | Waiting 750 overshoot: 71900 NS
[2024-09-10 07:16:38] [Debug]  | bret: true
[2024-09-10 07:16:38] [Debug]  | Waiting 750 overshoot: 81400 NS
[2024-09-10 07:16:39] [Debug]  | bret: true
[2024-09-10 07:16:39] [Debug]  | Waiting 750 overshoot: 65600 NS
[2024-09-10 07:16:40] [Debug]  | bret: true
[2024-09-10 07:16:40] [Debug]  | Waiting 750 overshoot: 60400 NS
[2024-09-10 07:16:40] [Debug]  | bret: true
[2024-09-10 07:16:40] [Debug]  | Waiting 750 overshoot: 77400 NS
[2024-09-10 07:16:41] [Debug]  | bret: true
[2024-09-10 07:16:41] [Debug]  | Waiting 750 overshoot: 81500 NS
[2024-09-10 07:16:42] [Debug]  | bret: true
[2024-09-10 07:16:42] [Debug]  | Waiting 750 overshoot: 91600 NS
[2024-09-10 07:16:43] [Debug]  | bret: true
[2024-09-10 07:16:43] [Debug]  | Waiting 750 overshoot: 148500 NS
[2024-09-10 07:16:43] [Debug]  | bret: true
[2024-09-10 07:16:43] [Debug]  | Waiting 750 overshoot: 75600 NS
[2024-09-10 07:16:44] [Debug]  | bret: true
[2024-09-10 07:16:44] [Debug]  | Waiting 750 overshoot: 112200 NS
[2024-09-10 07:16:45] [Debug]  | bret: true
[2024-09-10 07:16:45] [Debug]  | Waiting 750 overshoot: 102700 NS
[2024-09-10 07:16:46] [Debug]  | bret: true
[2024-09-10 07:16:46] [Debug]  | Waiting 750 overshoot: 103700 NS
[2024-09-10 07:16:46] [Debug]  | Waiting 250 overshoot: 96700 NS
[2024-09-10 07:16:46] [Debug]  | Waiting 250 overshoot: 101500 NS
[2024-09-10 07:16:46] [Debug]  | Waiting 250 overshoot: 59100 NS
[2024-09-10 07:16:47] [Debug]  | Waiting 250 overshoot: 73500 NS
[2024-09-10 07:16:47] [Debug]  | Waiting 250 overshoot: 89700 NS
[2024-09-10 07:16:47] [Debug]  | Waiting 250 overshoot: 65900 NS
[2024-09-10 07:16:47] [Debug]  | Waiting 250 overshoot: 53600 NS
[2024-09-10 07:16:48] [Debug]  | Waiting 250 overshoot: 117200 NS
[2024-09-10 07:16:48] [Debug]  | Waiting 250 overshoot: 133600 NS
[2024-09-10 07:16:48] [Debug]  | Waiting 250 overshoot: 65700 NS
[2024-09-10 07:16:48] [Debug]  | Waiting 250 overshoot: 60900 NS
[2024-09-10 07:16:49] [Debug]  | Waiting 250 overshoot: 76400 NS
[2024-09-10 07:16:49] [Debug]  | Waiting 250 overshoot: 77000 NS
[2024-09-10 07:16:49] [Debug]  | Waiting 250 overshoot: 115700 NS
[2024-09-10 07:16:49] [Debug]  | Waiting 250 overshoot: 45000 NS
[2024-09-10 07:16:50] [Debug]  | Waiting 250 overshoot: 73000 NS
[2024-09-10 07:16:50] [Debug]  | Waiting 250 overshoot: 75400 NS
[2024-09-10 07:16:50] [Debug]  | Waiting 250 overshoot: 95300 NS
[2024-09-10 07:16:50] [Debug]  | Waiting 250 overshoot: 164200 NS
[2024-09-10 07:16:51] [Debug]  | Waiting 250 overshoot: 97600 NS
[2024-09-10 07:16:52] [Debug]  | Waiting 1250 overshoot: 274900 NS
[2024-09-10 07:16:53] [Debug]  | Waiting 1250 overshoot: 121300 NS
[2024-09-10 07:16:54] [Debug]  | Waiting 1250 overshoot: 61100 NS
[2024-09-10 07:16:55] [Debug]  | Waiting 1250 overshoot: 172200 NS
[2024-09-10 07:16:57] [Debug]  | Waiting 1250 overshoot: 75700 NS
[2024-09-10 07:16:58] [Debug]  | Waiting 1250 overshoot: 218500 NS
[2024-09-10 07:16:59] [Debug]  | Waiting 1250 overshoot: 172700 NS
[2024-09-10 07:17:00] [Debug]  | Waiting 1250 overshoot: 87200 NS
[2024-09-10 07:17:02] [Debug]  | Waiting 1250 overshoot: 197300 NS
[2024-09-10 07:17:03] [Debug]  | Waiting 1250 overshoot: 213600 NS
[2024-09-10 07:17:04] [Debug]  | Waiting 1250 overshoot: 388600 NS
[2024-09-10 07:17:05] [Debug]  | Waiting 1250 overshoot: 85200 NS
[2024-09-10 07:17:07] [Debug]  | Waiting 1250 overshoot: 91900 NS
[2024-09-10 07:17:08] [Debug]  | Waiting 1250 overshoot: 176100 NS
[2024-09-10 07:17:09] [Debug]  | Waiting 1250 overshoot: 7844400 NS
[2024-09-10 07:17:10] [Debug]  | Waiting 1250 overshoot: 145600 NS
[2024-09-10 07:17:11] [Debug]  | Waiting 1250 overshoot: 61100 NS
[2024-09-10 07:17:13] [Debug]  | Waiting 1250 overshoot: 94400 NS
[2024-09-10 07:17:14] [Debug]  | Waiting 1250 overshoot: 94400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1250 overshoot: 101800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 81100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 96800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 97500 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 43600 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 60000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 62400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 74500 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 96600 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 93800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 74500 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 87900 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 102600 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 61600 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 55200 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 57200 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 83600 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 53300 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 56000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 58900 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 5 overshoot: 91000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 96500 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 51900 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 322800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 82600 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 140300 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 334400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 317200 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 110800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 318200 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 102800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 141000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 84000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 190100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 69100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 104300 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 84500 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 123400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 77500 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 57300 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 10 overshoot: 59000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 41000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 31900 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 86100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 54100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 201000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 43800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 47300 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 62900 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 56000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 58700 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 40900 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 55800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 57500 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 33900 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 39100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 40500 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 40100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 65400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 77500 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 1 overshoot: 27000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 57700 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 50100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 63100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 62400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 74200 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 59000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 39000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 56700 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 67200 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 445400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 60900 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 46600 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 48800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 39400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 35000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 52400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 41100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 38000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 36000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting 2 overshoot: 41400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 36800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 36900 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 30400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 61000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 36800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 48700 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 30000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 31400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 41100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 25700 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 37900 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 36700 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 31300 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 30700 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 27600 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 29200 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 28600 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 28800 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 47200 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .6 overshoot: 28300 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 28900 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 29700 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 28700 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 28000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 27400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 28100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 26100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 28100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 28000 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 29200 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 29700 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 29300 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 27100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 26600 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 28100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 28200 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 27300 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 27400 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 30100 NS
[2024-09-10 07:17:15] [Debug]  | Waiting .3 overshoot: 35100 NS
2024-09-10 08:17:32 +01:00

1099 lines
42 KiB
C++

/***
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuProcAddresses.NT.cpp
Date: 2023-2-16
Author: Reece
***/
#include <AuroraEnvironment.h>
#if defined(AURORA_PLATFORM_WIN32)
#define _WIN32_WINNT 0x0602
#endif
#include <RuntimeInternal.hpp>
#include "Source/Threading/Primitives/AuConditionMutex.NT.hpp"
#define AURORA_HAS_LOAD_PGKD
#define AURORA_HAS_GET_PROC_NONWIN32
#if !defined(AURORA_RUNITIME_NO_PROFILE_SYMBOL)
extern "C"
{
// As much as I despise third-party drivers matching module names and pattern matching,
// we may as well provide some hint for:
// * Windows emulators
// * Future first party win32 compatibility layers
// * Drivers checking for the vintage
// * Non-standard PE linkers (Aurora::AddBlockedDLL(...) is valid)
AUKN_SYM int NT_APPLICATION_COMPAT_AURORA_RUNTIME_ALPHA;
AUKN_SYM int NT_APPLICATION_COMPAT_AURORA_RUNTIME;
}
#endif
namespace Aurora::Memory
{
AuUInt32 RoundPageUp(AuUInt32 value);
}
namespace Aurora
{
static bool gShouldResPathDoNothing {}; // always
static bool gShouldResPathDoNothing2 {}; // win11 singleshot
static ULONG gLastActualResolution {};
#if !defined(AURORA_PLATFORM_WIN32)
HMODULE UWPLibraryW(LPCWSTR lpLibFileName);
FARPROC UWPProcAddress(HMODULE hModule,
LPCSTR lpProcName);
HANDLE __stdcall UWPCreateFileMappingA(HANDLE hFile,
LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
DWORD flProtect,
DWORD dwMaximumSizeHigh,
DWORD dwMaximumSizeLow,
LPCSTR lpName);
HANDLE __stdcall UWPOpenFileMappingA(DWORD dwDesiredAccess,
BOOL bInheritHandle,
LPCSTR lpName);
LPVOID __stdcall UWPMapViewOfFile(HANDLE hFileMappingObject,
DWORD dwDesiredAccess,
DWORD dwFileOffsetHigh,
DWORD dwFileOffsetLow,
SIZE_T dwNumberOfBytesToMap);
#endif
#if !defined(AURORA_DLL_BLACKLIST)
static AuUInt32 gBlockedDLLTable[128] {};
#else
static AuUInt32 gBlockedDLLTable[128] { AURORA_DLL_BLACKLIST };
#endif
AUKN_SYM bool AddBlockedDLL(const char *pString)
{
if (!pString)
{
return false;
}
auto uHash = AuFnv1a32Runtime(pString, strlen(pString));
for (AU_ITERATE_N(i, AuArraySize(gBlockedDLLTable)))
{
if (gBlockedDLLTable[i])
{
continue;
}
gBlockedDLLTable[i] = uHash;
return true;
}
return false;
}
static bool IsBlocked(const char *pString)
{
auto uHash = AuFnv1a32Runtime(pString, strlen(pString));
for (AU_ITERATE_N(i, AuArraySize(gBlockedDLLTable)))
{
auto uCurrent = gBlockedDLLTable[i];
if (uCurrent == uHash)
{
return true;
}
else if (uCurrent == 0)
{
return false;
}
}
return false;
}
void InitNTAddressesForClock()
{
#if defined(AURORA_PLATFORM_WIN32)
// We just need a partial AuSwInfo pass to work in order to setup the clocks at TLS callback-time
// Why? rng isnt ready either. We need the fallback clock to work.
pLoadLibraryW = LoadLibraryW;
pGetProcAddress = GetProcAddress;
#define ADD_LOAD_LIB(name) \
HMODULE h ## name {}; \
h ## name = GetModuleHandleW(k## name ## DllName); \
if (!h ## name) \
{ \
h ## name = pLoadLibraryW(k## name ## DllName); \
} \
#define ADD_GET_PROC(name, proc) \
if (h ## name) \
{ \
p ## proc = AuReinterpretCast<decltype(p ## proc)>(pGetProcAddress(h ## name, #proc)); \
} \
ADD_LOAD_LIB(Kernel32);
#if 0
ADD_LOAD_LIB(AdvancedApi);
#endif
ADD_GET_PROC(Kernel32, VerifyVersionInfoW)
ADD_GET_PROC(Kernel32, VerSetConditionMask)
ADD_GET_PROC(Kernel32, QueryPerformanceCounter)
ADD_GET_PROC(Kernel32, QueryPerformanceFrequency)
#if 0
ADD_GET_PROC(AdvancedApi, RegSetValueExW)
ADD_GET_PROC(AdvancedApi, RegCloseKey)
ADD_GET_PROC(AdvancedApi, RegOpenKeyExW)
ADD_GET_PROC(AdvancedApi, RegQueryValueExW)
#endif
#undef ADD_GET_PROC
#undef ADD_LOAD_LIB
#else
InitNTAddresses();
#endif
}
void InitNTAddresses()
{
#if defined(AURORA_PLATFORM_WIN32)
pLoadLibraryW = LoadLibraryW;
pGetProcAddress = GetProcAddress;
#define ADD_LOAD_LIB(name) \
\
HMODULE h ## name {}; \
if (!IsBlocked(#name)) \
{ \
h ## name = GetModuleHandleW(k## name ## DllName); \
if (!h ## name) \
{ \
h ## name = pLoadLibraryW(k## name ## DllName); \
} \
}
ADD_LOAD_LIB(Kernel32);
ADD_LOAD_LIB(Nt);
ADD_LOAD_LIB(KernelBase);
ADD_LOAD_LIB(Sync);
ADD_LOAD_LIB(WS2);
ADD_LOAD_LIB(AdvancedApi);
ADD_LOAD_LIB(BCrypt);
ADD_LOAD_LIB(Theme);
ADD_LOAD_LIB(Shell);
ADD_LOAD_LIB(PSAPILegacy);
ADD_LOAD_LIB(DbgHelper);
ADD_LOAD_LIB(WinTrust);
ADD_LOAD_LIB(IPHelper);
ADD_LOAD_LIB(COM);
ADD_LOAD_LIB(User32);
ADD_LOAD_LIB(SetupAPI);
ADD_LOAD_LIB(Router);
ADD_LOAD_LIB(CredUI);
#define ADD_GET_PROC(name, proc) \
if (!IsBlocked(#proc)) \
{ \
if (h ## name) \
{ \
p ## proc = AuReinterpretCast<decltype(p ## proc)>(pGetProcAddress(h ## name, #proc)); \
} \
}
#define ADD_GET_PROC_BI(name, name2, proc) \
if (!IsBlocked(#proc)) \
{ \
p ## proc = nullptr; \
if (h ## name) \
{ \
p ## proc = AuReinterpretCast<decltype(p ## proc)>(pGetProcAddress(h ## name, #proc)); \
} \
if (!p ## proc) \
{ \
if (h ## name2) \
{ \
p ## proc = AuReinterpretCast<decltype(p ## proc)>(pGetProcAddress(h ## name2, #proc));\
} \
} \
}
#define ADD_GET_PROC_BI2(name, name2, proc, proc2) \
if (!IsBlocked(#proc)) \
{ \
p ## proc2 = nullptr; \
if (h ## name) \
{ \
p ## proc2 = AuReinterpretCast<decltype(p ## proc2)>(pGetProcAddress(h ## name, #proc)); \
} \
if (!p ## proc2) \
{ \
if (h ## name2) \
{ \
p ## proc2 = AuReinterpretCast<decltype(p ## proc2)>(pGetProcAddress(h ## name2, #proc2)); \
} \
} \
}
#define ADD_GET_PROC_INTERNAL_MAP(name, proc, symbol) \
if (!IsBlocked(#proc)) \
{ \
if (h ## name) \
{ \
p ## proc = AuReinterpretCast<decltype(p ## proc)>(pGetProcAddress(h ## name, #symbol)); \
} \
}
if (pRtlGetVersion)
{
return;
}
ADD_GET_PROC(Nt, RtlGetVersion)
ADD_GET_PROC(Nt, NtDelayExecution)
ADD_GET_PROC(Nt, NtWaitForKeyedEvent)
ADD_GET_PROC(Nt, NtReleaseKeyedEvent)
ADD_GET_PROC(Nt, NtOpenKeyedEvent)
ADD_GET_PROC(Nt, NtCreateKeyedEvent)
ADD_GET_PROC(Nt, RtlWaitOnAddress)
ADD_GET_PROC(Nt, RtlWakeByAddressAll)
ADD_GET_PROC(Nt, RtlWakeAddressSingle)
ADD_GET_PROC(Nt, ZwSetTimerResolution)
ADD_GET_PROC(Nt, ZwQueryTimerResolution)
ADD_GET_PROC(Nt, NtQueryInformationProcess)
ADD_GET_PROC(Nt, NtNotifyChangeDirectoryFile)
ADD_GET_PROC(Nt, NtTerminateProcess)
ADD_GET_PROC(Nt, NtQuerySymbolicLinkObject)
ADD_GET_PROC(Nt, NtOpenSymbolicLinkObject)
ADD_GET_PROC(Nt, NtWaitForMultipleObjects)
ADD_GET_PROC(Nt, NtQuerySystemInformation)
ADD_GET_PROC_BI(Kernel32, KernelBase, VirtualAlloc2)
ADD_GET_PROC_BI(Kernel32, KernelBase, MapViewOfFile)
ADD_GET_PROC_BI(Kernel32, KernelBase, MapViewOfFile3)
ADD_GET_PROC_BI(Kernel32, KernelBase, UnmapViewOfFile2)
ADD_GET_PROC_BI(Kernel32, KernelBase, CreateFileW)
ADD_GET_PROC_BI(Kernel32, KernelBase, CreateFile2W)
ADD_GET_PROC_BI(Kernel32, KernelBase, GetTempPathW)
ADD_GET_PROC_BI(Kernel32, KernelBase, CreateFileMappingA)
ADD_GET_PROC_BI(Kernel32, KernelBase, OpenFileMappingA)
ADD_GET_PROC(Kernel32, GetSystemCpuSetInformation)
ADD_GET_PROC(Kernel32, GetLogicalProcessorInformation)
ADD_GET_PROC(Kernel32, SetThreadDescription)
ADD_GET_PROC(Kernel32, SetThreadInformation)
ADD_GET_PROC(Kernel32, SetThreadSelectedCpuSets)
ADD_GET_PROC(Kernel32, PrefetchVirtualMemory)
ADD_GET_PROC(Kernel32, SetThreadGroupAffinity)
ADD_GET_PROC(Kernel32, FindFirstStreamW)
ADD_GET_PROC(Kernel32, FindNextStreamW)
ADD_GET_PROC(Kernel32, FindClose)
ADD_GET_PROC(Kernel32, CancelIoEx)
ADD_GET_PROC(Kernel32, CancelSynchronousIo)
ADD_GET_PROC(Kernel32, SetFileInformationByHandle)
ADD_GET_PROC(Kernel32, GetLocaleInfoEx)
ADD_GET_PROC(Kernel32, LCIDToLocaleName)
ADD_GET_PROC(Kernel32, GetLocaleInfoW)
ADD_GET_PROC(Kernel32, GetThreadId)
ADD_GET_PROC(Kernel32, VerifyVersionInfoW)
ADD_GET_PROC(Kernel32, VerSetConditionMask)
ADD_GET_PROC(Kernel32, QueryPerformanceCounter)
ADD_GET_PROC(Kernel32, QueryPerformanceFrequency)
ADD_GET_PROC(Kernel32, RemoveDllDirectory)
ADD_GET_PROC(Kernel32, AddDllDirectory)
ADD_GET_PROC(Kernel32, SetProcessInformation)
ADD_GET_PROC(Kernel32, GetNamedPipeClientProcessId)
ADD_GET_PROC(Kernel32, Module32FirstW)
ADD_GET_PROC(Kernel32, Module32NextW)
ADD_GET_PROC(Kernel32, CreateJobObjectW)
ADD_GET_PROC(Kernel32, CreateWaitableTimerExW)
ADD_GET_PROC(Kernel32, GetConsoleScreenBufferInfo)
ADD_GET_PROC(Kernel32, SetConsoleScreenBufferSize)
ADD_GET_PROC(Kernel32, SetConsoleWindowInfo)
ADD_GET_PROC(Kernel32, CreateConsoleScreenBuffer)
ADD_GET_PROC(Kernel32, SetConsoleCursorPosition)
ADD_GET_PROC(Kernel32, FillConsoleOutputCharacterW)
ADD_GET_PROC(Kernel32, FillConsoleOutputAttribute)
ADD_GET_PROC(Kernel32, SetConsoleTextAttribute)
ADD_GET_PROC(Kernel32, SetConsoleActiveScreenBuffer)
ADD_GET_PROC(Kernel32, ScrollConsoleScreenBufferW)
ADD_GET_PROC(Kernel32, WriteConsoleInputW)
ADD_GET_PROC(Kernel32, WriteConsoleW)
ADD_GET_PROC(Kernel32, ReadConsoleInputW)
ADD_GET_PROC(Kernel32, GetNumberOfConsoleInputEvents)
ADD_GET_PROC_BI2(Kernel32, PSAPILegacy, K32GetProcessMemoryInfo, GetProcessMemoryInfo)
ADD_GET_PROC(Sync, WaitOnAddress)
ADD_GET_PROC(Sync, WakeByAddressSingle)
ADD_GET_PROC(Sync, WakeByAddressAll)
ADD_GET_PROC(DbgHelper, UnDecorateSymbolName)
ADD_GET_PROC(DbgHelper, MiniDumpWriteDump)
ADD_GET_PROC(DbgHelper, SymInitialize)
ADD_GET_PROC(DbgHelper, SymGetModuleBase64)
ADD_GET_PROC(DbgHelper, SymGetLineFromAddr64)
ADD_GET_PROC(DbgHelper, SymFunctionTableAccess64)
ADD_GET_PROC(DbgHelper, StackWalk64)
ADD_GET_PROC(WS2, GetAddrInfoExW)
ADD_GET_PROC(WS2, GetAddrInfoExCancel)
ADD_GET_PROC(WS2, FreeAddrInfoExW)
ADD_GET_PROC(WS2, getaddrinfo)
ADD_GET_PROC(WS2, freeaddrinfo)
ADD_GET_PROC(WS2, listen)
ADD_GET_PROC(WS2, bind)
ADD_GET_PROC(WS2, closesocket)
ADD_GET_PROC(WS2, shutdown)
ADD_GET_PROC(WS2, getpeername)
ADD_GET_PROC(WS2, getsockname)
ADD_GET_PROC(WS2, ioctlsocket)
ADD_GET_PROC(WS2, setsockopt)
ADD_GET_PROC(WS2, WSAStartup)
ADD_GET_PROC(WS2, WSAIoctl)
ADD_GET_PROC(WS2, WSAGetLastError)
ADD_GET_PROC(WS2, WSASocketW)
ADD_GET_PROC(WS2, WSARecvFrom)
ADD_GET_PROC(WS2, WSARecv)
ADD_GET_PROC(WS2, WSASendTo)
ADD_GET_PROC(WS2, WSASend)
ADD_GET_PROC(WS2, WSAStringToAddressA)
ADD_GET_PROC(WinTrust, WinVerifyTrust)
ADD_GET_PROC(IPHelper, GetAdaptersAddresses)
ADD_GET_PROC(IPHelper, GetAdaptersInfo)
ADD_GET_PROC(AdvancedApi, CryptAcquireContextW)
ADD_GET_PROC(AdvancedApi, CryptReleaseContext)
ADD_GET_PROC(AdvancedApi, CryptGenRandom)
ADD_GET_PROC(AdvancedApi, RegSetValueExW)
ADD_GET_PROC(AdvancedApi, RegCloseKey)
ADD_GET_PROC(AdvancedApi, RegOpenKeyExW)
ADD_GET_PROC(AdvancedApi, RegQueryValueExW)
ADD_GET_PROC(AdvancedApi, DeregisterEventSource)
ADD_GET_PROC(AdvancedApi, RegisterEventSourceW)
ADD_GET_PROC(AdvancedApi, ReportEventW)
ADD_GET_PROC(AdvancedApi, SetEntriesInAclA)
ADD_GET_PROC(AdvancedApi, AllocateAndInitializeSid)
ADD_GET_PROC(AdvancedApi, SetNamedSecurityInfoW)
ADD_GET_PROC(AdvancedApi, FreeSid)
// privilege escalation
ADD_GET_PROC(AdvancedApi, CreateProcessWithLogonW);
ADD_GET_PROC(AdvancedApi, CreateProcessAsUserW);
ADD_GET_PROC(AdvancedApi, AdjustTokenPrivileges);
ADD_GET_PROC(AdvancedApi, RevertToSelf);
ADD_GET_PROC(AdvancedApi, SetTokenInformation);
ADD_GET_PROC(AdvancedApi, GetSidSubAuthorityCount);
ADD_GET_PROC(AdvancedApi, GetSidSubAuthority);
ADD_GET_PROC(AdvancedApi, LogonUserW);
ADD_GET_PROC(AdvancedApi, OpenProcessToken);
ADD_GET_PROC(AdvancedApi, SetThreadToken);
ADD_GET_PROC(AdvancedApi, SetSecurityInfo);
ADD_GET_PROC(AdvancedApi, GetUserNameW);
ADD_GET_PROC(AdvancedApi, DuplicateTokenEx);
ADD_GET_PROC(AdvancedApi, LookupAccountSidW);
ADD_GET_PROC(AdvancedApi, GetTokenInformation);
ADD_GET_PROC(AdvancedApi, SetSecurityDescriptorDacl);
ADD_GET_PROC(AdvancedApi, InitializeSecurityDescriptor);
ADD_GET_PROC(AdvancedApi, LookupAccountNameW);
ADD_GET_PROC(AdvancedApi, LookupPrivilegeValueA);
ADD_GET_PROC(AdvancedApi, LsaOpenPolicy);
ADD_GET_PROC(AdvancedApi, LsaClose);
ADD_GET_PROC(AdvancedApi, LsaAddAccountRights);
ADD_GET_PROC_INTERNAL_MAP(AdvancedApi, RtlGenRandom, SystemFunction036)
ADD_GET_PROC(BCrypt, BCryptGenRandom)
ADD_GET_PROC(Theme, SetWindowTheme)
ADD_GET_PROC(COM, CoInitializeEx)
ADD_GET_PROC(COM, CoUninitialize)
ADD_GET_PROC(COM, CoTaskMemFree)
ADD_GET_PROC(Shell, SHGetKnownFolderPath)
ADD_GET_PROC(Shell, SHGetFolderPathA)
ADD_GET_PROC(Shell, CommandLineToArgvW)
ADD_GET_PROC(Shell, ShellExecuteW)
ADD_GET_PROC(User32, GetClipboardData);
ADD_GET_PROC(User32, MapVirtualKeyA);
ADD_GET_PROC(User32, CloseClipboard);
ADD_GET_PROC(User32, GetWindowThreadProcessId);
ADD_GET_PROC(User32, SendMessageA);
ADD_GET_PROC(User32, EnumThreadWindows);
ADD_GET_PROC(User32, DispatchMessageW);
ADD_GET_PROC(User32, TranslateMessage);
ADD_GET_PROC(User32, MsgWaitForMultipleObjectsEx);
ADD_GET_PROC(User32, MsgWaitForMultipleObjects);
ADD_GET_PROC(User32, PeekMessageW);
ADD_GET_PROC(User32, SetPropW);
ADD_GET_PROC(User32, OpenClipboard);
ADD_GET_PROC(SetupAPI, SetupDiEnumDeviceInterfaces);
ADD_GET_PROC(SetupAPI, SetupDiDestroyDeviceInfoList);
ADD_GET_PROC(SetupAPI, SetupDiGetClassDevsW);
ADD_GET_PROC(SetupAPI, SetupDiGetDeviceRegistryPropertyA);
ADD_GET_PROC(SetupAPI, SetupDiGetDeviceInterfaceDetailW);
ADD_GET_PROC(Router, WNetCloseEnum);
ADD_GET_PROC(Router, WNetEnumResourceW);
ADD_GET_PROC(Router, WNetOpenEnumW);
ADD_GET_PROC(Router, WNetGetUniversalNameW);
ADD_GET_PROC(CredUI, CredUIPromptForWindowsCredentialsW);
ADD_GET_PROC(CredUI, CredUnPackAuthenticationBufferW);
if (pNtCreateKeyedEvent &&
Threading::Primitives::gKeyedEventHandle == INVALID_HANDLE_VALUE)
{
if (!gUseNativeWaitCondvar)
{
SysAssert(pNtCreateKeyedEvent);
pNtCreateKeyedEvent(&Threading::Primitives::gKeyedEventHandle, -1, NULL, 0);
}
}
#else
pLoadLibraryW = UWPLibraryW;
pGetProcAddress = UWPProcAddress;
pCreateFile2W = CreateFile2FromAppW;
pCreateFileMappingFromApp = CreateFileMappingFromApp;
pOpenFileMappingFromApp = OpenFileMappingFromApp;
pMapViewOfFileFromApp = MapViewOfFileFromApp;
pCreateFileMappingA = UWPCreateFileMappingA;
pOpenFileMappingA = UWPOpenFileMappingA;
pMapViewOfFile = UWPMapViewOfFile;
pWaitOnAddress = WaitOnAddress;
pWakeByAddressSingle = WakeByAddressSingle;
pWakeByAddressAll = WakeByAddressAll;
pVirtualAlloc2 = VirtualAlloc2FromApp;
pMapViewOfFile3 = MapViewOfFile3FromApp;
pCancelIoEx = CancelIoEx;
pCancelSynchronousIo = CancelSynchronousIo;
pGetLocaleInfoEx = GetLocaleInfoEx;
pLCIDToLocaleName = LCIDToLocaleName;
pSetFileInformationByHandle = SetFileInformationByHandle;
pFindClose = FindClose;
pGetTempPathW = GetTempPath2W;
pGetSystemCpuSetInformation = GetSystemCpuSetInformation;
pGetLogicalProcessorInformation = GetLogicalProcessorInformation;
pSetThreadInformation = SetThreadInformation;
pSetThreadDescription = SetThreadDescription;
pSetThreadSelectedCpuSets = SetThreadSelectedCpuSets;
pGetAddrInfoExCancel = GetAddrInfoExCancel;
pPrefetchVirtualMemory = PrefetchVirtualMemory;
pQueryPerformanceCounter = decltype(pQueryPerformanceCounter)(QueryPerformanceCounter);
pQueryPerformanceFrequency = decltype(pQueryPerformanceFrequency)(QueryPerformanceFrequency);
// https://github.com/LWJGL/lwjgl3/blob/master/modules/lwjgl/remotery/src/main/c/Remotery.c#L1188
// Xbox main SDK has a better API we should use
// So...
// TODO: Xbox One and later: https://github.com/microsoft/Xbox-ATG-Samples/blob/main/XDKSamples/Graphics/AdvancedESRAM12/PageAllocator.cpp#L193-L206
// Require AuProcess for that given target
pUnmapViewOfFile2 = UnmapViewOfFile2; // < isn't portable but
// "This topic lists the Win32 APIs that are part of the Universal Windows Platform (UWP) and that are implemented by all Windows 10 devices."
// UnmapViewOfFile2 -> Introduced into api-ms-win-core-memory-l1-1-5.dll in 10.0.17134.
pNtDelayExecution = nullptr /* ... (you dont need it, but it'll help a ton for SleepNs) */;
pGetAddrInfoExW = GetAddrInfoExW;
pGetAddrInfoExCancel = GetAddrInfoExCancel;
pFreeAddrInfoExW = FreeAddrInfoExW;
pgetaddrinfo = getaddrinfo;
pfreeaddrinfo = freeaddrinfo;
plisten = listen;
pbind = bind;
pclosesocket = closesocket;
pshutdown = shutdown;
pgetpeername = getpeername;
pgetsockname = getsockname;
pioctlsocket = ioctlsocket;
psetsockopt = setsockopt;
pWSAStartup = WSAStartup;
pWSAIoctl = WSAIoctl;
pWSAGetLastError = WSAGetLastError;
pWSASocketW = WSASocketW;
pWSARecvFrom = WSARecvFrom;
pWSARecv = WSARecv;
pWSASendTo = WSASendTo;
pWSASend = WSASend;
pWSAStringToAddressA = WSAStringToAddressA;
#endif
gUseNativeWaitMutex = (pWaitOnAddress &&
!gRuntimeConfig.threadingConfig.bPreferNt51XpMutexesOver8 &&
(pRtlWaitOnAddress || AuBuild::kCurrentPlatform != AuBuild::EPlatform::ePlatformWin32)) ||
!pNtWaitForKeyedEvent;
gUseNativeWaitCondvar = (pWaitOnAddress &&
!gRuntimeConfig.threadingConfig.bPreferNt51XpCondvarsOver8 &&
(pRtlWaitOnAddress || AuBuild::kCurrentPlatform != AuBuild::EPlatform::ePlatformWin32)) ||
!pNtWaitForKeyedEvent;
gUseNativeWaitSemapahore = bool(pWaitOnAddress);
}
static bool IsNetbookXpOrWin7Laptop()
{
return bool(GetEnvironmentVariableW(L"AURORA_IS_NETBOOK", nullptr, 0));
}
void Win32DropSchedulerResolutionNow();
void Win32DropInit()
{
gShouldResPathDoNothing =
(AuBuild::kCurrentPlatform != AuBuild::EPlatform::ePlatformWin32) ||
(!gRuntimeConfig.threadingConfig.bEnableAggressiveScheduling &&
AuSwInfo::IsWindows10OrGreater()) ||
IsNetbookXpOrWin7Laptop();
gUseFastFail = AuSwInfo::IsWindows8Point1OrGreater()
#if defined(PF_FASTFAIL_AVAILABLE)
&& ::IsProcessorFeaturePresent(PF_FASTFAIL_AVAILABLE)
#endif
;
gShouldResPathDoNothing2 = gShouldResPathDoNothing;
if (gShouldResPathDoNothing)
{
return;
}
#if defined(PROCESS_POWER_THROTTLING_CURRENT_VERSION)
if (pSetProcessInformation &&
AuSwInfo::IsWindows10OrGreater())
{
static AuInitOnceSmall gInitOnce;
if (AuThreading::InitOnceLocker::TryLock(&gInitOnce))
{
PROCESS_POWER_THROTTLING_STATE powerThrottling {};
powerThrottling.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
powerThrottling.ControlMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED;
powerThrottling.StateMask = 0;
gShouldResPathDoNothing2 = bool(pSetProcessInformation(GetCurrentProcess(),
ProcessPowerThrottling,
&powerThrottling,
sizeof(powerThrottling)));
powerThrottling.ControlMask = PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION;
powerThrottling.StateMask = 0;
gShouldResPathDoNothing2 &= bool(pSetProcessInformation(GetCurrentProcess(),
ProcessPowerThrottling,
&powerThrottling,
sizeof(powerThrottling)));
if (!gShouldResPathDoNothing2 &&
(AuSWInfo::IsWindows11OrGreater() || AuSwInfo::IsWindows10Milestone20H1OrGreater()))
{
Win32DropSchedulerResolutionNow();
}
else
{
gShouldResPathDoNothing2 = false;
}
AuThreading::InitOnceLocker::Finish(&gInitOnce);
} /* else no-wait. intentionally nop*/
}
#endif
}
void Win32DropSchedulerResolutionForced()
{
ULONG ullActualResolution {};
if (!gShouldResPathDoNothing)
{
Win32DropSchedulerResolution();
return;
}
if (pZwQueryTimerResolution)
{
static AuInitOnce gInitOnce;
gInitOnce.Call([]()
{
ULONG IDC[2];
pZwQueryTimerResolution(&IDC[0], &IDC[1], &gLastActualResolution);
});
}
}
void Win32DropSchedulerResolutionNow()
{
ULONG ullActualResolution {};
if (!pZwSetTimerResolution)
{
return;
}
auto uRet = pZwSetTimerResolution(1, true, &ullActualResolution);
if (uRet == 0)
{
return;
}
else if (uRet == 0xC0000245)
{
if ((uRet = pZwSetTimerResolution(5'000, true, &ullActualResolution)) == 0)
{
return;
}
}
}
void Win32DropSchedulerResolutionForcedUndo()
{
ULONG ullActualResolution {};
if (!gShouldResPathDoNothing ||
!pZwSetTimerResolution ||
!gLastActualResolution)
{
return;
}
(void)pZwSetTimerResolution(gLastActualResolution, true, &ullActualResolution);
}
void Win32DropSchedulerResolution()
{
ULONG ullActualResolution {};
if (gShouldResPathDoNothing2)
{
return;
}
if (gRuntimeConfig.threadingConfig.bEnableAgrSchedulingRatelimit)
{
static Aurora::Utility::RateLimiter limiter;
if (!limiter.nsTimeStep)
{
limiter.SetNextStep(AuMSToNS<AuUInt64>(gRuntimeConfig.threadingConfig.bWinXpThrough7BlazeOptimizerPower));
}
else if (!limiter.CheckExchangePass())
{
return;
}
}
Win32DropSchedulerResolutionNow();
}
HANDLE UWPCreateFileMappingA(HANDLE hFile,
LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
DWORD flProtect,
DWORD dwMaximumSizeHigh,
DWORD dwMaximumSizeLow,
LPCSTR lpName)
{
auto uSize = AuUInt64(AuUInt64(dwMaximumSizeHigh) << 32ull) |
AuUInt64(dwMaximumSizeLow);
if (!uSize && SysHandleIsNonZero(AuUInt(hFile)))
{
uSize = SysGetFileLength(AuUInt(hFile));
}
if (!pCreateFileMappingFromApp)
{
return NULL;
}
return pCreateFileMappingFromApp(hFile,
lpFileMappingAttributes,
flProtect,
uSize,
lpName ? AuLocale::ConvertFromUTF8(lpName).c_str() : nullptr);
}
HANDLE UWPOpenFileMappingA(DWORD dwDesiredAccess,
BOOL bInheritHandle,
LPCSTR lpName)
{
if (!pOpenFileMappingFromApp)
{
return NULL;
}
return pOpenFileMappingFromApp(dwDesiredAccess,
bInheritHandle,
lpName ? AuLocale::ConvertFromUTF8(lpName).c_str() : nullptr);
}
LPVOID UWPMapViewOfFile(HANDLE hFileMappingObject,
DWORD dwDesiredAccess,
DWORD dwFileOffsetHigh,
DWORD dwFileOffsetLow,
SIZE_T dwNumberOfBytesToMap)
{
if (!pMapViewOfFileFromApp)
{
return NULL;
}
return pMapViewOfFileFromApp(hFileMappingObject,
dwDesiredAccess,
AuUInt64(AuUInt64(dwFileOffsetHigh) << 32ull) | AuUInt64(dwFileOffsetLow),
dwNumberOfBytesToMap);
}
void Win32Terminate()
{
if (gUseFastFail)
{
__fastfail('fokd');
}
else
{
if (pNtTerminateProcess)
{
pNtTerminateProcess((HANDLE)-1, 0x0);
}
::TerminateProcess(::GetCurrentProcess(), 0);
}
}
HANDLE Win32Open(LPCWSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
bool bInherit,
DWORD dwCreationDisposition,
DWORD dwFlags,
DWORD dwAttributes
)
{
SECURITY_ATTRIBUTES attrs {};
attrs.nLength = sizeof(attrs);
attrs.bInheritHandle = bInherit ? TRUE : FALSE;
bool bSpecialFlags = (dwFlags & 0x4ffff7);
bool bSpecialAttrs = (dwAttributes & 0xFFB00008);
if (!pCreateFile2W)
{
if (bSpecialFlags)
{
SysPushErrorFeatureMissing("Do not use Windows8+ attributes/flags under Win32Open");
return INVALID_HANDLE_VALUE;
}
if (bSpecialAttrs)
{
SysPushErrorFeatureMissing("Do not use Windows8+ attributes/flags under Win32Open");
return INVALID_HANDLE_VALUE;
}
}
if (!dwAttributes)
{
dwAttributes = FILE_ATTRIBUTE_NORMAL;
}
if (pCreateFileW &&
!bSpecialFlags &&
!bSpecialAttrs)
{
return pCreateFileW(lpFileName,
dwDesiredAccess,
dwShareMode,
&attrs,
dwCreationDisposition,
dwFlags | dwAttributes,
NULL);
}
if (pCreateFile2W)
{
_CREATEFILE2_EXTENDED_PARAMETERS params {};
bool bRead {};
HANDLE hHandle {};
params.dwSize = sizeof(_CREATEFILE2_EXTENDED_PARAMETERS);
params.dwFileFlags = dwFlags;
params.dwFileAttributes = dwAttributes;
params.lpSecurityAttributes = &attrs;
if ((bRead = (::wcscmp(lpFileName, L"CONIN$") == 0)) ||
(::wcscmp(lpFileName, L"CONOUT$") == 0) ||
(::wcscmp(lpFileName, L"CONERR$") == 0))
{
if (!bRead)
{
dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
}
else
{
dwDesiredAccess = GENERIC_READ;
}
if ((hHandle = pCreateFile2W(lpFileName,
dwDesiredAccess,
dwShareMode,
dwCreationDisposition,
&params)) != INVALID_HANDLE_VALUE)
{
return hHandle;
}
lpFileName = L"CON";
}
return pCreateFile2W(lpFileName,
dwDesiredAccess,
dwShareMode,
dwCreationDisposition,
&params);
}
return INVALID_HANDLE_VALUE;
}
HANDLE Win32Open2(LPCWSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlags,
DWORD dwAttributes)
{
bool bSpecialFlags = (dwFlags & 0x4ffff7);
bool bSpecialAttrs = (dwAttributes & 0xFFB00008);
if (!pCreateFile2W)
{
if (bSpecialFlags)
{
SysPushErrorFeatureMissing("Do not use Windows8+ attributes/flags under Win32Open");
return INVALID_HANDLE_VALUE;
}
if (bSpecialAttrs)
{
SysPushErrorFeatureMissing("Do not use Windows8+ attributes/flags under Win32Open");
return INVALID_HANDLE_VALUE;
}
}
if (!dwAttributes)
{
dwAttributes = FILE_ATTRIBUTE_NORMAL;
}
if (pCreateFileW &&
!bSpecialFlags &&
!bSpecialAttrs)
{
return pCreateFileW(lpFileName,
dwDesiredAccess,
dwShareMode,
lpSecurityAttributes,
dwCreationDisposition,
dwFlags | dwAttributes,
NULL);
}
if (pCreateFile2W)
{
_CREATEFILE2_EXTENDED_PARAMETERS params {};
bool bRead {};
HANDLE hHandle {};
params.dwSize = sizeof(_CREATEFILE2_EXTENDED_PARAMETERS);
params.dwFileFlags = dwFlags;
params.dwFileAttributes = dwAttributes;
params.lpSecurityAttributes = lpSecurityAttributes;
if ((bRead = (::wcscmp(lpFileName, L"CONIN$") == 0)) ||
(::wcscmp(lpFileName, L"CONOUT$") == 0) ||
(::wcscmp(lpFileName, L"CONERR$") == 0))
{
if (!bRead)
{
dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
}
else
{
dwDesiredAccess = GENERIC_READ;
}
if ((hHandle = pCreateFile2W(lpFileName,
dwDesiredAccess,
dwShareMode,
dwCreationDisposition,
&params)) != INVALID_HANDLE_VALUE)
{
return hHandle;
}
lpFileName = L"CON";
}
return pCreateFile2W(lpFileName,
dwDesiredAccess,
dwShareMode,
dwCreationDisposition,
&params);
}
return INVALID_HANDLE_VALUE;
}
#if !defined(AURORA_PLATFORM_WIN32)
HMODULE UWPLibraryW(LPCWSTR lpLibFileName)
{
auto pos = std::basic_string_view<wchar_t>(lpLibFileName).find_last_of('/');
if (pos == std::basic_string_view<wchar_t>::npos)
{
pos = std::basic_string_view<wchar_t>(lpLibFileName).find_last_of('\\');
}
if (pos == std::basic_string_view<wchar_t>::npos)
{
#if defined(AURORA_HAS_LOAD_PGKD)
return (HMODULE)::LoadPackagedLibrary(lpLibFileName, 0);
#else
return (HMODULE)lpLibFileName;
#endif
}
else
{
auto pString = &lpLibFileName[pos + 1];
#if defined(AURORA_HAS_LOAD_PGKD)
return (HMODULE)::LoadPackagedLibrary(pString, 0);
#else
return (HMODULE)pString;
#endif
}
}
FARPROC UWPProcAddress(HMODULE hModule,
LPCSTR lpProcName)
{
if (!hModule)
{
return nullptr;
}
#if defined(AURORA_HAS_GET_PROC_NONWIN32)
return GetProcAddress(hModule, lpProcName);
#endif
return nullptr;
}
#endif
bool SysNativeWaitOnAddressFutexSupported()
{
return bool(pWaitOnAddress) || bool(pRtlWaitOnAddress);
}
bool SysWaitOnAddressTimed(const void *pTargetAddress,
const void *pCompareAddress,
AuUInt8 uWordSize,
AuUInt64 uAbsTimeSteadyClock,
AuUInt64 uRelativeNanoseconds,
AuOptional<AuUInt64> uAbsTimeAltClock,
bool bSpun)
{
// Wont move out of AuWakeOnAddress.cpp because it's so long and bloated in order to force nanosecond-scale yields on UWP.
SysUnreachable();
}
void NTWriteEoS(HANDLE hHandle)
{
SetEndOfFile(hHandle);
}
void SysWriteEoS(AuUInt uOSHandle)
{
NTWriteEoS((HANDLE)uOSHandle);
}
void SysCloseHandle(AuUInt uOSHandle)
{
auto pHandle = (void *)uOSHandle;
AuWin32CloseHandle(pHandle);
}
bool SysHandleIsNonZero(AuUInt uOSHandle)
{
return uOSHandle && (void *)uOSHandle != INVALID_HANDLE_VALUE;
}
void SysFlushHandle(AuUInt uOSHandle)
{
auto pHandle = (void *)uOSHandle;
FlushFileBuffers(pHandle);
}
AuUInt64 SysGetFileLength(AuUInt uOSHandle)
{
LARGE_INTEGER length;
if (!::GetFileSizeEx((HANDLE)uOSHandle, &length))
{
SysPushErrorIO();
return 0;
}
return length.QuadPart;
}
void *SysAllocateLarge(AuUInt uLength)
{
uLength = AuMemory::RoundPageUp(uLength);
return VirtualAlloc(nullptr, uLength, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
}
void SysAllocateFree(void *pBuffer, AuUInt uLength)
{
VirtualFree(pBuffer, 0, MEM_RELEASE);
}
bool SysMemoryLockPages(const void *pVoid, AuUInt uLength)
{
return VirtualLock((void *)pVoid, uLength);
}
bool SysMemoryUnlockPages(const void *pVoid, AuUInt uLength)
{
return VirtualUnlock((void *)pVoid, uLength);
}
}