aboutsummaryrefslogblamecommitdiffstats
path: root/Game/Code/lib/DSPack/DirectX9/DirectPlay8.pas
blob: 7c4aa8bbc7c8016c61ee457de517f1d03fdac7ac (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                                                               
{******************************************************************************}
{*                                                                            *}
{*  Copyright (C) Microsoft Corporation.  All Rights Reserved.                *}
{*                                                                            *}
{*  Files:      dpaddr.h dplobby8.h dplay8.h dvoice.h                         *}
{*  Content:    DirectPlay8 include files                                     *}
{*                                                                            *}
{*  DirectX 9.0 Delphi adaptation by Alexey Barkovoy                          *}
{*  E-Mail: clootie@reactor.ru                                                *}
{*                                                                            *}
{*  Modified: 27-Apr-2003                                                     *}
{*                                                                            *}
{*  Latest version can be downloaded from:                                    *}
{*     http://clootie.narod.ru/delphi                                         *}
{*                                                                            *}
{******************************************************************************}
{                                                                              }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
{                                                                              }
{ The contents of this file are used with permission, subject to the Mozilla   }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at      }
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
{                                                                              }
{ Software distributed under the License is distributed on an "AS IS" basis,   }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License.    }
{                                                                              }
{ Alternatively, the contents of this file may be used under the terms of the  }
{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
{ provisions of the LGPL License are applicable instead of those above.        }
{ If you wish to allow use of your version of this file only under the terms   }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting  the provisions above and  }
{ replace  them with the notice and other provisions required by the LGPL      }
{ License.  If you do not delete the provisions above, a recipient may use     }
{ your version of this file under either the MPL or the LGPL License.          }
{                                                                              }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{                                                                              }
{******************************************************************************}

{$I DirectX.inc}

unit DirectPlay8;

interface

(*$HPPEMIT '#include "dplay8.h"' *)
(*$HPPEMIT '#include "dplobby8.h"' *)
(*$HPPEMIT '#include "dvoice.h"' *)

uses
  Windows, WinSock, DirectSound;

(*==========================================================================;
 *
 *  Copyright (C) 2000-2002 Microsoft Corporation.  All Rights Reserved.
 *
 *  File:       dpaddr.h
 *  Content:   DirectPlayAddress include file
 ***************************************************************************)


const
(****************************************************************************
 *
 * DirectPlay8Address CLSIDs
 *
 ****************************************************************************)

  // {934A9523-A3CA-4bc5-ADA0-D6D95D979421}
  CLSID_DirectPlay8Address: TGUID = '{934a9523-a3ca-4bc5-ada0-d6d95d979421}';
  {$EXTERNALSYM CLSID_DirectPlay8Address}

  
(****************************************************************************
 *
 * DirectPlay8Address Interface IIDs
 *
 ****************************************************************************)
type
  DPNAREFIID = TGUID;
  {$EXTERNALSYM DPNAREFIID}
  TDPNARefIID = DPNAREFIID;


(****************************************************************************
 *
 * DirectPlay8Address Constants
 *
 ****************************************************************************)
const
  //
  // Asynchronous operation flags
  //
  DPNA_DATATYPE_STRING        = $00000001;
  {$EXTERNALSYM DPNA_DATATYPE_STRING}
  DPNA_DATATYPE_DWORD         = $00000002;
  {$EXTERNALSYM DPNA_DATATYPE_DWORD}
  DPNA_DATATYPE_GUID          = $00000003;
  {$EXTERNALSYM DPNA_DATATYPE_GUID}
  DPNA_DATATYPE_BINARY        = $00000004;
  {$EXTERNALSYM DPNA_DATATYPE_BINARY}
  DPNA_DATATYPE_STRING_ANSI   = $00000005;
  {$EXTERNALSYM DPNA_DATATYPE_STRING_ANSI}

  DPNA_DPNSVR_PORT            = 6073;
  {$EXTERNALSYM DPNA_DPNSVR_PORT}

  DPNA_INDEX_INVALID          = $FFFFFFFF;
  {$EXTERNALSYM DPNA_INDEX_INVALID}

(****************************************************************************
 *
 * DirectPlay8Address Address Elements
 *
 ****************************************************************************)

  DPNA_SEPARATOR_KEYVALUE       = WideChar('=');
  {$EXTERNALSYM DPNA_SEPARATOR_KEYVALUE}
  DPNA_SEPARATOR_USERDATA       = WideChar('#');
  {$EXTERNALSYM DPNA_SEPARATOR_USERDATA}
  DPNA_SEPARATOR_COMPONENT      = WideChar(';');
  {$EXTERNALSYM DPNA_SEPARATOR_COMPONENT}
  DPNA_ESCAPECHAR               = WideChar('%');
  {$EXTERNALSYM DPNA_ESCAPECHAR}

  // Header
  DPNA_HEADER		                    = 'x-directplay:/';
  {$EXTERNALSYM DPNA_HEADER}

  // key names for address components
  DPNA_KEY_NAT_RESOLVER     = 'natresolver';
  {$EXTERNALSYM DPNA_KEY_NAT_RESOLVER}
  DPNA_KEY_NAT_RESOLVER_USER_STRING = 'natresolveruserstring';
  {$EXTERNALSYM DPNA_KEY_NAT_RESOLVER_USER_STRING}
  DPNA_KEY_APPLICATION_INSTANCE = 'applicationinstance';
  {$EXTERNALSYM DPNA_KEY_APPLICATION_INSTANCE}
  DPNA_KEY_DEVICE           = 'device';
  {$EXTERNALSYM DPNA_KEY_DEVICE}
  DPNA_KEY_HOSTNAME         = 'hostname';
  {$EXTERNALSYM DPNA_KEY_HOSTNAME}
  DPNA_KEY_PORT             = 'port';
  {$EXTERNALSYM DPNA_KEY_PORT}
  DPNA_KEY_NAMEINFO         = 'nameinfo';
  {$EXTERNALSYM DPNA_KEY_NAMEINFO}
  DPNA_KEY_PROCESSOR        = 'processor';
  {$EXTERNALSYM DPNA_KEY_PROCESSOR}
  DPNA_KEY_PROGRAM          = 'program';
  {$EXTERNALSYM DPNA_KEY_PROGRAM}
  DPNA_KEY_PROVIDER         = 'provider';
  {$EXTERNALSYM DPNA_KEY_PROVIDER}
  DPNA_KEY_SCOPE            = 'scope';
  {$EXTERNALSYM DPNA_KEY_SCOPE}
  DPNA_KEY_TRAVERSALMODE    = 'traversalmode';
  {$EXTERNALSYM DPNA_KEY_TRAVERSALMODE}
  DPNA_KEY_BAUD             = 'baud';
  {$EXTERNALSYM DPNA_KEY_BAUD}
  DPNA_KEY_FLOWCONTROL      = 'flowcontrol';
  {$EXTERNALSYM DPNA_KEY_FLOWCONTROL}
  DPNA_KEY_PARITY           = 'parity';
  {$EXTERNALSYM DPNA_KEY_PARITY}
  DPNA_KEY_PHONENUMBER      = 'phonenumber';
  {$EXTERNALSYM DPNA_KEY_PHONENUMBER}
  DPNA_KEY_STOPBITS         = 'stopbits';
  {$EXTERNALSYM DPNA_KEY_STOPBITS}

  // values for baud rate
  DPNA_BAUD_RATE_9600         = 9600;
  {$EXTERNALSYM DPNA_BAUD_RATE_9600}
  DPNA_BAUD_RATE_14400        = 14400;
  {$EXTERNALSYM DPNA_BAUD_RATE_14400}
  DPNA_BAUD_RATE_19200        = 19200;
  {$EXTERNALSYM DPNA_BAUD_RATE_19200}
  DPNA_BAUD_RATE_38400        = 38400;
  {$EXTERNALSYM DPNA_BAUD_RATE_38400}
  DPNA_BAUD_RATE_56000        = 56000;
  {$EXTERNALSYM DPNA_BAUD_RATE_56000}
  DPNA_BAUD_RATE_57600        = 57600;
  {$EXTERNALSYM DPNA_BAUD_RATE_57600}
  DPNA_BAUD_RATE_115200       = 115200;
  {$EXTERNALSYM DPNA_BAUD_RATE_115200}

  // values for stop bits
  DPNA_STOP_BITS_ONE          = '1';
  {$EXTERNALSYM DPNA_STOP_BITS_ONE}
  DPNA_STOP_BITS_ONE_FIVE     = '1.5';
  {$EXTERNALSYM DPNA_STOP_BITS_ONE_FIVE}
  DPNA_STOP_BITS_TWO          = '2';
  {$EXTERNALSYM DPNA_STOP_BITS_TWO}

  // values for parity
  DPNA_PARITY_NONE					= 'NONE';
  {$EXTERNALSYM DPNA_PARITY_NONE}
  DPNA_PARITY_EVEN					= 'EVEN';
  {$EXTERNALSYM DPNA_PARITY_EVEN}
  DPNA_PARITY_ODD						= 'ODD';
  {$EXTERNALSYM DPNA_PARITY_ODD}
  DPNA_PARITY_MARK					= 'MARK';
  {$EXTERNALSYM DPNA_PARITY_MARK}
  DPNA_PARITY_SPACE					= 'SPACE';
  {$EXTERNALSYM DPNA_PARITY_SPACE}

  // values for flow control
  DPNA_FLOW_CONTROL_NONE			= 'NONE';
  {$EXTERNALSYM DPNA_FLOW_CONTROL_NONE}
  DPNA_FLOW_CONTROL_XONXOFF		= 'XONXOFF';
  {$EXTERNALSYM DPNA_FLOW_CONTROL_XONXOFF}
  DPNA_FLOW_CONTROL_RTS				= 'RTS';
  {$EXTERNALSYM DPNA_FLOW_CONTROL_RTS}
  DPNA_FLOW_CONTROL_DTR				= 'DTR';
  {$EXTERNALSYM DPNA_FLOW_CONTROL_DTR}
  DPNA_FLOW_CONTROL_RTSDTR		= 'RTSDTR';
  {$EXTERNALSYM DPNA_FLOW_CONTROL_RTSDTR}
  // values for traversal mode
  DPNA_TRAVERSALMODE_NONE             = 0;
  {$EXTERNALSYM DPNA_TRAVERSALMODE_NONE}
  DPNA_TRAVERSALMODE_PORTREQUIRED     = 1;
  {$EXTERNALSYM DPNA_TRAVERSALMODE_PORTREQUIRED}
  DPNA_TRAVERSALMODE_PORTRECOMMENDED  = 2;
  {$EXTERNALSYM DPNA_TRAVERSALMODE_PORTRECOMMENDED}
  // Shortcut values
  //
  // These can be used instead of the corresponding CLSID_DP8SP_XXXX guids
  //
  DPNA_VALUE_TCPIPPROVIDER            = 'IP';
  {$EXTERNALSYM DPNA_VALUE_TCPIPPROVIDER}
  DPNA_VALUE_IPXPROVIDER              = 'IPX';
  {$EXTERNALSYM DPNA_VALUE_IPXPROVIDER}
  DPNA_VALUE_MODEMPROVIDER            = 'MODEM';
  {$EXTERNALSYM DPNA_VALUE_MODEMPROVIDER}
  DPNA_VALUE_SERIALPROVIDER           = 'SERIAL';
  {$EXTERNALSYM DPNA_VALUE_SERIALPROVIDER}

//// ANSI DEFINITIONS

  // Header
  DPNA_HEADER_A						      = 'x-directplay:/';
  {$EXTERNALSYM DPNA_HEADER_A}
  DPNA_SEPARATOR_KEYVALUE_A			= '=';
  {$EXTERNALSYM DPNA_SEPARATOR_KEYVALUE_A}
  DPNA_SEPARATOR_USERDATA_A			= '#';
  {$EXTERNALSYM DPNA_SEPARATOR_USERDATA_A}
  DPNA_SEPARATOR_COMPONENT_A		= ';';
  {$EXTERNALSYM DPNA_SEPARATOR_COMPONENT_A}
  DPNA_ESCAPECHAR_A					    = '%';
  {$EXTERNALSYM DPNA_ESCAPECHAR_A}

  // key names for address components
  DPNA_KEY_NAT_RESOLVER_A					= 'natresolver';
  {$EXTERNALSYM DPNA_KEY_NAT_RESOLVER_A}
  DPNA_KEY_NAT_RESOLVER_USER_STRING_A		= 'natresolveruserstring';
  {$EXTERNALSYM DPNA_KEY_NAT_RESOLVER_USER_STRING_A}
  DPNA_KEY_APPLICATION_INSTANCE_A		= 'applicationinstance';
  {$EXTERNALSYM DPNA_KEY_APPLICATION_INSTANCE_A}
  DPNA_KEY_DEVICE_A					= 'device';
  {$EXTERNALSYM DPNA_KEY_DEVICE_A}
  DPNA_KEY_HOSTNAME_A					= 'hostname';
  {$EXTERNALSYM DPNA_KEY_HOSTNAME_A}
  DPNA_KEY_PORT_A						= 'port';
  {$EXTERNALSYM DPNA_KEY_PORT_A}
  DPNA_KEY_NAMEINFO_A					= 'nameinfo';
  {$EXTERNALSYM DPNA_KEY_NAMEINFO_A}
  DPNA_KEY_PROCESSOR_A				= 'processor';
  {$EXTERNALSYM DPNA_KEY_PROCESSOR_A}
  DPNA_KEY_PROGRAM_A					= 'program';
  {$EXTERNALSYM DPNA_KEY_PROGRAM_A}
  DPNA_KEY_PROVIDER_A					= 'provider';
  {$EXTERNALSYM DPNA_KEY_PROVIDER_A}
  DPNA_KEY_SCOPE_A					= 'scope';
  {$EXTERNALSYM DPNA_KEY_SCOPE_A}
  DPNA_KEY_TRAVERSALMODE_A			= 'traversalmode';
  {$EXTERNALSYM DPNA_KEY_TRAVERSALMODE_A}
  DPNA_KEY_BAUD_A						= 'baud';
  {$EXTERNALSYM DPNA_KEY_BAUD_A}
  DPNA_KEY_FLOWCONTROL_A				= 'flowcontrol';
  {$EXTERNALSYM DPNA_KEY_FLOWCONTROL_A}
  DPNA_KEY_PARITY_A					= 'parity';
  {$EXTERNALSYM DPNA_KEY_PARITY_A}
  DPNA_KEY_PHONENUMBER_A				= 'phonenumber';
  {$EXTERNALSYM DPNA_KEY_PHONENUMBER_A}
  DPNA_KEY_STOPBITS_A					= 'stopbits';
  {$EXTERNALSYM DPNA_KEY_STOPBITS_A}

  // values for stop bits
  DPNA_STOP_BITS_ONE_A				= '1';
  {$EXTERNALSYM DPNA_STOP_BITS_ONE_A}
  DPNA_STOP_BITS_ONE_FIVE_A			= '1.5';
  {$EXTERNALSYM DPNA_STOP_BITS_ONE_FIVE_A}
  DPNA_STOP_BITS_TWO_A				= '2';
  {$EXTERNALSYM DPNA_STOP_BITS_TWO_A}

  // values for parity
  DPNA_PARITY_NONE_A					= 'NONE';
  {$EXTERNALSYM DPNA_PARITY_NONE_A}
  DPNA_PARITY_EVEN_A					= 'EVEN';
  {$EXTERNALSYM DPNA_PARITY_EVEN_A}
  DPNA_PARITY_ODD_A	          = 'ODD';
  {$EXTERNALSYM DPNA_PARITY_ODD_A}
  DPNA_PARITY_MARK_A					= 'MARK';
  {$EXTERNALSYM DPNA_PARITY_MARK_A}
  DPNA_PARITY_SPACE_A					= 'SPACE';
  {$EXTERNALSYM DPNA_PARITY_SPACE_A}

  // values for flow control
  DPNA_FLOW_CONTROL_NONE_A			= 'NONE';
  {$EXTERNALSYM DPNA_FLOW_CONTROL_NONE_A}
  DPNA_FLOW_CONTROL_XONXOFF_A   = 'XONXOFF';
  {$EXTERNALSYM DPNA_FLOW_CONTROL_XONXOFF_A}
  DPNA_FLOW_CONTROL_RTS_A				= 'RTS';
  {$EXTERNALSYM DPNA_FLOW_CONTROL_RTS_A}
  DPNA_FLOW_CONTROL_DTR_A				= 'DTR';
  {$EXTERNALSYM DPNA_FLOW_CONTROL_DTR_A}
  DPNA_FLOW_CONTROL_RTSDTR_A		= 'RTSDTR';
  {$EXTERNALSYM DPNA_FLOW_CONTROL_RTSDTR_A}
  // Shortcut values
  //
  // These can be used instead of the corresponding CLSID_DP8SP_XXXX guids
  //
  DPNA_VALUE_TCPIPPROVIDER_A          = 'IP';
  {$EXTERNALSYM DPNA_VALUE_TCPIPPROVIDER_A}
  DPNA_VALUE_IPXPROVIDER_A            = 'IPX';
  {$EXTERNALSYM DPNA_VALUE_IPXPROVIDER_A}
  DPNA_VALUE_MODEMPROVIDER_A          = 'MODEM';
  {$EXTERNALSYM DPNA_VALUE_MODEMPROVIDER_A}
  DPNA_VALUE_SERIALPROVIDER_A         = 'SERIAL';
  {$EXTERNALSYM DPNA_VALUE_SERIALPROVIDER_A}

type
(****************************************************************************
 *
 * DirectPlay8Address Forward Declarations For External Types
 *
 ****************************************************************************)

  SOCKADDR = TSockAddr;
  {$EXTERNALSYM SOCKADDR}

(****************************************************************************
 *
 * DirectPlay8Address Functions
 *
 ****************************************************************************)


(*
 *
 * This function is no longer supported.  It is recommended that CoCreateInstance be used to create
 * DirectPlay8 address objects.
 *
 * HRESULT WINAPI DirectPlay8AddressCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown);
 *
 *)

(****************************************************************************
 *
 * DirectPlay8Address Application Interfaces
 *
 ****************************************************************************)

  //
  // COM definition for IDirectPlay8Address Generic Interface
  //
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8Address);'}
  {$EXTERNALSYM IDirectPlay8Address}
  IDirectPlay8Address = interface(IUnknown)
    ['{83783300-4063-4c8a-9db3-82830a7feb31}']
    (*** IDirectPlay8Address methods ***)
    function BuildFromURLW(pwszSourceURL: PWideChar): HResult; stdcall;
    function BuildFromURLA(pszSourceURL: PAnsiChar): HResult; stdcall;
    function Duplicate(out ppdpaNewAddress: IDirectPlay8Address): HResult; stdcall;
    function SetEqual(pdpaAddress: IDirectPlay8Address): HResult; stdcall;
    function IsEqual(pdpaAddress: IDirectPlay8Address): HResult; stdcall;
    function Clear: HResult; stdcall;
    function GetURLW(pwszURL: PWideChar; var pdwNumChars: DWORD): HResult; stdcall;
    function GetURLA(pszURL: PAnsiChar; var pdwNumChars: DWORD): HResult; stdcall;
    function GetSP(out pguidSP: TGUID): HResult; stdcall;
    function GetUserData(pvUserData: Pointer; var pdwBufferSize: DWORD): HResult; stdcall;
    function SetSP(const pguidSP: TGUID): HResult; stdcall;
    function SetUserData(pvUserData: Pointer; dwDataSize: DWORD): HResult; stdcall;
    function GetNumComponents(out pdwNumComponents: DWORD): HResult; stdcall;
    function GetComponentByName(pwszName: PWideChar; pvBuffer: Pointer; var pdwBufferSize: DWORD; out pdwDataType: DWORD): HResult; stdcall;
    function GetComponentByIndex(dwComponentID: DWORD; pwszName: PWideChar; var pdwNameLen: DWORD; pvBuffer: Pointer; var pdwBufferSize: DWORD; out pdwDataType: DWORD): HResult; stdcall;
    function AddComponent(pwszName: PWideChar; lpvData: Pointer; dwDataSize, dwDataType: DWORD): HResult; stdcall;
    function GetDevice(out pguidDevice: TGUID): HResult; stdcall;
    function SetDevice(const pguidDevice: TGUID): HResult; stdcall;
    function BuildFromDPADDRESS(pvAddress: Pointer; dwDataSize: DWORD): HResult; stdcall;
  end;
  {$NODEFINE PIDirectPlay8Address}
  {$HPPEMIT 'typedef _di_IDirectPlay8Address *PIDirectPlay8Address;'}
  PIDirectPlay8Address = ^IDirectPlay8Address;

  //
  // COM definition for IDirectPlay8AddressIP Generic Interface
  //
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8AddressIP);'}
  {$EXTERNALSYM IDirectPlay8AddressIP}
  IDirectPlay8AddressIP = interface(IUnknown)
    ['{e5a0e990-2bad-430b-87da-a142cf75de58}']
    (*** IDirectPlay8AddressIP methods ***)
    // Constructs a IDirectPlay8 TCP Address from a SOCKADDR structure
    function BuildFromSockAddr(const pSockAddr: TSockAddr): HResult; stdcall;

    // Constructs a TCP Address from a string (hostname) and port
    function BuildAddress(wszAddress: PWideChar; usPort: Word): HResult; stdcall;

    // Builds a local TCP Address
    function BuildLocalAddress(const pguidAdapter: TGUID; usPort: Word): HResult; stdcall;

    // Gets the address from the structure in SOCKADR format
    function GetSockAddress(psockAddress: PSockAddr; var pdwAddressBufferSize: DWORD): HResult; stdcall;

    // Gets the local afddress
    function GetLocalAddress(out pguidAdapter: TGUID; out pusPort: Word): HResult; stdcall;

    // Gets the remote address
    function GetAddress(wszAddress: PWideChar; var pdwAddressLength: DWORD; out psPort: Word): HResult; stdcall;
  end;


(****************************************************************************
 *
 * DirectPlay8Address Interface IIDs
 *
 ****************************************************************************)

type
  // {83783300-4063-4c8a-9DB3-82830A7FEB31}
  IID_IDirectPlay8Address = IDirectPlay8Address;
  {$EXTERNALSYM IID_IDirectPlay8Address}
  // {E5A0E990-2BAD-430b-87DA-A142CF75DE58}
  IID_IDirectPlay8AddressIP = IDirectPlay8AddressIP; 
  {$EXTERNALSYM IID_IDirectPlay8AddressIP}



(*==========================================================================;
 *
 *  Copyright (C) 1998-2002 Microsoft Corporation.  All Rights Reserved.
 *
 *  File:   DPlay8.h
 *  Content: DirectPlay8 include file
 *
 ***************************************************************************)

const
(****************************************************************************
 *
 * DirectPlay8 CLSIDs
 *
 ****************************************************************************)

  // {743F1DC6-5ABA-429f-8BDF-C54D03253DC2}
  CLSID_DirectPlay8Client: TGUID = '{743f1dc6-5aba-429f-8bdf-c54d03253dc2}';
  {$EXTERNALSYM CLSID_DirectPlay8Client}

  // {DA825E1B-6830-43d7-835D-0B5AD82956A2}
  CLSID_DirectPlay8Server: TGUID = '{da825e1b-6830-43d7-835d-0b5ad82956a2}';
  {$EXTERNALSYM CLSID_DirectPlay8Server}

  // {286F484D-375E-4458-A272-B138E2F80A6A}
  CLSID_DirectPlay8Peer: TGUID = '{286f484d-375e-4458-a272-b138e2f80a6a}';
  {$EXTERNALSYM CLSID_DirectPlay8Peer}

  // CLSIDs added for DirectX 9

  // {FC47060E-6153-4b34-B975-8E4121EB7F3C}
  CLSID_DirectPlay8ThreadPool: TGUID = '{fc47060e-6153-4b34-b975-8e4121eb7f3c}';
  {$EXTERNALSYM CLSID_DirectPlay8ThreadPool}

  // {E4C1D9A2-CBF7-48bd-9A69-34A55E0D8941}
  CLSID_DirectPlay8NATResolver: TGUID = '{e4c1d9a2-cbf7-48bd-9a69-34a55e0d8941}';
  {$EXTERNALSYM CLSID_DirectPlay8NATResolver}

(****************************************************************************
 *
 * DirectPlay8 Service Provider GUIDs
 *
 ****************************************************************************)

  // {53934290-628D-11D2-AE0F-006097B01411}
  CLSID_DP8SP_IPX: TGUID = '{53934290-628d-11d2-ae0f-006097b01411}';
  {$EXTERNALSYM CLSID_DP8SP_IPX}

  // {6D4A3650-628D-11D2-AE0F-006097B01411}
  CLSID_DP8SP_MODEM: TGUID = '{6d4a3650-628d-11d2-ae0f-006097b01411}';
  {$EXTERNALSYM CLSID_DP8SP_MODEM}

  // {743B5D60-628D-11D2-AE0F-006097B01411}
  CLSID_DP8SP_SERIAL: TGUID = '{743b5d60-628d-11d2-ae0f-006097b01411}';
  {$EXTERNALSYM CLSID_DP8SP_SERIAL}

  // {EBFE7BA0-628D-11D2-AE0F-006097B01411}
  CLSID_DP8SP_TCPIP: TGUID = '{ebfe7ba0-628d-11d2-ae0f-006097b01411}';
  {$EXTERNALSYM CLSID_DP8SP_TCPIP}


  // Service providers added for DirectX 9


  // {995513AF-3027-4b9a-956E-C772B3F78006}
  CLSID_DP8SP_BLUETOOTH: TGUID = '{995513af-3027-4b9a-956e-c772b3f78006}';
  {$EXTERNALSYM CLSID_DP8SP_BLUETOOTH}


type
(****************************************************************************
 *
 * DirectPlay8 Callback Functions
 *
 ****************************************************************************)

  //
  // Callback Function Type Definition
  //
  TFNDPNMessageHandler = function (pvUserContext: Pointer; dwMessageType: DWORD; pMessage: Pointer): HRESULT; stdcall;
  {$NODEFINE TFNDPNMessageHandler}
  {$HPPEMIT 'typedef PFNDPNMESSAGEHANDLER TFNDPNMessageHandler;'}

(****************************************************************************
 *
 * DirectPlay8 Datatypes (Non-Structure / Non-Message)
 *
 ****************************************************************************)

  //
  // Player IDs.  Used to uniquely identify a player in a session
  //
  PDPNID = ^DPNID;
  {$EXTERNALSYM PDPNID}
  DPNID = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWORD;
  {$EXTERNALSYM DPNID}
  TDPNID = DPNID;

  //
  // Used as identifiers for operations
  //
  PDPNHandle = ^TDPNHandle;
  DPNHANDLE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWORD;
  {$EXTERNALSYM DPNHANDLE}
  TDPNHandle = DPNHANDLE;

(****************************************************************************
 *
 * DirectPlay8 Message Identifiers
 *
 ****************************************************************************)

const
  DPN_MSGID_OFFSET                    = $FFFF0000;
  {$EXTERNALSYM DPN_MSGID_OFFSET}
  DPN_MSGID_ADD_PLAYER_TO_GROUP       = (DPN_MSGID_OFFSET or $0001);
  {$EXTERNALSYM DPN_MSGID_ADD_PLAYER_TO_GROUP}
  DPN_MSGID_APPLICATION_DESC          = (DPN_MSGID_OFFSET or $0002);
  {$EXTERNALSYM DPN_MSGID_APPLICATION_DESC}
  DPN_MSGID_ASYNC_OP_COMPLETE         = (DPN_MSGID_OFFSET or $0003);
  {$EXTERNALSYM DPN_MSGID_ASYNC_OP_COMPLETE}
  DPN_MSGID_CLIENT_INFO               = (DPN_MSGID_OFFSET or $0004);
  {$EXTERNALSYM DPN_MSGID_CLIENT_INFO}
  DPN_MSGID_CONNECT_COMPLETE          = (DPN_MSGID_OFFSET or $0005);
  {$EXTERNALSYM DPN_MSGID_CONNECT_COMPLETE}
  DPN_MSGID_CREATE_GROUP              = (DPN_MSGID_OFFSET or $0006);
  {$EXTERNALSYM DPN_MSGID_CREATE_GROUP}
  DPN_MSGID_CREATE_PLAYER             = (DPN_MSGID_OFFSET or $0007);
  {$EXTERNALSYM DPN_MSGID_CREATE_PLAYER}
  DPN_MSGID_DESTROY_GROUP             = (DPN_MSGID_OFFSET or $0008);
  {$EXTERNALSYM DPN_MSGID_DESTROY_GROUP}
  DPN_MSGID_DESTROY_PLAYER            = (DPN_MSGID_OFFSET or $0009);
  {$EXTERNALSYM DPN_MSGID_DESTROY_PLAYER}
  DPN_MSGID_ENUM_HOSTS_QUERY          = (DPN_MSGID_OFFSET or $000a);
  {$EXTERNALSYM DPN_MSGID_ENUM_HOSTS_QUERY}
  DPN_MSGID_ENUM_HOSTS_RESPONSE       = (DPN_MSGID_OFFSET or $000b);
  {$EXTERNALSYM DPN_MSGID_ENUM_HOSTS_RESPONSE}
  DPN_MSGID_GROUP_INFO                = (DPN_MSGID_OFFSET or $000c);
  {$EXTERNALSYM DPN_MSGID_GROUP_INFO}
  DPN_MSGID_HOST_MIGRATE              = (DPN_MSGID_OFFSET or $000d);
  {$EXTERNALSYM DPN_MSGID_HOST_MIGRATE}
  DPN_MSGID_INDICATE_CONNECT          = (DPN_MSGID_OFFSET or $000e);
  {$EXTERNALSYM DPN_MSGID_INDICATE_CONNECT}
  DPN_MSGID_INDICATED_CONNECT_ABORTED = (DPN_MSGID_OFFSET or $000f);
  {$EXTERNALSYM DPN_MSGID_INDICATED_CONNECT_ABORTED}
  DPN_MSGID_PEER_INFO                 = (DPN_MSGID_OFFSET or $0010);
  {$EXTERNALSYM DPN_MSGID_PEER_INFO}
  DPN_MSGID_RECEIVE                   = (DPN_MSGID_OFFSET or $0011);
  {$EXTERNALSYM DPN_MSGID_RECEIVE}
  DPN_MSGID_REMOVE_PLAYER_FROM_GROUP  = (DPN_MSGID_OFFSET or $0012);
  {$EXTERNALSYM DPN_MSGID_REMOVE_PLAYER_FROM_GROUP}
  DPN_MSGID_RETURN_BUFFER             = (DPN_MSGID_OFFSET or $0013);
  {$EXTERNALSYM DPN_MSGID_RETURN_BUFFER}
  DPN_MSGID_SEND_COMPLETE             = (DPN_MSGID_OFFSET or $0014);
  {$EXTERNALSYM DPN_MSGID_SEND_COMPLETE}
  DPN_MSGID_SERVER_INFO               = (DPN_MSGID_OFFSET or $0015);
  {$EXTERNALSYM DPN_MSGID_SERVER_INFO}
  DPN_MSGID_TERMINATE_SESSION         = (DPN_MSGID_OFFSET or $0016);
  {$EXTERNALSYM DPN_MSGID_TERMINATE_SESSION}

  // Messages added for DirectX 9
  DPN_MSGID_CREATE_THREAD             = (DPN_MSGID_OFFSET or $0017);
  {$EXTERNALSYM DPN_MSGID_CREATE_THREAD}
  DPN_MSGID_DESTROY_THREAD            = (DPN_MSGID_OFFSET or $0018);
  {$EXTERNALSYM DPN_MSGID_DESTROY_THREAD}
  DPN_MSGID_NAT_RESOLVER_QUERY        = (DPN_MSGID_OFFSET or $0101);
  {$EXTERNALSYM DPN_MSGID_NAT_RESOLVER_QUERY}

(****************************************************************************
 *
 * DirectPlay8 Constants
 *
 ****************************************************************************)

  DPNID_ALL_PLAYERS_GROUP                 = 0;
  {$EXTERNALSYM DPNID_ALL_PLAYERS_GROUP}

  //
  // DESTROY_GROUP reasons
  //
  DPNDESTROYGROUPREASON_NORMAL            = $0001;
  {$EXTERNALSYM DPNDESTROYGROUPREASON_NORMAL}
  DPNDESTROYGROUPREASON_AUTODESTRUCTED    = $0002;
  {$EXTERNALSYM DPNDESTROYGROUPREASON_AUTODESTRUCTED}
  DPNDESTROYGROUPREASON_SESSIONTERMINATED = $0003;
  {$EXTERNALSYM DPNDESTROYGROUPREASON_SESSIONTERMINATED}

  //
  // DESTROY_PLAYER reasons
  //
  DPNDESTROYPLAYERREASON_NORMAL              = $0001;
  {$EXTERNALSYM DPNDESTROYPLAYERREASON_NORMAL}
  DPNDESTROYPLAYERREASON_CONNECTIONLOST      = $0002;
  {$EXTERNALSYM DPNDESTROYPLAYERREASON_CONNECTIONLOST}
  DPNDESTROYPLAYERREASON_SESSIONTERMINATED   = $0003;
  {$EXTERNALSYM DPNDESTROYPLAYERREASON_SESSIONTERMINATED}
  DPNDESTROYPLAYERREASON_HOSTDESTROYEDPLAYER = $0004;
  {$EXTERNALSYM DPNDESTROYPLAYERREASON_HOSTDESTROYEDPLAYER}


  DPN_MAX_APPDESC_RESERVEDDATA_SIZE          = 64;
  {$EXTERNALSYM DPN_MAX_APPDESC_RESERVEDDATA_SIZE}


(****************************************************************************
 *
 * DirectPlay8 Flags
 *
 ****************************************************************************)

  //
  // Asynchronous operation flags (For Async Ops)
  //
  DPNOP_SYNC                   = $80000000;
  {$EXTERNALSYM DPNOP_SYNC}

  //
  // Add player to group flags (For AddPlayerToGroup)
  //
  DPNADDPLAYERTOGROUP_SYNC     = DPNOP_SYNC;
  {$EXTERNALSYM DPNADDPLAYERTOGROUP_SYNC}

  //
  // Cancel flags
  //
  DPNCANCEL_CONNECT           = $0001;
  {$EXTERNALSYM DPNCANCEL_CONNECT}
  DPNCANCEL_ENUM              = $0002;
  {$EXTERNALSYM DPNCANCEL_ENUM}
  DPNCANCEL_SEND              = $0004;
  {$EXTERNALSYM DPNCANCEL_SEND}
  DPNCANCEL_ALL_OPERATIONS    = $8000;
  {$EXTERNALSYM DPNCANCEL_ALL_OPERATIONS}

  // Flags added for DirectX 9
  DPNCANCEL_PLAYER_SENDS					= $80000000;
  {$EXTERNALSYM DPNCANCEL_PLAYER_SENDS}
  DPNCANCEL_PLAYER_SENDS_PRIORITY_HIGH	= (DPNCANCEL_PLAYER_SENDS or $00010000);
  {$EXTERNALSYM DPNCANCEL_PLAYER_SENDS_PRIORITY_HIGH}
  DPNCANCEL_PLAYER_SENDS_PRIORITY_NORMAL	= (DPNCANCEL_PLAYER_SENDS or $00020000);
  {$EXTERNALSYM DPNCANCEL_PLAYER_SENDS_PRIORITY_NORMAL}
  DPNCANCEL_PLAYER_SENDS_PRIORITY_LOW		= (DPNCANCEL_PLAYER_SENDS or $00040000);
  {$EXTERNALSYM DPNCANCEL_PLAYER_SENDS_PRIORITY_LOW}

  //
  // Close flags (for Close, added for DirectX 9)
  //
  DPNCLOSE_IMMEDIATE						= $00000001;
  {$EXTERNALSYM DPNCLOSE_IMMEDIATE}

  //
  // Connect flags (For Connect)
  //
  DPNCONNECT_SYNC              = DPNOP_SYNC;
  {$EXTERNALSYM DPNCONNECT_SYNC}
  DPNCONNECT_OKTOQUERYFORADDRESSING = $0001;
  {$EXTERNALSYM DPNCONNECT_OKTOQUERYFORADDRESSING}

  //
  // Create group flags (For CreateGroup)
  //
  DPNCREATEGROUP_SYNC          = DPNOP_SYNC;
  {$EXTERNALSYM DPNCREATEGROUP_SYNC}

  //
  // Destroy group flags (For DestroyGroup)
  //
  DPNDESTROYGROUP_SYNC         = DPNOP_SYNC;
  {$EXTERNALSYM DPNDESTROYGROUP_SYNC}

  //
  // Enumerate clients and groups flags (For EnumPlayersAndGroups)
  //
  DPNENUM_PLAYERS              = $0001;
  {$EXTERNALSYM DPNENUM_PLAYERS}
  DPNENUM_GROUPS               = $0010;
  {$EXTERNALSYM DPNENUM_GROUPS}

  //
  // Enum hosts flags (For EnumHosts)
  //
  DPNENUMHOSTS_SYNC                   = DPNOP_SYNC;
  {$EXTERNALSYM DPNENUMHOSTS_SYNC}
  DPNENUMHOSTS_OKTOQUERYFORADDRESSING = $0001;
  {$EXTERNALSYM DPNENUMHOSTS_OKTOQUERYFORADDRESSING}
  DPNENUMHOSTS_NOBROADCASTFALLBACK    = $0002;
  {$EXTERNALSYM DPNENUMHOSTS_NOBROADCASTFALLBACK}

  //
  // Enum service provider flags (For EnumSP)
  //
  DPNENUMSERVICEPROVIDERS_ALL         = $0001;
  {$EXTERNALSYM DPNENUMSERVICEPROVIDERS_ALL}

  //
  // GetLocalHostAddresses flags (added for DirectX 9)
  //
  DPNGETLOCALHOSTADDRESSES_COMBINED   = $0001;
  {$EXTERNALSYM DPNGETLOCALHOSTADDRESSES_COMBINED}

  //
  // Get send queue info flags (For GetSendQueueInfo)
  //
  DPNGETSENDQUEUEINFO_PRIORITY_NORMAL = $0001;
  {$EXTERNALSYM DPNGETSENDQUEUEINFO_PRIORITY_NORMAL}
  DPNGETSENDQUEUEINFO_PRIORITY_HIGH   = $0002;
  {$EXTERNALSYM DPNGETSENDQUEUEINFO_PRIORITY_HIGH}
  DPNGETSENDQUEUEINFO_PRIORITY_LOW    = $0004;
  {$EXTERNALSYM DPNGETSENDQUEUEINFO_PRIORITY_LOW}

  //
  // Group information flags (For Group Info)
  //
  DPNGROUP_AUTODESTRUCT               = $0001;
  {$EXTERNALSYM DPNGROUP_AUTODESTRUCT}

  //
  // Host flags (For Host)
  //
  DPNHOST_OKTOQUERYFORADDRESSING      = $0001;
  {$EXTERNALSYM DPNHOST_OKTOQUERYFORADDRESSING}

  //
  // Set info
  //
  DPNINFO_NAME                        = $0001;
  {$EXTERNALSYM DPNINFO_NAME}
  DPNINFO_DATA                        = $0002;
  {$EXTERNALSYM DPNINFO_DATA}

  //
  // Initialize flags (For Initialize)
  //
  DPNINITIALIZE_DISABLEPARAMVAL       = $0001;
  {$EXTERNALSYM DPNINITIALIZE_DISABLEPARAMVAL}
  // Flags added for DirectX 9
  DPNINITIALIZE_HINT_LANSESSION       = $0002;
  {$EXTERNALSYM DPNINITIALIZE_HINT_LANSESSION}
  DPNINITIALIZE_DISABLELINKTUNING     = $0004;
  {$EXTERNALSYM DPNINITIALIZE_DISABLELINKTUNING}


  //
  // Register Lobby flags
  //
  DPNLOBBY_REGISTER                   = $0001;
  {$EXTERNALSYM DPNLOBBY_REGISTER}
  DPNLOBBY_UNREGISTER                 = $0002;
  {$EXTERNALSYM DPNLOBBY_UNREGISTER}

  //
  // Player information flags (For Player Info / Player Messages)
  //
  DPNPLAYER_LOCAL       = $0002;
  {$EXTERNALSYM DPNPLAYER_LOCAL}
  DPNPLAYER_HOST        = $0004;
  {$EXTERNALSYM DPNPLAYER_HOST}

  //
  // Receive indication flags (added for DirectX 9)
  //
  DPNRECEIVE_GUARANTEED       = $0001;
  {$EXTERNALSYM DPNRECEIVE_GUARANTEED}
  DPNRECEIVE_COALESCED        = $0002;
  {$EXTERNALSYM DPNRECEIVE_COALESCED}

  //
  // Remove player from group flags (For RemovePlayerFromGroup)
  //
  DPNREMOVEPLAYERFROMGROUP_SYN = DPNOP_SYNC;
  {$EXTERNALSYM DPNREMOVEPLAYERFROMGROUP_SYN}

  //
  // Send flags (For Send/SendTo)
  //
  DPNSEND_SYNC                = DPNOP_SYNC;
  {$EXTERNALSYM DPNSEND_SYNC}
  DPNSEND_NOCOPY              = $0001;
  {$EXTERNALSYM DPNSEND_NOCOPY}
  DPNSEND_NOCOMPLETE          = $0002;
  {$EXTERNALSYM DPNSEND_NOCOMPLETE}
  DPNSEND_COMPLETEONPROCESS   = $0004;
  {$EXTERNALSYM DPNSEND_COMPLETEONPROCESS}
  DPNSEND_GUARANTEED          = $0008;
  {$EXTERNALSYM DPNSEND_GUARANTEED}
  DPNSEND_NONSEQUENTIAL       = $0010;
  {$EXTERNALSYM DPNSEND_NONSEQUENTIAL}
  DPNSEND_NOLOOPBACK          = $0020;
  {$EXTERNALSYM DPNSEND_NOLOOPBACK}
  DPNSEND_PRIORITY_LOW        = $0040;
  {$EXTERNALSYM DPNSEND_PRIORITY_LOW}
  DPNSEND_PRIORITY_HIGH       = $0080;
  {$EXTERNALSYM DPNSEND_PRIORITY_HIGH}
  // Flag added for DirectX 9
  DPNSEND_COALESCE						= $0100;
  {$EXTERNALSYM DPNSEND_COALESCE}

  //
  // Send complete indication flags (added for DirectX 9)
  //
  DPNSENDCOMPLETE_GUARANTEED				= $0001;
  {$EXTERNALSYM DPNSENDCOMPLETE_GUARANTEED}
  DPNSENDCOMPLETE_COALESCED				= $0002;
  {$EXTERNALSYM DPNSENDCOMPLETE_COALESCED}

  //
  // Session Flags (for DPN_APPLICATION_DESC)
  //
  DPNSESSION_CLIENT_SERVER    = $0001;
  {$EXTERNALSYM DPNSESSION_CLIENT_SERVER}
  DPNSESSION_MIGRATE_HOST     = $0004;
  {$EXTERNALSYM DPNSESSION_MIGRATE_HOST}
  DPNSESSION_NODPNSVR         = $0040;
  {$EXTERNALSYM DPNSESSION_NODPNSVR}
  DPNSESSION_REQUIREPASSWORD  = $0080;
  {$EXTERNALSYM DPNSESSION_REQUIREPASSWORD}
  // Flag added for DirectX 9
  DPNSESSION_NOENUMS						= $0100;
  {$EXTERNALSYM DPNSESSION_NOENUMS}
  DPNSESSION_FAST_SIGNED					= $0200;
  {$EXTERNALSYM DPNSESSION_FAST_SIGNED}
  DPNSESSION_FULL_SIGNED					= $0400;
  {$EXTERNALSYM DPNSESSION_FULL_SIGNED}

  //
  // Set client info flags (For SetClientInfo)
  //
  DPNSETCLIENTINFO_SYNC       = DPNOP_SYNC;
  {$EXTERNALSYM DPNSETCLIENTINFO_SYNC}

  //
  // Set group info flags (For SetGroupInfo)
  //
  DPNSETGROUPINFO_SYNC        = DPNOP_SYNC;
  {$EXTERNALSYM DPNSETGROUPINFO_SYNC}

  //
  // Set peer info flags (For SetPeerInfo)
  //
  DPNSETPEERINFO_SYNC         = DPNOP_SYNC;
  {$EXTERNALSYM DPNSETPEERINFO_SYNC}

  //
  // Set server info flags (For SetServerInfo)
  //
  DPNSETSERVERINFO_SYNC       = DPNOP_SYNC;
  {$EXTERNALSYM DPNSETSERVERINFO_SYNC}

  //
  // SP capabilities flags
  //
  DPNSPCAPS_SUPPORTSDPNSVR      = $0001;
  {$EXTERNALSYM DPNSPCAPS_SUPPORTSDPNSVR}
  DPNSPCAPS_SUPPORTSDPNSRV      = DPNSPCAPS_SUPPORTSDPNSVR;
  {$EXTERNALSYM DPNSPCAPS_SUPPORTSDPNSRV}
  DPNSPCAPS_SUPPORTSBROADCAST   = $0002;
  {$EXTERNALSYM DPNSPCAPS_SUPPORTSBROADCAST}
  DPNSPCAPS_SUPPORTSALLADAPTERS = $0004;
  {$EXTERNALSYM DPNSPCAPS_SUPPORTSALLADAPTERS}
  // Flags added for DirectX 9
  DPNSPCAPS_SUPPORTSTHREADPOOL			= $0008;
  {$EXTERNALSYM DPNSPCAPS_SUPPORTSTHREADPOOL}
  DPNSPCAPS_NETWORKSIMULATOR				= $0010;
  {$EXTERNALSYM DPNSPCAPS_NETWORKSIMULATOR}

  //
  // SP information flags (added for DirectX 9)
  //
  DPNSPINFO_NETWORKSIMULATORDEVICE		= $0001;
  {$EXTERNALSYM DPNSPINFO_NETWORKSIMULATORDEVICE}

(****************************************************************************
 *
 * DirectPlay8 Structures (Non-Message)
 *
 ****************************************************************************)

type
  //
  // Application description
  //

  PDPNApplicationDesc = ^TDPNApplicationDesc;
  _DPN_APPLICATION_DESC = packed record
    dwSize: DWORD;                    // Size of this structure
    dwFlags: DWORD;                   // Flags (DPNSESSION_...)
    guidInstance: TGUID;              // Instance GUID
    guidApplication: TGUID;           // Application GUID
    dwMaxPlayers: DWORD;              // Maximum # of players allowed (0=no limit)
    dwCurrentPlayers: DWORD;          // Current # of players allowed
    pwszSessionName: PWideChar;       // Name of the session
    pwszPassword: PWideChar;          // Password for the session
    pvReservedData: Pointer;
    dwReservedDataSize: DWORD;
    pvApplicationReservedData: Pointer;
    dwApplicationReservedDataSize: DWORD;
  end;
  {$EXTERNALSYM _DPN_APPLICATION_DESC}
  DPN_APPLICATION_DESC = _DPN_APPLICATION_DESC;
  {$EXTERNALSYM DPN_APPLICATION_DESC}
  TDPNApplicationDesc = _DPN_APPLICATION_DESC;

  //
  // Generic Buffer Description
  //
  PBufferDesc = ^TBufferDesc;
  _BUFFERDESC = packed record
    wBufferSize:DWORD;
    pBufferData: PByte;
  end;
  {$EXTERNALSYM _BUFFERDESC}
  BUFFERDESC = _BUFFERDESC;
  {$EXTERNALSYM BUFFERDESC}
  TBufferDesc = _BUFFERDESC;

  PDPNBufferDesc = ^TDPNBufferDesc;
  DPN_BUFFER_DESC = _BUFFERDESC;
  {$EXTERNALSYM DPN_BUFFER_DESC}
  TDPNBufferDesc = DPN_BUFFER_DESC;

  //
  // DirectPlay8 capabilities
  //
  PDPNCaps = ^TDPNCaps;
  _DPN_CAPS = packed record
    dwSize: DWORD;							// Size of this structure
    dwFlags: DWORD;						// Flags
    dwConnectTimeout: DWORD;				// ms before a connect request times out
    dwConnectRetries: DWORD;				// # of times to attempt the connection
    dwTimeoutUntilKeepAlive: DWORD;		// ms of inactivity before a keep alive is sent
  end;
  {$EXTERNALSYM _DPN_CAPS}
  DPN_CAPS = _DPN_CAPS;
  {$EXTERNALSYM DPN_CAPS}
  TDPNCaps = _DPN_CAPS;

  //
  // Extended capabilities structures (added for DirectX 9)
  //
  PDPNCapsEx = ^TDPNCapsEx;
  _DPN_CAPS_EX = packed record
    dwSize: DWORD;						// Size of this structure
    dwFlags: DWORD;						// Flags
    dwConnectTimeout: DWORD;			// ms before a connect request times out
    dwConnectRetries: DWORD;				// # of times to attempt the connection
    dwTimeoutUntilKeepAlive: DWORD;		// ms of inactivity before a keep alive is sent
    dwMaxRecvMsgSize: DWORD;			// maximum size in bytes of message that can be received
    dwNumSendRetries: DWORD;			// maximum number of send retries before link is considered dead
    dwMaxSendRetryInterval: DWORD;		// maximum period in msec between send retries
    dwDropThresholdRate: DWORD;			// percentage of dropped packets before throttling
    dwThrottleRate: DWORD;				// percentage amount to reduce send window when throttling
    dwNumHardDisconnectSends: DWORD;	// number of hard disconnect frames to send when close immediate flag is specified
    dwMaxHardDisconnectPeriod: DWORD;	// maximum period between hard disconnect sends
  end;
  {$EXTERNALSYM _DPN_CAPS_EX}
  DPN_CAPS_EX = _DPN_CAPS_EX;
  {$EXTERNALSYM DPN_CAPS_EX}
  TDPNCapsEx = _DPN_CAPS_EX;

  // Connection Statistics information

  PDPNConnectionInfo = ^TDPNConnectionInfo;
  _DPN_CONNECTION_INFO = packed record
    dwSize: DWORD;
    dwRoundTripLatencyMS: DWORD;
    dwThroughputBPS: DWORD;
    dwPeakThroughputBPS: DWORD;

    dwBytesSentGuaranteed: DWORD;
    dwPacketsSentGuaranteed: DWORD;
    dwBytesSentNonGuaranteed: DWORD;
    dwPacketsSentNonGuaranteed: DWORD;

    dwBytesRetried: DWORD;    // Guaranteed only
    dwPacketsRetried: DWORD;  // Guaranteed only
    dwBytesDropped: DWORD;    // Non Guaranteed only
    dwPacketsDropped: DWORD;  // Non Guaranteed only

    dwMessagesTransmittedHighPriority: DWORD;
    dwMessagesTimedOutHighPriority: DWORD;
    dwMessagesTransmittedNormalPriority: DWORD;
    dwMessagesTimedOutNormalPriority: DWORD;
    dwMessagesTransmittedLowPriority: DWORD;
    dwMessagesTimedOutLowPriority: DWORD;

    dwBytesReceivedGuaranteed: DWORD;
    dwPacketsReceivedGuaranteed: DWORD;
    dwBytesReceivedNonGuaranteed: DWORD;
    dwPacketsReceivedNonGuaranteed: DWORD;
    dwMessagesReceived: DWORD;
  end;
  {$EXTERNALSYM _DPN_CONNECTION_INFO}
  DPN_CONNECTION_INFO = _DPN_CONNECTION_INFO;
  {$EXTERNALSYM DPN_CONNECTION_INFO}
  TDPNConnectionInfo = _DPN_CONNECTION_INFO;


  //
  // Group information strucutre
  //
  PDPNGroupInfo = ^TDPNGroupInfo;
  _DPN_GROUP_INFO = packed record
    dwSize: DWORD;          // size of this structure
    dwInfoFlags: DWORD;     // information contained
    pwszName: PWideChar;    // Unicode Name
    pvData: Pointer;        // data block
    dwDataSize: DWORD;      // size in BYTES of data block
    dwGroupFlags: DWORD;    // group flags (DPNGROUP_...)
  end;
  {$EXTERNALSYM _DPN_GROUP_INFO}
  DPN_GROUP_INFO = _DPN_GROUP_INFO;
  {$EXTERNALSYM DPN_GROUP_INFO}
  TDPNGroupInfo = _DPN_GROUP_INFO;

  //
  // Player information structure
  //
  PDPNPlayerInfo = ^TDPNPlayerInfo;
  _DPN_PLAYER_INFO = packed record
    dwSize: DWORD;          // size of this structure
    dwInfoFlags: DWORD;     // information contained
    pwszName: PWideChar;    // Unicode Name
    pvData: Pointer;        // data block
    dwDataSize: DWORD;      // size in BYTES of data block
    dwPlayerFlags: DWORD;   // player flags (DPNPLAYER_...)
  end;
  {$EXTERNALSYM _DPN_PLAYER_INFO}
  DPN_PLAYER_INFO = _DPN_PLAYER_INFO;
  {$EXTERNALSYM DPN_PLAYER_INFO}
  TDPNPlayerInfo = _DPN_PLAYER_INFO;

  PDPNSecurityCredentials = ^TDPNSecurityCredentials;
  _DPN_SECURITY_CREDENTIALS = record
  end;
  {$EXTERNALSYM _DPN_SECURITY_CREDENTIALS}
  DPN_SECURITY_CREDENTIALS = _DPN_SECURITY_CREDENTIALS;
  {$EXTERNALSYM DPN_SECURITY_CREDENTIALS}
  TDPNSecurityCredentials = _DPN_SECURITY_CREDENTIALS;

  PDPNSecurityDesc = ^TDPNSecurityDesc;
  _DPN_SECURITY_DESC = record
  end;
  {$EXTERNALSYM _DPN_SECURITY_DESC}
  DPN_SECURITY_DESC = _DPN_SECURITY_DESC;
  {$EXTERNALSYM DPN_SECURITY_DESC}
  TDPNSecurityDesc = _DPN_SECURITY_DESC;

  //
  // Service provider & adapter enumeration structure
  //
  PDPNServiceProviderInfo = ^TDPNServiceProviderInfo;
  _DPN_SERVICE_PROVIDER_INFO = packed record
     dwFlags: DWORD;
     guid: TGUID;            // SP Guid
     pwszName: PWideChar;    // Friendly Name
     pvReserved: Pointer;
     dwReserved: DWORD;
  end;
  {$EXTERNALSYM _DPN_SERVICE_PROVIDER_INFO}
  DPN_SERVICE_PROVIDER_INFO = _DPN_SERVICE_PROVIDER_INFO;
  {$EXTERNALSYM DPN_SERVICE_PROVIDER_INFO}
  TDPNServiceProviderInfo = _DPN_SERVICE_PROVIDER_INFO;

  //
  // Service provider caps structure
  //
  PDPNSpCaps = ^TDPNSpCaps;
  _DPN_SP_CAPS = packed record
    dwSize: DWORD;                   // Size of this structure
    dwFlags: DWORD;                  // Flags ((DPNSPCAPS_...)
    dwNumThreads: DWORD;             // # of worker threads to use
    dwDefaultEnumCount: DWORD;       // default # of enum requests
    dwDefaultEnumRetryInterval: DWORD; // default ms between enum requests
    dwDefaultEnumTimeout: DWORD;     // default enum timeout
    dwMaxEnumPayloadSize: DWORD;     // maximum size in bytes for enum payload data
    dwBuffersPerThread: DWORD;       // number of receive buffers per thread
    dwSystemBufferSize: DWORD;       // amount of buffering to do in addition to posted receive buffers
  end;
  {$EXTERNALSYM _DPN_SP_CAPS}
  DPN_SP_CAPS = _DPN_SP_CAPS;
  {$EXTERNALSYM DPN_SP_CAPS}
  TDPNSpCaps = _DPN_SP_CAPS;


(****************************************************************************
 *
 * IDirectPlay8 message handler call back structures
 *
 ****************************************************************************)

  //
  // Add player to group strucutre for message handler
  // (DPN_MSGID_ADD_PLAYER_TO_GROUP)
  //
  PDPNMsgAddPlayerToGroup = ^TDPNMsgAddPlayerToGroup;
  _DPNMSG_ADD_PLAYER_TO_GROUP = packed record
    dwSize: DWORD;            // Size of this structure
    dpnidGroup: TDPNID;       // DPNID of group
    pvGroupContext: Pointer;  // Group context value
    dpnidPlayer: TDPNID;      // DPNID of added player
    pvPlayerContext: Pointer; // Player context value
  end;
  {$EXTERNALSYM _DPNMSG_ADD_PLAYER_TO_GROUP}
  DPNMSG_ADD_PLAYER_TO_GROUP = _DPNMSG_ADD_PLAYER_TO_GROUP;
  {$EXTERNALSYM DPNMSG_ADD_PLAYER_TO_GROUP}
  TDPNMsgAddPlayerToGroup = _DPNMSG_ADD_PLAYER_TO_GROUP;

  //
  // Async operation completion structure for message handler
  // (DPN_MSGID_ASYNC_OP_COMPLETE)
  //
  PDPNMsgAsyncOpComplete = ^TDPNMsgAsyncOpComplete;
  _DPNMSG_ASYNC_OP_COMPLETE = packed record
    dwSize: DWORD;          // Size of this structure
    hAsyncOp: TDPNHandle;   // DirectPlay8 async operation handle
    pvUserContext: Pointer; // User context supplied
    hResultCode: HRESULT;   // HRESULT of operation
  end;
  {$EXTERNALSYM _DPNMSG_ASYNC_OP_COMPLETE}
  DPNMSG_ASYNC_OP_COMPLETE = _DPNMSG_ASYNC_OP_COMPLETE;
  {$EXTERNALSYM DPNMSG_ASYNC_OP_COMPLETE}
  TDPNMsgAsyncOpComplete = _DPNMSG_ASYNC_OP_COMPLETE;

  //
  // Client info structure for message handler
  // (DPN_MSGID_CLIENT_INFO)
  //
  PDPNMsgClientInfo = ^TDPNMsgClientInfo;
  _DPNMSG_CLIENT_INFO = packed record
    dwSize: DWORD;            // Size of this structure
    dpnidClient: TDPNID;      // DPNID of client
    pvPlayerContext: Pointer; // Player context value
  end;
  {$EXTERNALSYM _DPNMSG_CLIENT_INFO}
  DPNMSG_CLIENT_INFO = _DPNMSG_CLIENT_INFO;
  {$EXTERNALSYM DPNMSG_CLIENT_INFO}
  TDPNMsgClientInfo = _DPNMSG_CLIENT_INFO;

  //
  // Connect complete structure for message handler
  // (DPN_MSGID_CONNECT_COMPLETE)
  //
  PDPNMsgConnectComplete = ^TDPNMsgConnectComplete;
  _DPNMSG_CONNECT_COMPLETE = packed record
    dwSize: DWORD;                     // Size of this structure
    hAsyncOp: TDPNHandle;              // DirectPlay8 Async operation handle
    pvUserContext: Pointer;            // User context supplied at Connect
    hResultCode: HRESULT;              // HRESULT of connection attempt
    pvApplicationReplyData: Pointer;   // Connection reply data from Host/Server
    dwApplicationReplyDataSize: DWORD; // Size (in bytes) of pvApplicationReplyData

    // Fields added for DirectX 9
    dpnidLocal: TDPNID;                // DPNID of local player
  end;
  {$EXTERNALSYM _DPNMSG_CONNECT_COMPLETE}
  DPNMSG_CONNECT_COMPLETE = _DPNMSG_CONNECT_COMPLETE;
  {$EXTERNALSYM DPNMSG_CONNECT_COMPLETE}
  TDPNMsgConnectComplete = _DPNMSG_CONNECT_COMPLETE;

  //
  // Create group structure for message handler
  // (DPN_MSGID_CREATE_GROUP)
  //
  PDPNMsgCreateGroup = ^TDPNMsgCreateGroup;
  _DPNMSG_CREATE_GROUP = packed record
    dwSize: DWORD;           // Size of this structure
    dpnidGroup: TDPNID;      // DPNID of new group
    dpnidOwner: TDPNID;      // Owner of newgroup
    pvGroupContext: Pointer; // Group context value

    // Fields added for DirectX 9
    pvOwnerContext: Pointer; // Owner context value
  end;
  {$EXTERNALSYM _DPNMSG_CREATE_GROUP}
  DPNMSG_CREATE_GROUP = _DPNMSG_CREATE_GROUP;
  {$EXTERNALSYM DPNMSG_CREATE_GROUP}
  TDPNMsgCreateGroup = _DPNMSG_CREATE_GROUP;

  //
  // Create player structure for message handler
  // (DPN_MSGID_CREATE_PLAYER)
  //
  PDPNMsgCreatePlayer = ^TDPNMsgCreatePlayer;
  _DPNMSG_CREATE_PLAYER = packed record
    dwSize: DWORD;            // Size of this structure
    dpnidPlayer: DPNID;       // DPNID of new player
    pvPlayerContext: Pointer; // Player context value
  end;
  {$EXTERNALSYM _DPNMSG_CREATE_PLAYER}
  DPNMSG_CREATE_PLAYER = _DPNMSG_CREATE_PLAYER;
  {$EXTERNALSYM DPNMSG_CREATE_PLAYER}
  TDPNMsgCreatePlayer = _DPNMSG_CREATE_PLAYER;

  //
  // Destroy group structure for message handler
  // (DPN_MSGID_DESTROY_GROUP)
  //
  PDPNMsgDestroyGroup = ^TDPNMsgDestroyGroup;
  _DPNMSG_DESTROY_GROUP = packed record
    dwSize: DWORD;           // Size of this structure
    dpnidGroup: TDPNID;      // DPNID of destroyed group
    pvGroupContext: Pointer; // Group context value
    dwReason: DWORD;         // Information only
  end;
  {$EXTERNALSYM _DPNMSG_DESTROY_GROUP}
  DPNMSG_DESTROY_GROUP = _DPNMSG_DESTROY_GROUP;
  {$EXTERNALSYM DPNMSG_DESTROY_GROUP}
  TDPNMsgDestroyGroup = _DPNMSG_DESTROY_GROUP;

  //
  // Destroy player structure for message handler
  // (DPN_MSGID_DESTROY_PLAYER)
  //
  PDPNMsgDestroyPlayer = ^TDPNMsgDestroyPlayer;
  _DPNMSG_DESTROY_PLAYER = packed record
    dwSize: DWORD;            // Size of this structure
    dpnidPlayer: TDPNID;      // DPNID of leaving player
    pvPlayerContext: Pointer; // Player context value
    dwReason: DWORD;          // Information only
  end;
  {$EXTERNALSYM _DPNMSG_DESTROY_PLAYER}
  DPNMSG_DESTROY_PLAYER = _DPNMSG_DESTROY_PLAYER;
  {$EXTERNALSYM DPNMSG_DESTROY_PLAYER}
  TDPNMsgDestroyPlayer = _DPNMSG_DESTROY_PLAYER;

  //
  // Enumeration request received structure for message handler
  // (DPN_MSGID_ENUM_HOSTS_QUERY)
  //
  PDPNMsgEnumHostsQuery = ^TDPNMsgEnumHostsQuery;
  _DPNMSG_ENUM_HOSTS_QUERY = packed record
    dwSize: DWORD;                        // Size of this structure.
    pAddressSender: IDirectPlay8Address;  // Address of client who sent the request
    pAddressDevice: IDirectPlay8Address;  // Address of device request was received on
    pvReceivedData: Pointer;              // Request data (set on client)
    dwReceivedDataSize: DWORD;            // Request data size (set on client)
    dwMaxResponseDataSize: DWORD;         // Max allowable size of enum response
    pvResponseData: Pointer;              // Optional query repsonse (user set)
    dwResponseDataSize: DWORD;            // Optional query response size (user set)
    pvResponseContext: Pointer;           // Optional query response context (user set)
  end;
  {$EXTERNALSYM _DPNMSG_ENUM_HOSTS_QUERY}
  DPNMSG_ENUM_HOSTS_QUERY = _DPNMSG_ENUM_HOSTS_QUERY;
  {$EXTERNALSYM DPNMSG_ENUM_HOSTS_QUERY}
  TDPNMsgEnumHostsQuery = _DPNMSG_ENUM_HOSTS_QUERY;

  //
  // Enumeration response received structure for message handler
  // (DPN_MSGID_ENUM_HOSTS_RESPONSE)
  //
  PDPNMsgEnumHostsResponse = ^TDPNMsgEnumHostsResponse;
  _DPNMSG_ENUM_HOSTS_RESPONSE = packed record
    dwSize: DWORD;                                // Size of this structure
    pAddressSender: IDirectPlay8Address;          // Address of host who responded
    pAddressDevice: IDirectPlay8Address;          // Device response was received on
    pApplicationDescription: PDPNApplicationDesc; // Application description for the session
    pvResponseData: Pointer;                      // Optional response data (set on host)
    dwResponseDataSize: DWORD;                    // Optional response data size (set on host)
    pvUserContext: Pointer;                       // Context value supplied for enumeration
    dwRoundTripLatencyMS: DWORD;                  // Round trip latency in MS
  end;
  {$EXTERNALSYM _DPNMSG_ENUM_HOSTS_RESPONSE}
  DPNMSG_ENUM_HOSTS_RESPONSE = _DPNMSG_ENUM_HOSTS_RESPONSE;
  {$EXTERNALSYM DPNMSG_ENUM_HOSTS_RESPONSE}
  TDPNMsgEnumHostsResponse = _DPNMSG_ENUM_HOSTS_RESPONSE;

  //
  // Group info structure for message handler
  // (DPN_MSGID_GROUP_INFO)
  //
  PDPNMsgGroupInfo = ^TDPNMsgGroupInfo;
  _DPNMSG_GROUP_INFO = packed record
    dwSize: DWORD;              // Size of this structure
    dpnidGroup: TDPNID;         // DPNID of group
    pvGroupContext: Pointer;    // Group context value
  end;
  {$EXTERNALSYM _DPNMSG_GROUP_INFO}
  DPNMSG_GROUP_INFO = _DPNMSG_GROUP_INFO;
  {$EXTERNALSYM DPNMSG_GROUP_INFO}
  TDPNMsgGroupInfo = _DPNMSG_GROUP_INFO;

  //
  // Migrate host structure for message handler
  // (DPN_MSGID_HOST_MIGRATE)
  //
  PDPNMsgHostMigrate = ^TDPNMsgHostMigrate;
  _DPNMSG_HOST_MIGRATE = packed record
    dwSize: DWORD;             // Size of this structure
    dpnidNewHost: TDPNID;      // DPNID of new Host player
    pvPlayerContext: Pointer;  // Player context value
  end;
  {$EXTERNALSYM _DPNMSG_HOST_MIGRATE}
  DPNMSG_HOST_MIGRATE = _DPNMSG_HOST_MIGRATE;
  {$EXTERNALSYM DPNMSG_HOST_MIGRATE}
  TDPNMsgHostMigrate = _DPNMSG_HOST_MIGRATE;

  //
  // Indicate connect structure for message handler
  // (DPN_MSGID_INDICATE_CONNECT)
  //
  PDPNMsgIndicateConnect = ^TDPNMsgIndicateConnect;
  _DPNMSG_INDICATE_CONNECT = packed record
    dwSize: DWORD;                        // Size of this structure
    pvUserConnectData: Pointer;           // Connecting player data
    dwUserConnectDataSize: DWORD;         // Size (in bytes) of pvUserConnectData
    pvReplyData: Pointer;                 // Connection reply data
    dwReplyDataSize: DWORD;               // Size (in bytes) of pvReplyData
    pvReplyContext: Pointer;              // Buffer context for pvReplyData
    pvPlayerContext: Pointer;             // Player context preset
    pAddressPlayer: IDirectPlay8Address;  // Address of connecting player
    pAddressDevice: IDirectPlay8Address;  // Address of device receiving connect attempt
  end;
  {$EXTERNALSYM _DPNMSG_INDICATE_CONNECT}
  DPNMSG_INDICATE_CONNECT = _DPNMSG_INDICATE_CONNECT;
  {$EXTERNALSYM DPNMSG_INDICATE_CONNECT}
  TDPNMsgIndicateConnect = _DPNMSG_INDICATE_CONNECT;

  //
  // Indicated connect aborted structure for message handler
  // (DPN_MSGID_INDICATED_CONNECT_ABORTED)
  //
  PDPNMsgIndicatedConnectAborted = ^TDPNMsgIndicatedConnectAborted;
  _DPNMSG_INDICATED_CONNECT_ABORTED = packed record
    dwSize: DWORD;            // Size of this structure
    pvPlayerContext: Pointer; // Player context preset from DPNMSG_INDICATE_CONNECT
  end;
  {$EXTERNALSYM _DPNMSG_INDICATED_CONNECT_ABORTED}
  DPNMSG_INDICATED_CONNECT_ABORTED = _DPNMSG_INDICATED_CONNECT_ABORTED;
  {$EXTERNALSYM DPNMSG_INDICATED_CONNECT_ABORTED}
  TDPNMsgIndicatedConnectAborted = _DPNMSG_INDICATED_CONNECT_ABORTED;

  //
  // Peer info structure for message handler
  // (DPN_MSGID_PEER_INFO)
  //
  PDPNMsgPeerInfo = ^TDPNMsgPeerInfo;
  _DPNMSG_PEER_INFO = packed record
    dwSize: DWORD;              // Size of this structure
    dpnidPeer: TDPNID;          // DPNID of peer
    pvPlayerContext: Pointer;   // Player context value
  end;
  {$EXTERNALSYM _DPNMSG_PEER_INFO}
  DPNMSG_PEER_INFO = _DPNMSG_PEER_INFO;
  {$EXTERNALSYM DPNMSG_PEER_INFO}
  TDPNMsgPeerInfo = _DPNMSG_PEER_INFO;

  //
  // Receive structure for message handler
  // (DPN_MSGID_RECEIVE)
  //
  PDPNMsgReceive = ^TDPNMsgReceive;
  _DPNMSG_RECEIVE = packed record
    dwSize: DWORD;             // Size of this structure
    dpnidSender: TDPNID;       // DPNID of sending player
    pvPlayerContext: Pointer;  // Player context value of sending player
    pReceiveData: PByte;       // Received data
    dwReceiveDataSize: DWORD;  // Size (in bytes) of pReceiveData
    hBufferHandle: TDPNHandle; // Buffer handle for pReceiveData

    // Fields added for DirectX 9
    dwReceiveFlags: DWORD;     // Flags describing how message was received
  end;
  {$EXTERNALSYM _DPNMSG_RECEIVE}
  DPNMSG_RECEIVE = _DPNMSG_RECEIVE;
  {$EXTERNALSYM DPNMSG_RECEIVE}
  TDPNMsgReceive = _DPNMSG_RECEIVE;

  //
  // Remove player from group structure for message handler
  // (DPN_MSGID_REMOVE_PLAYER_FROM_GROUP)
  //
  PDPNMsgRemovePlayerFromGroup = ^TDPNMsgRemovePlayerFromGroup;
  _DPNMSG_REMOVE_PLAYER_FROM_GROUP = packed record
    dwSize: DWORD;               // Size of this structure
    dpnidGroup: TDPNID;          // DPNID of group
    pvGroupContext: Pointer;     // Group context value
    dpnidPlayer: TDPNID;         // DPNID of deleted player
    pvPlayerContext: Pointer;    // Player context value
  end;
  {$EXTERNALSYM _DPNMSG_REMOVE_PLAYER_FROM_GROUP}
  DPNMSG_REMOVE_PLAYER_FROM_GROUP = _DPNMSG_REMOVE_PLAYER_FROM_GROUP;
  {$EXTERNALSYM DPNMSG_REMOVE_PLAYER_FROM_GROUP}
  TDPNMsgRemovePlayerFromGroup = _DPNMSG_REMOVE_PLAYER_FROM_GROUP;

  //
  // Returned buffer structure for message handler
  // (DPN_MSGID_RETURN_BUFFER)
  //
  PDPNMsgReturnBuffer = ^TDPNMsgReturnBuffer;
  _DPNMSG_RETURN_BUFFER = packed record
    dwSize: DWORD;          // Size of this structure
    hResultCode: HRESULT;   // Return value of operation
    pvBuffer: Pointer;      // Buffer being returned
    pvUserContext: Pointer; // Context associated with buffer
  end;
  {$EXTERNALSYM _DPNMSG_RETURN_BUFFER}
  DPNMSG_RETURN_BUFFER = _DPNMSG_RETURN_BUFFER;
  {$EXTERNALSYM DPNMSG_RETURN_BUFFER}
  TDPNMsgReturnBuffer = _DPNMSG_RETURN_BUFFER;

  //
  // Send complete structure for message handler
  // (DPN_MSGID_SEND_COMPLETE)
  //
  PDPNMsgSendComplete = ^TDPNMsgSendComplete;
  _DPNMSG_SEND_COMPLETE = packed record
    dwSize: DWORD;          // Size of this structure
    hAsyncOp: TDPNHandle;   // DirectPlay8 Async operation handle
    pvUserContext: Pointer; // User context supplied at Send/SendTo
    hResultCode: HRESULT;   // HRESULT of send
    dwSendTime: DWORD;      // Send time in ms

    // Fields added for DirectX 9
    dwFirstFrameRTT: DWORD;		// RTT of the first frame in the message
    dwFirstFrameRetryCount: DWORD;	// Retry count of the first frame
    dwSendCompleteFlags: DWORD;	// Flags describing how message was sent
    pBuffers: PDPNBufferDesc;				// Pointer to array of buffers sent, if DirectPlay did not make a copy
    dwNumBuffers: DWORD;			// Number of buffers in previous array
  end;
  {$EXTERNALSYM _DPNMSG_SEND_COMPLETE}
  DPNMSG_SEND_COMPLETE = _DPNMSG_SEND_COMPLETE;
  {$EXTERNALSYM DPNMSG_SEND_COMPLETE}
  TDPNMsgSendComplete = _DPNMSG_SEND_COMPLETE;

  //
  // Server info structure for message handler
  // (DPN_MSGID_SERVER_INFO)
  //
  PDPNMsgServerInfo = ^TDPNMsgServerInfo;
  _DPNMSG_SERVER_INFO = packed record
    dwSize: DWORD;              // Size of this structure
    dpnidServer: TDPNID;        // DPNID of server
    pvPlayerContext: Pointer;   // Player context value
  end;
  {$EXTERNALSYM _DPNMSG_SERVER_INFO}
  DPNMSG_SERVER_INFO = _DPNMSG_SERVER_INFO;
  {$EXTERNALSYM DPNMSG_SERVER_INFO}
  TDPNMsgServerInfo = _DPNMSG_SERVER_INFO;

  //
  // Terminated session structure for message handler
  // (DPN_MSGID_TERMINATE_SESSION)
  //
  PDPNMsgTerminateSession = ^TDPNMsgTerminateSession;
  _DPNMSG_TERMINATE_SESSION = packed record
    dwSize: DWORD;              // Size of this structure
    hResultCode: HRESULT;       // Reason
    pvTerminateData: Pointer;   // Data passed from Host/Server
    dwTerminateDataSize: DWORD; // Size (in bytes) of pvTerminateData
  end;
  {$EXTERNALSYM _DPNMSG_TERMINATE_SESSION}
  DPNMSG_TERMINATE_SESSION = _DPNMSG_TERMINATE_SESSION;
  {$EXTERNALSYM DPNMSG_TERMINATE_SESSION}
  TDPNMsgTerminateSession = _DPNMSG_TERMINATE_SESSION;

  //
  // Message structures added for DirectX 9
  //

  //
  // Create thread info structure for message handler
  // (DPN_MSGID_CREATE_THREAD)
  //
  PDPNMsgCreateThread = ^TDPNMsgCreateThread;
  _DPNMSG_CREATE_THREAD = packed record
    dwSize: DWORD;				// Size of this structure
    dwFlags: DWORD;			// Flags describing this thread
    dwProcessorNum: DWORD;		// Index of processor to which thread is bound
    pvUserContext: Pointer;		// Thread context value
  end;
  {$EXTERNALSYM _DPNMSG_CREATE_THREAD}
  DPNMSG_CREATE_THREAD = _DPNMSG_CREATE_THREAD;
  {$EXTERNALSYM DPNMSG_CREATE_THREAD}
  TDPNMsgCreateThread = _DPNMSG_CREATE_THREAD;

  //
  // Destroy thread info structure for message handler
  // (DPN_MSGID_DESTROY_THREAD)
  //
  PDPNMsgDestroyThread = ^TDPNMsgDestroyThread;
  _DPNMSG_DESTROY_THREAD = packed record
    dwSize:	DWORD;				// Size of this structure
    dwProcessorNum:	DWORD;		// Index of processor to which thread was bound
    pvUserContext:	Pointer;		// Thread context value
  end;
  {$EXTERNALSYM _DPNMSG_DESTROY_THREAD}
  DPNMSG_DESTROY_THREAD = _DPNMSG_DESTROY_THREAD;
  {$EXTERNALSYM DPNMSG_DESTROY_THREAD}
  TDPNMsgDestroyThread = _DPNMSG_DESTROY_THREAD;


  //
  // Query-to-resolve-NAT-address structure for message handler
  // (DPN_MSGID_NAT_RESOLVER_QUERY)
  //
  PDPNMsgNatResolverQuery = ^TDPNMsgNatResolverQuery;
  _DPNMSG_NAT_RESOLVER_QUERY = packed record
    dwSize: DWORD;				// Size of this structure.
    pAddressSender: IDirectPlay8Address;	// Address of client that sent the query
    pAddressDevice: IDirectPlay8Address;	// Address of device on which query was received
    pwszUserString: PWideChar;	// User specified string, or NULL if none
  end;
  {$EXTERNALSYM _DPNMSG_NAT_RESOLVER_QUERY}
  DPNMSG_NAT_RESOLVER_QUERY = _DPNMSG_NAT_RESOLVER_QUERY;
  {$EXTERNALSYM DPNMSG_NAT_RESOLVER_QUERY}
  TDPNMsgNatResolverQuery = _DPNMSG_NAT_RESOLVER_QUERY;


(****************************************************************************
 *
 * DirectPlay8 Functions
 *
 ****************************************************************************)

(*
 * This function is no longer supported.  It is recommended that CoCreateInstance be used to create
 * DirectPlay8 objects.
 *
 * extern HRESULT WINAPI DirectPlay8Create( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown);
 *
 *)
 

(****************************************************************************
 *
 * DirectPlay8Lobby Interface Pointer
 *
 ****************************************************************************)

  IDirectPlay8LobbiedApplication = interface;

(****************************************************************************
 *
 * DirectPlay8 Application Interfaces
 *
 ****************************************************************************)

  //
  // COM definition for DirectPlay8 Client interface
  //
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8Client);'}
  {$EXTERNALSYM IDirectPlay8Client}
  IDirectPlay8Client = interface(IUnknown)
    ['{5102dacd-241b-11d3-aea7-006097b01411}']
    (*** IDirectPlay8Client methods ***)
    function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall;
    function EnumServiceProviders(pguidServiceProvider, pguidApplication: PGUID;
      pSPInfoBuffer: PDPNServiceProviderInfo; out pcbEnumData, pcReturned: DWORD;
      dwFlags: DWORD): HResult; stdcall;
    function EnumHosts(const pApplicationDesc: TDPNApplicationDesc;
      pAddrHost, pDeviceInfo: IDirectPlay8Address; pUserEnumData: Pointer;
      dwUserEnumDataSize, dwEnumCount, dwRetryInterval, dwTimeOut: DWORD;
      pvUserContext: Pointer; pAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function CancelAsyncOperation(hAsyncHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function Connect(const pdnAppDesc: TDPNApplicationDesc;
      pHostAddr: IDirectPlay8Address; pDeviceInfo: IDirectPlay8Address;
      pdnSecurity: PDPNSecurityDesc; pdnCredentials: PDPNSecurityCredentials;
      pvUserConnectData: Pointer; dwUserConnectDataSize: DWORD; pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function Send(const prgBufferDesc: TDPNBufferDesc; cBufferDesc, dwTimeOut: DWORD;
      pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function GetSendQueueInfo(pdwNumMsgs, pdwNumBytes: PDWORD; dwFlags: DWORD): HResult; stdcall;
    function GetApplicationDesc(pAppDescBuffer: PDPNApplicationDesc; var pcbDataSize: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetClientInfo(const pdpnPlayerInfo: TDPNPlayerInfo; pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function GetServerInfo(pdpnPlayerInfo: PDPNPlayerInfo; var pdwSize: DWORD; dwFlags: DWORD): HResult; stdcall;
    function GetServerAddress(out pAddress: IDirectPlay8Address; dwFlags: DWORD): HResult; stdcall;
    function Close(dwFlags: DWORD): HResult; stdcall;
    function ReturnBuffer(hBufferHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function GetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx
    function SetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx
    function SetSPCaps(const pguidSP: TGUID; const pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall;
    function GetSPCaps(const pguidSP: TGUID; var pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall;
    function GetConnectionInfo(var pdpConnectionInfo: TDPNConnectionInfo; dwFlags: DWORD): HResult; stdcall;
    function RegisterLobby(dpnHandle: TDPNHandle; pIDP8LobbiedApplication: IDirectPlay8LobbiedApplication; dwFlags: DWORD): HResult; stdcall;
  end;

  //
  // COM definition for DirectPlay8 Server interface
  //
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8Server);'}
  {$EXTERNALSYM IDirectPlay8Server}
  IDirectPlay8Server = interface(IUnknown)
    ['{5102dace-241b-11d3-aea7-006097b01411}']
    (*** IDirectPlay8Server methods ***)
    function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall;
    function EnumServiceProviders(pguidServiceProvider, pguidApplication: PGUID;
      pSPInfoBuffer: PDPNServiceProviderInfo; out pcbEnumData, pcReturned: DWORD;
      dwFlags: DWORD): HResult; stdcall;
    function CancelAsyncOperation(hAsyncHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function GetSendQueueInfo(dpnid: TDPNID; pdwNumMsgs, pdwNumBytes: PDWORD; dwFlags: DWORD): HResult; stdcall;
    function GetApplicationDesc(pAppDescBuffer: PDPNApplicationDesc; var pcbDataSize: DWORD; dwFlags: DWORD): HResult; stdcall;
    function GetServerInfo(pdpnPlayerInfo: PDPNPlayerInfo; pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function GetClientInfo(dpnid: TDPNID; pdpnPlayerInfo: PDPNPlayerInfo; pdwSize: PDWORD; dwFlags: DWORD): HResult; stdcall;
    function GetClientAddress(dpnid: TDPNID; out pAddress: IDirectPlay8Address; dwFlags: DWORD): HResult; stdcall;
    function GetLocalHostAddresses(out prgpAddress: IDirectPlay8Address; var pcAddress: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetApplicationDesc(const pad: TDPNApplicationDesc; dwFlags: DWORD): HResult; stdcall;
    function Host(const pdnAppDesc: TDPNApplicationDesc; prgpDeviceInfo: PIDirectPlay8Address;
      cDeviceInfo: DWORD; pdnSecurity: PDPNSecurityDesc; pdnCredentials: PDPNSecurityCredentials;
      pvPlayerContext: Pointer; dwFlags: DWORD): HResult; stdcall;
    function SendTo(dpnid: TDPNID; const prgBufferDesc: TDPNBufferDesc; cBufferDesc, dwTimeOut: DWORD;
      pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function CreateGroup(const pdpnGroupInfo: TDPNGroupInfo; pvGroupContext, pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function DestroyGroup(idGroup: TDPNID; pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function AddPlayerToGroup(idGroup, idClient: TDPNID; pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function RemovePlayerFromGroup(idGroup, idClient: TDPNID; pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function SetGroupInfo(dpnid: TDPNID; const pdpnGroupInfo: TDPNGroupInfo; pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function GetGroupInfo(dpnid: TDPNID; pdpnGroupInfo: PDPNGroupInfo; pdwSize: PDWORD; dwFlags: DWORD): HResult; stdcall; //todo: Changed
    function EnumPlayersAndGroups(prgdpnid: PDPNID; var pcdpnid: DWORD; dwFlags: DWORD): HResult; stdcall;
    function EnumGroupMembers(dpnid: TDPNID; prgdpnid: PDPNID; var pcdpnid: DWORD; dwFlags: DWORD): HResult; stdcall;
    function Close(dwFlags: DWORD): HResult; stdcall;
    function DestroyClient(dpnidClient: TDPNID; pvDestroyData: Pointer; dwDestroyDataSize: DWORD; dwFlags: DWORD): HResult; stdcall;
    function ReturnBuffer(hBufferHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function GetPlayerContext(dpnid: TDPNID; out ppvPlayerContext: Pointer; dwFlags: DWORD): HResult; stdcall;
    function GetGroupContext(dpnid: TDPNID; out ppvGroupContext: Pointer; dwFlags: DWORD): HResult; stdcall;
    function GetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx
    function SetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx
    function SetSPCaps(const pguidSP: TGUID; const pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall;
    function GetSPCaps(const pguidSP: TGUID; var pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall;
    function GetConnectionInfo(dpnid: TDPNID; var pdpConnectionInfo: TDPNConnectionInfo; dwFlags: DWORD): HResult; stdcall;
    function RegisterLobby(dpnHandle: TDPNHandle; pIDP8LobbiedApplication: IDirectPlay8LobbiedApplication; dwFlags: DWORD): HResult; stdcall;
  end;

  //
  // COM definition for DirectPlay8 Peer interface
  //
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8Peer);'}
  {$EXTERNALSYM IDirectPlay8Peer}
  IDirectPlay8Peer = interface(IUnknown)
    ['{5102dacf-241b-11d3-aea7-006097b01411}']
    (*** IDirectPlay8Peer methods ***)
    function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall;
    function EnumServiceProviders(pguidServiceProvider, pguidApplication: PGUID;
      pSPInfoBuffer: PDPNServiceProviderInfo; out pcbEnumData, pcReturned: DWORD;
      dwFlags: DWORD): HResult; stdcall;
    function CancelAsyncOperation(hAsyncHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function Connect(const pdnAppDesc: TDPNApplicationDesc;
      pHostAddr: IDirectPlay8Address; pDeviceInfo: IDirectPlay8Address;
      pdnSecurity: PDPNSecurityDesc; pdnCredentials: PDPNSecurityCredentials;
      pvUserConnectData: Pointer; dwUserConnectDataSize: DWORD;
      pvPlayerContext, pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function SendTo(dpnid: TDPNID; const prgBufferDesc: TDPNBufferDesc; cBufferDesc, dwTimeOut: DWORD;
      pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function GetSendQueueInfo(dpnid: TDPNID; pdwNumMsgs, pdwNumBytes: PDWORD; dwFlags: DWORD): HResult; stdcall;
    function Host(const pdnAppDesc: TDPNApplicationDesc; prgpDeviceInfo: PIDirectPlay8Address;
      cDeviceInfo: DWORD; pdnSecurity: PDPNSecurityDesc; pdnCredentials: PDPNSecurityCredentials;
      pvPlayerContext: Pointer; dwFlags: DWORD): HResult; stdcall;
    function GetApplicationDesc(pAppDescBuffer: PDPNApplicationDesc; var pcbDataSize: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetApplicationDesc(const pad: TDPNApplicationDesc; dwFlags: DWORD): HResult; stdcall;
    function CreateGroup(const pdpnGroupInfo: TDPNGroupInfo; pvGroupContext, pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function DestroyGroup(idGroup: TDPNID; pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function AddPlayerToGroup(idGroup, idClient: TDPNID; pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function RemovePlayerFromGroup(idGroup, idClient: TDPNID; pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function SetGroupInfo(dpnid: TDPNID; const pdpnGroupInfo: TDPNGroupInfo; pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function GetGroupInfo(dpnid: TDPNID; pdpnGroupInfo: PDPNGroupInfo; pdwSize: PDWORD; dwFlags: DWORD): HResult; stdcall; //todo: Changed
    function EnumPlayersAndGroups(prgdpnid: PDPNID; var pcdpnid: DWORD; dwFlags: DWORD): HResult; stdcall;
    function EnumGroupMembers(dpnid: TDPNID; prgdpnid: PDPNID; var pcdpnid: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetPeerInfo(const pdpnPlayerInfo: TDPNPlayerInfo; pvAsyncContext: Pointer;
      phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function GetPeerInfo(dpnid: TDPNID; var pdpnPlayerInfo: TDPNPlayerInfo; pdwSize: PDWORD; dwFlags: DWORD): HResult; stdcall; //todo: Changed
    function GetPeerAddress(dpnid: TDPNID; out pAddress: IDirectPlay8Address; dwFlags: DWORD): HResult; stdcall;
    function GetLocalHostAddresses(prgpAddress: PIDirectPlay8Address; var pcAddress: DWORD; dwFlags: DWORD): HResult; stdcall;
    function Close(dwFlags: DWORD): HResult; stdcall;
    function EnumHosts(const pApplicationDesc: TDPNApplicationDesc;
      pAddrHost, pDeviceInfo: IDirectPlay8Address; pUserEnumData: Pointer;
      dwUserEnumDataSize, dwEnumCount, dwRetryInterval, dwTimeOut: DWORD;
      pvUserContext: Pointer; pAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function DestroyPeer(dpnidClient: TDPNID; pvDestroyData: Pointer; dwDestroyDataSize, dwFlags: DWORD): HResult; stdcall;
    function ReturnBuffer(hBufferHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function GetPlayerContext(dpnid: TDPNID; out ppvPlayerContext: Pointer; dwFlags: DWORD): HResult; stdcall;
    function GetGroupContext(dpnid: TDPNID; out ppvGroupContext: Pointer; dwFlags: DWORD): HResult; stdcall;
    function GetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx
    function SetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx
    function SetSPCaps(const pguidSP: TGUID; const pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall;
    function GetSPCaps(const pguidSP: TGUID; var pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall;
    function GetConnectionInfo(dpnid: TDPNID; var pdpConnectionInfo: TDPNConnectionInfo; dwFlags: DWORD): HResult; stdcall;
    function RegisterLobby(dpnHandle: TDPNHandle; pIDP8LobbiedApplication: IDirectPlay8LobbiedApplication; dwFlags: DWORD): HResult; stdcall; 
    function TerminateSession(pvTerminateData: Pointer; dwTerminateDataSize, dwFlags: DWORD): HResult; stdcall;
  end;


  //
  // COM definition for DirectPlay8 Thread Pool interface
  //
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8ThreadPool);'}
  {$EXTERNALSYM IDirectPlay8ThreadPool}
  IDirectPlay8ThreadPool = interface(IUnknown)
    ['{0d22ee73-4a46-4a0d-89b2-045b4d666425}']
    (*** IDirectPlay8ThreadPool methods ***)
    function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall;
    function Close(dwFlags: DWORD): HResult; stdcall;
    function GetThreadCount(dwProcessorNum: DWORD; out pdwNumThreads: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetThreadCount(dwProcessorNum: DWORD; dwNumThreads: DWORD; dwFlags: DWORD): HResult; stdcall;
    function DoWork(dwAllowedTimeSlice: DWORD; dwFlags: DWORD): HResult; stdcall;
  end;


  //
  // COM definition for DirectPlay8 NAT Resolver interface
  //
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8NATResolver);'}
  {$EXTERNALSYM IDirectPlay8NATResolver}
  IDirectPlay8NATResolver = interface(IUnknown)
    ['{a9e213f2-9a60-486f-bf3b-53408b6d1cbb}']
    (*** IDirectPlay8NATResolver methods ***)
    function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall;
    function Start(ppDevices: PIDirectPlay8Address; dwNumDevices: DWORD; dwFlags: DWORD): HResult; stdcall;
    function Close(dwFlags: DWORD): HResult; stdcall;
    function EnumDevices(pSPInfoBuffer: PDPNServiceProviderInfo; var pdwBufferSize: DWORD; out pdwNumDevices: DWORD; dwFlags: DWORD): HResult; stdcall;
    function GetAddresses(ppAddresses: PIDirectPlay8Address; out pdwNumAddresses: DWORD; dwFlags: DWORD): HResult; stdcall;
  end;


(****************************************************************************
 *
 * DirectPlay8 Interface IIDs
 *
 ****************************************************************************)

  // {5102DACD-241B-11d3-AEA7-006097B01411}
  IID_IDirectPlay8Client = IDirectPlay8Client;
  {$EXTERNALSYM IID_IDirectPlay8Client}

  // {5102DACE-241B-11d3-AEA7-006097B01411}
  IID_IDirectPlay8Server = IDirectPlay8Server;
  {$EXTERNALSYM IID_IDirectPlay8Server}

  // {5102DACF-241B-11d3-AEA7-006097B01411}
  IID_IDirectPlay8Peer = IDirectPlay8Peer;
  {$EXTERNALSYM IID_IDirectPlay8Peer}


  // IIDs added for DirectX 9

  // {0D22EE73-4A46-4a0d-89B2-045B4D666425}
  IID_IDirectPlay8ThreadPool = IDirectPlay8ThreadPool;
  {$EXTERNALSYM IID_IDirectPlay8ThreadPool}

  // {A9E213F2-9A60-486f-BF3B-53408B6D1CBB}
  IID_IDirectPlay8NATResolver = IDirectPlay8NATResolver;
  {$EXTERNALSYM IID_IDirectPlay8NATResolver}



(*==========================================================================
 *
 *  Copyright (C) 2000 Microsoft Corporation.  All Rights Reserved.
 *
 *  File:       DPLobby.h
 *  Content:    DirectPlay8 Lobby Include File
 *
 ***************************************************************************)


(****************************************************************************
 *
 * DirectPlay8Lobby Structures (Non-Message)
 *
 ****************************************************************************)

  //
  // Information on a registered game
  //
  PDPLApplicationInfo = ^TDPLApplicationInfo;
  _DPL_APPLICATION_INFO = packed record
    guidApplication: TGUID;            // GUID of the application
    pwszApplicationName: PWideChar;    // Name of the application
    dwNumRunning: DWORD;               // # of instances of this application running
    dwNumWaiting: DWORD;               // # of instances of this application waiting
    dwFlags: DWORD;                    // Flags
  end;
  {$EXTERNALSYM _DPL_APPLICATION_INFO}
  DPL_APPLICATION_INFO = _DPL_APPLICATION_INFO;
  {$EXTERNALSYM DPL_APPLICATION_INFO}
  TDPLApplicationInfo = _DPL_APPLICATION_INFO;

  //
  // Settings to be used for connecting / hosting a game session
  //
  PDPLConnectionSettings = ^TDPLConnectionSettings;
  _DPL_CONNECTION_SETTINGS = packed record
    dwSize: DWORD;                    // Size of this structure
    dwFlags: DWORD;                // Connection settings flags (DPLCONNECTSETTINGS_...)
    dpnAppDesc: TDPNApplicationDesc;             // Application desc for the associated DirectPlay session
    pdp8HostAddress: IDirectPlay8Address;       // Address of host to connect to
    ppdp8DeviceAddresses: IDirectPlay8Address; // Address of device to connect from / host on
    cNumDeviceAddresses: DWORD;    // # of addresses specified in ppdp8DeviceAddresses
    pwszPlayerName: PWideChar;         // Name to give the player
  end;
  {$EXTERNALSYM _DPL_CONNECTION_SETTINGS}
  DPL_CONNECTION_SETTINGS = _DPL_CONNECTION_SETTINGS;
  {$EXTERNALSYM DPL_CONNECTION_SETTINGS}
  TDPLConnectionSettings = _DPL_CONNECTION_SETTINGS;

  //
  // Information for performing a lobby connect
  // (ConnectApplication)
  //
  PDPLConnectInfo = ^TDPLConnectInfo;
  _DPL_CONNECT_INFO = packed record
    dwSize: DWORD;                                  // Size of this structure
    dwFlags: DWORD;                                 // Flags (DPLCONNECT_...)
    guidApplication: TGUID;                         // GUID of application to launch
    pdplConnectionSettings: PDPLConnectionSettings; // Settings application should use
    pvLobbyConnectData: Pointer;                    // User defined data block
    dwLobbyConnectDataSize: DWORD;                  // Size of user defined data block
  end;
  {$EXTERNALSYM _DPL_CONNECT_INFO}
  DPL_CONNECT_INFO = _DPL_CONNECT_INFO;
  {$EXTERNALSYM DPL_CONNECT_INFO}
  TDPLConnectInfo = _DPL_CONNECT_INFO;

  //
  // Information for registering an application
  // (RegisterApplication)
  //
  PDPLProgramDesc = ^TDPLProgramDesc;
  _DPL_PROGRAM_DESC = packed record
    dwSize: DWORD;
    dwFlags: DWORD;
    guidApplication: TGUID;               // Application GUID
    pwszApplicationName: PWideChar;       // Unicode application name
    pwszCommandLine: PWideChar;           // Unicode command line arguments
    pwszCurrentDirectory: PWideChar;      // Unicode current directory
    pwszDescription: PWideChar;           // Unicode application description
    pwszExecutableFilename: PWideChar;    // Unicode filename of application executable
    pwszExecutablePath: PWideChar;        // Unicode path of application executable
    pwszLauncherFilename: PWideChar;      // Unicode filename of launcher executable
    pwszLauncherPath: PWideChar;          // Unicode path of launcher executable
  end;
  {$EXTERNALSYM _DPL_PROGRAM_DESC}
  DPL_PROGRAM_DESC = _DPL_PROGRAM_DESC;
  {$EXTERNALSYM DPL_PROGRAM_DESC}
  TDPLProgramDesc = _DPL_PROGRAM_DESC;

(****************************************************************************
 *
 * DirectPlay8 Lobby Message Structures
 *
 ****************************************************************************)

  //
  // A connection was established
  // (DPL_MSGID_CONNECT)
  //
  PDPLMessageConnect = ^TDPLMessageConnect;
  _DPL_MESSAGE_CONNECT = packed record
    dwSize: DWORD;                 // Size of this structure
    hConnectId: TDPNHandle;        // Handle of new connection
    pdplConnectionSettings: PDPLConnectionSettings; // Connection settings for this connection
    pvLobbyConnectData: Pointer;   // User defined lobby data block
    dwLobbyConnectDataSize: DWORD; // Size of user defined lobby data block
    pvConnectionContext: Pointer;  // Context value for this connection (user set)
  end;
  {$EXTERNALSYM _DPL_MESSAGE_CONNECT}
  DPL_MESSAGE_CONNECT = _DPL_MESSAGE_CONNECT;
  {$EXTERNALSYM DPL_MESSAGE_CONNECT}
  TDPLMessageConnect = _DPL_MESSAGE_CONNECT;

  //
  // Connection settings have been updated
  // (DPL_MSGID_CONNECTION_SETTINGS)
  //
  PDPLMessageConnectionSettings = ^TDPLMessageConnectionSettings;
  _DPL_MESSAGE_CONNECTION_SETTINGS = packed record
    dwSize: DWORD;                // Size of this structure
    hSender: TDPNHandle;          // Handle of the connection for these settings
    pdplConnectionSettings: PDPLConnectionSettings;     // Connection settings
    pvConnectionContext: Pointer; // Context value for this connection
  end;
  {$EXTERNALSYM _DPL_MESSAGE_CONNECTION_SETTINGS}
  DPL_MESSAGE_CONNECTION_SETTINGS = _DPL_MESSAGE_CONNECTION_SETTINGS;
  {$EXTERNALSYM DPL_MESSAGE_CONNECTION_SETTINGS}
  TDPLMessageConnectionSettings = _DPL_MESSAGE_CONNECTION_SETTINGS;

  //
  // A connection has been disconnected
  // (DPL_MSGID_DISCONNECT)
  //
  PDPLMessageDisconnect = ^TDPLMessageDisconnect;
  _DPL_MESSAGE_DISCONNECT = packed record
    dwSize: DWORD;                // Size of this structure
    hDisconnectId: TDPNHandle;    // Handle of the connection that was terminated
    hrReason: HRESULT;            // Reason the connection was broken
    pvConnectionContext: Pointer; // Context value for this connection
  end;
  {$EXTERNALSYM _DPL_MESSAGE_DISCONNECT}
  DPL_MESSAGE_DISCONNECT = _DPL_MESSAGE_DISCONNECT;
  {$EXTERNALSYM DPL_MESSAGE_DISCONNECT}
  TDPLMessageDisconnect = _DPL_MESSAGE_DISCONNECT;

  //
  // Data was received through a connection
  // (DPL_MSGID_RECEIVE)
  //
  PDPLMessageReceive = ^TDPLMessageReceive;
  _DPL_MESSAGE_RECEIVE = packed record
    dwSize: DWORD;                  // Size of this structure
    hSender: TDPNHandle;            // Handle of the connection that is from
    pBuffer: PByte;                 // Contents of the message
    dwBufferSize: DWORD;            // Size of the message context
    pvConnectionContext: Pointer;   // Context value for this connection
  end;
  {$EXTERNALSYM _DPL_MESSAGE_RECEIVE}
  DPL_MESSAGE_RECEIVE = _DPL_MESSAGE_RECEIVE;
  {$EXTERNALSYM DPL_MESSAGE_RECEIVE}
  TDPLMessageReceive = _DPL_MESSAGE_RECEIVE;

  //
  // Current status of the associated connection
  // (DPL_MSGID_SESSION_STATUS)
  //
  PDPLMessageSessionStatus = ^TDPLMessageSessionStatus;
  _DPL_MESSAGE_SESSION_STATUS = packed record
    dwSize: DWORD;                // Size of this structure
    hSender: TDPNHandle;          // Handle of the connection that this is from
    dwStatus: DWORD;              // Status (DPLSESSION_...)
    pvConnectionContext: Pointer; // Context value for this connection
  end;
  {$EXTERNALSYM _DPL_MESSAGE_SESSION_STATUS}
  DPL_MESSAGE_SESSION_STATUS = _DPL_MESSAGE_SESSION_STATUS;
  {$EXTERNALSYM DPL_MESSAGE_SESSION_STATUS}
  TDPLMessageSessionStatus = _DPL_MESSAGE_SESSION_STATUS;

(****************************************************************************
 *
 * DirectPlay8Lobby Create
 *
 ****************************************************************************)
 
(*
 * This function is no longer supported.  It is recommended that CoCreateInstance be used to create
 * DirectPlay8 lobby objects.
 *
 * extern HRESULT WINAPI DirectPlay8LobbyCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown);
 *
 *)

(****************************************************************************
 *
 * DirectPlay8 Functions
 *
 ****************************************************************************)

  //
  // COM definition for DirectPlayLobbyClient
  //
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8LobbyClient);'}
  {$EXTERNALSYM IDirectPlay8LobbyClient}
  IDirectPlay8LobbyClient = interface(IUnknown)
    ['{819074a2-016c-11d3-ae14-006097b01411}']
    // IDirectPlayLobbyClient methods
    function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall;
    function EnumLocalPrograms(pGuidApplication: PGUID; pEnumData: PByte; var pdwEnumData: DWORD; out pdwItems: DWORD; dwFlags: DWORD): HResult; stdcall;
    function ConnectApplication(const pdplConnectionInfo: PDPLConnectInfo;
      pvConnectionContext: Pointer; hApplication: PDPNHandle; dwTimeOut, dwFlags: DWORD): HResult; stdcall;
    function Send(hConnection: TDPNHandle; pBuffer: PByte; pBufferSize, dwFlags: DWORD): HResult; stdcall;
    function ReleaseApplication(hConnection: TDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function Close(dwFlags: DWORD): HResult; stdcall;
    function GetConnectionSettings(hConnection: TDPNHandle; pdplSessionInfo: PDPLConnectionSettings; var pdwInfoSize: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetConnectionSettings(hConnection: TDPNHandle; const pdplSessionInfo: TDPLConnectionSettings; dwFlags: DWORD): HResult; stdcall;
  end;


  //
  // COM definition for DirectPlayLobbiedApplication
  //
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8LobbiedApplication);'}
  {$EXTERNALSYM IDirectPlay8LobbiedApplication}
  IDirectPlay8LobbiedApplication = interface(IUnknown)
    ['{819074a3-016c-11d3-ae14-006097b01411}']
    // IDirectPlayLobbiedApplication methods
    function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; pdpnhConnection: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function RegisterProgram(const pdplProgramDesc: TDPLProgramDesc; dwFlags: DWORD): HResult; stdcall;
    function UnRegisterProgram(const pguidApplication: TGUID; dwFlags: DWORD): HResult; stdcall;
    function Send(hConnection: TDPNHandle; pBuffer: PByte; pBufferSize: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetAppAvailable(fAvailable: BOOL;  dwFlags: DWORD): HResult; stdcall;
    function UpdateStatus(hConnection: TDPNHandle; dwStatus, dwFlags: DWORD): HResult; stdcall;
    function Close(dwFlags: DWORD): HResult; stdcall;
    function GetConnectionSettings(hConnection: TDPNHandle; pdplSessionInfo: PDPLConnectionSettings; var pdwInfoSize: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetConnectionSettings(hConnection: TDPNHandle; const pdplSessionInfo: TDPLConnectionSettings; dwFlags: DWORD): HResult; stdcall;
  end;


const
(****************************************************************************
 *
 * DirectPlay8Lobby CLSIDs
 *
 ****************************************************************************)

  // {667955AD-6B3B-43ca-B949-BC69B5BAFF7F}
  CLSID_DirectPlay8LobbiedApplication: TGUID = '{667955ad-6b3b-43ca-b949-bc69b5baff7f}';
  {$EXTERNALSYM CLSID_DirectPlay8LobbiedApplication}

  // {3B2B6775-70B6-45af-8DEA-A209C69559F3}
  CLSID_DirectPlay8LobbyClient: TGUID = '{3b2b6775-70b6-45af-8dea-a209c69559f3}';
  {$EXTERNALSYM CLSID_DirectPlay8LobbyClient}

(****************************************************************************
 *
 * DirectPlay8Lobby Interface IIDs
 *
 ****************************************************************************)

  // {819074A3-016C-11d3-AE14-006097B01411}
  IID_IDirectPlay8LobbiedApplication = IDirectPlay8LobbiedApplication;
  {$EXTERNALSYM IID_IDirectPlay8LobbiedApplication}

  // {819074A2-016C-11d3-AE14-006097B01411}
  IID_IDirectPlay8LobbyClient = IDirectPlay8LobbyClient;
  {$EXTERNALSYM IID_IDirectPlay8LobbyClient}

(****************************************************************************
 *
 * DirectPlay8 Lobby Message IDs
 *
 ****************************************************************************)

  DPL_MSGID_LOBBY                     = $8000;
  {$EXTERNALSYM DPL_MSGID_LOBBY}
  DPL_MSGID_RECEIVE                   = ($0001 or DPL_MSGID_LOBBY);
  {$EXTERNALSYM DPL_MSGID_RECEIVE}
  DPL_MSGID_CONNECT                   = ($0002 or DPL_MSGID_LOBBY);
  {$EXTERNALSYM DPL_MSGID_CONNECT}
  DPL_MSGID_DISCONNECT                = ($0003 or DPL_MSGID_LOBBY);
  {$EXTERNALSYM DPL_MSGID_DISCONNECT}
  DPL_MSGID_SESSION_STATUS            = ($0004 or DPL_MSGID_LOBBY);
  {$EXTERNALSYM DPL_MSGID_SESSION_STATUS}
  DPL_MSGID_CONNECTION_SETTINGS       = ($0005 or DPL_MSGID_LOBBY);
  {$EXTERNALSYM DPL_MSGID_CONNECTION_SETTINGS}

(****************************************************************************
 *
 * DirectPlay8Lobby Constants
 *
 ****************************************************************************)

  //
  // Specifies that operation should be performed on all open connections
  //
  DPLHANDLE_ALLCONNECTIONS     = $FFFFFFFF;
  {$EXTERNALSYM DPLHANDLE_ALLCONNECTIONS}

  //
  // The associated game session has suceeded in connecting / hosting
  //
  DPLSESSION_CONNECTED         = $0001;
  {$EXTERNALSYM DPLSESSION_CONNECTED}

  // The associated game session failed connecting / hosting
  //
  DPLSESSION_COULDNOTCONNECT   = $0002;
  {$EXTERNALSYM DPLSESSION_COULDNOTCONNECT}

  //
  // The associated game session has disconnected
  //
  DPLSESSION_DISCONNECTED      = $0003;
  {$EXTERNALSYM DPLSESSION_DISCONNECTED}

  //
  // The associated game session has terminated
  //
  DPLSESSION_TERMINATED        = $0004;
  {$EXTERNALSYM DPLSESSION_TERMINATED}

  //
  // The associated game session's host has migrated
  //
  DPLSESSION_HOSTMIGRATED      = $0005;
  {$EXTERNALSYM DPLSESSION_HOSTMIGRATED}

  //
  // The associated game session's host has migrated to the local client
  //
  DPLSESSION_HOSTMIGRATEDHERE  = $0006;
  {$EXTERNALSYM DPLSESSION_HOSTMIGRATEDHERE}


(****************************************************************************
 *
 * DirectPlay8 Lobby Flags
 *
 ****************************************************************************)

  //
  // Do not automatically make the lobby app unavailable when a connection is established
  //
  DPLAVAILABLE_ALLOWMULTIPLECONNECT   = $0001;
  {$EXTERNALSYM DPLAVAILABLE_ALLOWMULTIPLECONNECT}

  //
  // Launch a new instance of the application to connect to
  //
  DPLCONNECT_LAUNCHNEW                = $0001;
  {$EXTERNALSYM DPLCONNECT_LAUNCHNEW}

  //
  // Launch a new instance of the application if one is not waiting
  //
  DPLCONNECT_LAUNCHNOTFOUND           = $0002;
  {$EXTERNALSYM DPLCONNECT_LAUNCHNOTFOUND}

  //
  // When starting the associated game session, start it as a host
  //
  DPLCONNECTSETTINGS_HOST             = $0001;
  {$EXTERNALSYM DPLCONNECTSETTINGS_HOST}

  //
  // Disable parameter validation
  //
  DPLINITIALIZE_DISABLEPARAMVAL       = $0001;
  {$EXTERNALSYM DPLINITIALIZE_DISABLEPARAMVAL}





///// Part 2 of dplay8.h /////
(*==========================================================================;
 *
 *  Copyright (C) 1998-2000 Microsoft Corporation.  All Rights Reserved.
 *
 *  File:		DPlay8.h
 *  Content:	DirectPlay8 include file
 *
 ***************************************************************************)

(****************************************************************************
 *
 * DIRECTPLAY8 ERRORS
 *
 * Errors are represented by negative values and cannot be combined.
 *
 ****************************************************************************)

const
  _DPN_FACILITY_CODE = $015;
  {$EXTERNALSYM _DPN_FACILITY_CODE}
  _DPNHRESULT_BASE   = $8000;
  {$EXTERNALSYM _DPNHRESULT_BASE}

  MAKE_DPNHRESULT_R  = (1 shl 31) or (_DPN_FACILITY_CODE shl 16) + _DPNHRESULT_BASE;

// #define MAKE_DPNHRESULT( code )  MAKE_HRESULT( 1, _DPN_FACILITY_CODE, ( code + _DPNHRESULT_BASE ) )
function MAKE_DPNHRESULT(Code: DWORD): DWORD;
{$EXTERNALSYM MAKE_DPNHRESULT}

const
  DPN_OK                    = S_OK;
  {$EXTERNALSYM DPN_OK}

  DPNSUCCESS_EQUAL          = HRESULT((0 shl 31) or (_DPN_FACILITY_CODE shl 16) or ($5 + _DPNHRESULT_BASE)); // MAKE_HRESULT( 0, _DPN_FACILITY_CODE, ( 0x5 + _DPNHRESULT_BASE ) )
  {$EXTERNALSYM DPNSUCCESS_EQUAL}
  DPNSUCCESS_NOPLAYERSINGROUP = HRESULT((0 shl 31) or (_DPN_FACILITY_CODE shl 16) or ($8 + _DPNHRESULT_BASE)); // MAKE_HRESULT( 0, _DPN_FACILITY_CODE, ( 0x8 + _DPNHRESULT_BASE ) )	// added for DirectX 9
  {$EXTERNALSYM DPNSUCCESS_NOPLAYERSINGROUP}
  DPNSUCCESS_NOTEQUAL       = HRESULT((0 shl 31) or (_DPN_FACILITY_CODE shl 16) or ($A + _DPNHRESULT_BASE)); // MAKE_HRESULT( 0, _DPN_FACILITY_CODE, (0x0A + _DPNHRESULT_BASE ) )
  {$EXTERNALSYM DPNSUCCESS_NOTEQUAL}
  DPNSUCCESS_PENDING        = HRESULT((0 shl 31) or (_DPN_FACILITY_CODE shl 16) or ($e + _DPNHRESULT_BASE)); // MAKE_HRESULT( 0, _DPN_FACILITY_CODE, (0x0e + _DPNHRESULT_BASE ) )
  {$EXTERNALSYM DPNSUCCESS_PENDING}

  DPNERR_ABORTED                 = HRESULT(MAKE_DPNHRESULT_R + $30); // MAKE_DPNHRESULT( 0x30 )
  {$EXTERNALSYM DPNERR_ABORTED}
  DPNERR_ADDRESSING              = HRESULT(MAKE_DPNHRESULT_R + $40); // MAKE_DPNHRESULT( 0x40 )
  {$EXTERNALSYM DPNERR_ADDRESSING}
  DPNERR_ALREADYCLOSING          = HRESULT(MAKE_DPNHRESULT_R + $50); // MAKE_DPNHRESULT( 0x50 )
  {$EXTERNALSYM DPNERR_ALREADYCLOSING}
  DPNERR_ALREADYCONNECTED        = HRESULT(MAKE_DPNHRESULT_R + $60); // MAKE_DPNHRESULT( 0x60 )
  {$EXTERNALSYM DPNERR_ALREADYCONNECTED}
  DPNERR_ALREADYDISCONNECTING    = HRESULT(MAKE_DPNHRESULT_R + $70); // MAKE_DPNHRESULT( 0x70 )
  {$EXTERNALSYM DPNERR_ALREADYDISCONNECTING}
  DPNERR_ALREADYINITIALIZED      = HRESULT(MAKE_DPNHRESULT_R + $80); // MAKE_DPNHRESULT(  0x80 )
  {$EXTERNALSYM DPNERR_ALREADYINITIALIZED}
  DPNERR_ALREADYREGISTERED       = HRESULT(MAKE_DPNHRESULT_R + $90); // MAKE_DPNHRESULT(  0x90 )
  {$EXTERNALSYM DPNERR_ALREADYREGISTERED}
  DPNERR_BUFFERTOOSMALL          = HRESULT(MAKE_DPNHRESULT_R + $100); // MAKE_DPNHRESULT( 0x100 )
  {$EXTERNALSYM DPNERR_BUFFERTOOSMALL}
  DPNERR_CANNOTCANCEL            = HRESULT(MAKE_DPNHRESULT_R + $110); // MAKE_DPNHRESULT( 0x110 )
  {$EXTERNALSYM DPNERR_CANNOTCANCEL}
  DPNERR_CANTCREATEGROUP         = HRESULT(MAKE_DPNHRESULT_R + $120); // MAKE_DPNHRESULT( 0x120 )
  {$EXTERNALSYM DPNERR_CANTCREATEGROUP}
  DPNERR_CANTCREATEPLAYER        = HRESULT(MAKE_DPNHRESULT_R + $130); // MAKE_DPNHRESULT( 0x130 )
  {$EXTERNALSYM DPNERR_CANTCREATEPLAYER}
  DPNERR_CANTLAUNCHAPPLICATION   = HRESULT(MAKE_DPNHRESULT_R + $140); // MAKE_DPNHRESULT( 0x140 )
  {$EXTERNALSYM DPNERR_CANTLAUNCHAPPLICATION}
  DPNERR_CONNECTING              = HRESULT(MAKE_DPNHRESULT_R + $150); // MAKE_DPNHRESULT( 0x150 )
  {$EXTERNALSYM DPNERR_CONNECTING}
  DPNERR_CONNECTIONLOST          = HRESULT(MAKE_DPNHRESULT_R + $160); // MAKE_DPNHRESULT( 0x160 )
  {$EXTERNALSYM DPNERR_CONNECTIONLOST}
  DPNERR_CONVERSION              = HRESULT(MAKE_DPNHRESULT_R + $170); // MAKE_DPNHRESULT( 0x170 )
  {$EXTERNALSYM DPNERR_CONVERSION}
  DPNERR_DATATOOLARGE            = HRESULT(MAKE_DPNHRESULT_R + $175); // MAKE_DPNHRESULT( 0x175 )
  {$EXTERNALSYM DPNERR_DATATOOLARGE}
  DPNERR_DOESNOTEXIST            = HRESULT(MAKE_DPNHRESULT_R + $180); // MAKE_DPNHRESULT( 0x180 )
  {$EXTERNALSYM DPNERR_DOESNOTEXIST}
  DPNERR_DPNSVRNOTAVAILABLE      = HRESULT(MAKE_DPNHRESULT_R + $185); // MAKE_DPNHRESULT( 0x185 )
  {$EXTERNALSYM DPNERR_DPNSVRNOTAVAILABLE}
  DPNERR_DUPLICATECOMMAND        = HRESULT(MAKE_DPNHRESULT_R + $190); // MAKE_DPNHRESULT( 0x190 )
  {$EXTERNALSYM DPNERR_DUPLICATECOMMAND}
  DPNERR_ENDPOINTNOTRECEIVING    = HRESULT(MAKE_DPNHRESULT_R + $200); // MAKE_DPNHRESULT( 0x200 )
  {$EXTERNALSYM DPNERR_ENDPOINTNOTRECEIVING}
  DPNERR_ENUMQUERYTOOLARGE       = HRESULT(MAKE_DPNHRESULT_R + $210); // MAKE_DPNHRESULT( 0x210 )
  {$EXTERNALSYM DPNERR_ENUMQUERYTOOLARGE}
  DPNERR_ENUMRESPONSETOOLARGE    = HRESULT(MAKE_DPNHRESULT_R + $220); // MAKE_DPNHRESULT( 0x220 )
  {$EXTERNALSYM DPNERR_ENUMRESPONSETOOLARGE}
  DPNERR_EXCEPTION               = HRESULT(MAKE_DPNHRESULT_R + $230); // MAKE_DPNHRESULT( 0x230 )
  {$EXTERNALSYM DPNERR_EXCEPTION}
  DPNERR_GENERIC                 = E_FAIL;
  {$EXTERNALSYM DPNERR_GENERIC}
  DPNERR_GROUPNOTEMPTY           = HRESULT(MAKE_DPNHRESULT_R + $240); // MAKE_DPNHRESULT( 0x240 )
  {$EXTERNALSYM DPNERR_GROUPNOTEMPTY}
  DPNERR_HOSTING                 = HRESULT(MAKE_DPNHRESULT_R + $250); // MAKE_DPNHRESULT( 0x250 )
  {$EXTERNALSYM DPNERR_HOSTING}
  DPNERR_HOSTREJECTEDCONNECTION  = HRESULT(MAKE_DPNHRESULT_R + $260); // MAKE_DPNHRESULT( 0x260 )
  {$EXTERNALSYM DPNERR_HOSTREJECTEDCONNECTION}
  DPNERR_HOSTTERMINATEDSESSION   = HRESULT(MAKE_DPNHRESULT_R + $270); // MAKE_DPNHRESULT( 0x270 )
  {$EXTERNALSYM DPNERR_HOSTTERMINATEDSESSION}
  DPNERR_INCOMPLETEADDRESS       = HRESULT(MAKE_DPNHRESULT_R + $280); // MAKE_DPNHRESULT( 0x280 )
  {$EXTERNALSYM DPNERR_INCOMPLETEADDRESS}
  DPNERR_INVALIDADDRESSFORMAT    = HRESULT(MAKE_DPNHRESULT_R + $290); // MAKE_DPNHRESULT( 0x290 )
  {$EXTERNALSYM DPNERR_INVALIDADDRESSFORMAT}
  DPNERR_INVALIDAPPLICATION      = HRESULT(MAKE_DPNHRESULT_R + $300); // MAKE_DPNHRESULT( 0x300 )
  {$EXTERNALSYM DPNERR_INVALIDAPPLICATION}
  DPNERR_INVALIDCOMMAND          = HRESULT(MAKE_DPNHRESULT_R + $310); // MAKE_DPNHRESULT( 0x310 )
  {$EXTERNALSYM DPNERR_INVALIDCOMMAND}
  DPNERR_INVALIDDEVICEADDRESS    = HRESULT(MAKE_DPNHRESULT_R + $320); // MAKE_DPNHRESULT( 0x320 )
  {$EXTERNALSYM DPNERR_INVALIDDEVICEADDRESS}
  DPNERR_INVALIDENDPOINT         = HRESULT(MAKE_DPNHRESULT_R + $330); // MAKE_DPNHRESULT( 0x330 )
  {$EXTERNALSYM DPNERR_INVALIDENDPOINT}
  DPNERR_INVALIDFLAGS            = HRESULT(MAKE_DPNHRESULT_R + $340); // MAKE_DPNHRESULT( 0x340 )
  {$EXTERNALSYM DPNERR_INVALIDFLAGS}
  DPNERR_INVALIDGROUP            = HRESULT(MAKE_DPNHRESULT_R + $350); // MAKE_DPNHRESULT( 0x350 )
  {$EXTERNALSYM DPNERR_INVALIDGROUP}
  DPNERR_INVALIDHANDLE           = HRESULT(MAKE_DPNHRESULT_R + $360); // MAKE_DPNHRESULT( 0x360 )
  {$EXTERNALSYM DPNERR_INVALIDHANDLE}
  DPNERR_INVALIDHOSTADDRESS      = HRESULT(MAKE_DPNHRESULT_R + $370); // MAKE_DPNHRESULT( 0x370 )
  {$EXTERNALSYM DPNERR_INVALIDHOSTADDRESS}
  DPNERR_INVALIDINSTANCE         = HRESULT(MAKE_DPNHRESULT_R + $380); // MAKE_DPNHRESULT( 0x380 )
  {$EXTERNALSYM DPNERR_INVALIDINSTANCE}
  DPNERR_INVALIDINTERFACE        = HRESULT(MAKE_DPNHRESULT_R + $390); // MAKE_DPNHRESULT( 0x390 )
  {$EXTERNALSYM DPNERR_INVALIDINTERFACE}
  DPNERR_INVALIDOBJECT           = HRESULT(MAKE_DPNHRESULT_R + $400); // MAKE_DPNHRESULT( 0x400 )
  {$EXTERNALSYM DPNERR_INVALIDOBJECT}
  DPNERR_INVALIDPARAM            = E_INVALIDARG;
  {$EXTERNALSYM DPNERR_INVALIDPARAM}
  DPNERR_INVALIDPASSWORD         = HRESULT(MAKE_DPNHRESULT_R + $410); // MAKE_DPNHRESULT( 0x410 )
  {$EXTERNALSYM DPNERR_INVALIDPASSWORD}
  DPNERR_INVALIDPLAYER           = HRESULT(MAKE_DPNHRESULT_R + $420); // MAKE_DPNHRESULT( 0x420 )
  {$EXTERNALSYM DPNERR_INVALIDPLAYER}
  DPNERR_INVALIDPOINTER          = E_POINTER;
  {$EXTERNALSYM DPNERR_INVALIDPOINTER}
  DPNERR_INVALIDPRIORITY         = HRESULT(MAKE_DPNHRESULT_R + $430); // MAKE_DPNHRESULT( 0x430 )
  {$EXTERNALSYM DPNERR_INVALIDPRIORITY}
  DPNERR_INVALIDSTRING           = HRESULT(MAKE_DPNHRESULT_R + $440); // MAKE_DPNHRESULT( 0x440 )
  {$EXTERNALSYM DPNERR_INVALIDSTRING}
  DPNERR_INVALIDURL              = HRESULT(MAKE_DPNHRESULT_R + $450); // MAKE_DPNHRESULT( 0x450 )
  {$EXTERNALSYM DPNERR_INVALIDURL}
  DPNERR_INVALIDVERSION          = HRESULT(MAKE_DPNHRESULT_R + $460); // MAKE_DPNHRESULT( 0x460 )
  {$EXTERNALSYM DPNERR_INVALIDVERSION}
  DPNERR_NOCAPS                  = HRESULT(MAKE_DPNHRESULT_R + $470); // MAKE_DPNHRESULT( 0x470 )
  {$EXTERNALSYM DPNERR_NOCAPS}
  DPNERR_NOCONNECTION            = HRESULT(MAKE_DPNHRESULT_R + $480); // MAKE_DPNHRESULT( 0x480 )
  {$EXTERNALSYM DPNERR_NOCONNECTION}
  DPNERR_NOHOSTPLAYER            = HRESULT(MAKE_DPNHRESULT_R + $490); // MAKE_DPNHRESULT( 0x490 )
  {$EXTERNALSYM DPNERR_NOHOSTPLAYER}
  DPNERR_NOINTERFACE             = E_NOINTERFACE;
  {$EXTERNALSYM DPNERR_NOINTERFACE}
  DPNERR_NOMOREADDRESSCOMPONENTS = HRESULT(MAKE_DPNHRESULT_R + $500); // MAKE_DPNHRESULT( 0x500 )
  {$EXTERNALSYM DPNERR_NOMOREADDRESSCOMPONENTS}
  DPNERR_NORESPONSE              = HRESULT(MAKE_DPNHRESULT_R + $510); // MAKE_DPNHRESULT( 0x510 )
  {$EXTERNALSYM DPNERR_NORESPONSE}
  DPNERR_NOTALLOWED              = HRESULT(MAKE_DPNHRESULT_R + $520); // MAKE_DPNHRESULT( 0x520 )
  {$EXTERNALSYM DPNERR_NOTALLOWED}
  DPNERR_NOTHOST                 = HRESULT(MAKE_DPNHRESULT_R + $530); // MAKE_DPNHRESULT( 0x530 )
  {$EXTERNALSYM DPNERR_NOTHOST}
  DPNERR_NOTREADY                = HRESULT(MAKE_DPNHRESULT_R + $540); // MAKE_DPNHRESULT( 0x540 )
  {$EXTERNALSYM DPNERR_NOTREADY}
  DPNERR_NOTREGISTERED           = HRESULT(MAKE_DPNHRESULT_R + $550); // MAKE_DPNHRESULT( 0x550 )
  {$EXTERNALSYM DPNERR_NOTREGISTERED}
  DPNERR_OUTOFMEMORY             = E_OUTOFMEMORY;
  {$EXTERNALSYM DPNERR_OUTOFMEMORY}
  DPNERR_PENDING                 = DPNSUCCESS_PENDING;
  {$EXTERNALSYM DPNERR_PENDING}
  DPNERR_PLAYERALREADYINGROUP    = HRESULT(MAKE_DPNHRESULT_R + $560); // MAKE_DPNHRESULT( 0x560 )
  {$EXTERNALSYM DPNERR_PLAYERALREADYINGROUP}
  DPNERR_PLAYERLOST              = HRESULT(MAKE_DPNHRESULT_R + $570); // MAKE_DPNHRESULT( 0x570 )
  {$EXTERNALSYM DPNERR_PLAYERLOST}
  DPNERR_PLAYERNOTINGROUP        = HRESULT(MAKE_DPNHRESULT_R + $580); // MAKE_DPNHRESULT( 0x580 )
  {$EXTERNALSYM DPNERR_PLAYERNOTINGROUP}
  DPNERR_PLAYERNOTREACHABLE      = HRESULT(MAKE_DPNHRESULT_R + $590); // MAKE_DPNHRESULT( 0x590 )
  {$EXTERNALSYM DPNERR_PLAYERNOTREACHABLE}
  DPNERR_SENDTOOLARGE            = HRESULT(MAKE_DPNHRESULT_R + $600); // MAKE_DPNHRESULT( 0x600 )
  {$EXTERNALSYM DPNERR_SENDTOOLARGE}
  DPNERR_SESSIONFULL             = HRESULT(MAKE_DPNHRESULT_R + $610); // MAKE_DPNHRESULT( 0x610 )
  {$EXTERNALSYM DPNERR_SESSIONFULL}
  DPNERR_TABLEFULL               = HRESULT(MAKE_DPNHRESULT_R + $620); // MAKE_DPNHRESULT( 0x620 )
  {$EXTERNALSYM DPNERR_TABLEFULL}
  DPNERR_TIMEDOUT                = HRESULT(MAKE_DPNHRESULT_R + $630); // MAKE_DPNHRESULT( 0x630 )
  {$EXTERNALSYM DPNERR_TIMEDOUT}
  DPNERR_UNINITIALIZED           = HRESULT(MAKE_DPNHRESULT_R + $640); // MAKE_DPNHRESULT( 0x640 )
  {$EXTERNALSYM DPNERR_UNINITIALIZED}
  DPNERR_UNSUPPORTED             = E_NOTIMPL;
  {$EXTERNALSYM DPNERR_UNSUPPORTED}
  DPNERR_USERCANCEL              = HRESULT(MAKE_DPNHRESULT_R + $650); // MAKE_DPNHRESULT( 0x650 )
  {$EXTERNALSYM DPNERR_USERCANCEL}




(*==========================================================================;
 *
 *  Copyright (C) 1999 Microsoft Corporation.  All Rights Reserved.
 *
 *  File:       dpvoice.h
 *  Content:    DirectPlayVoice include file
 ***************************************************************************)


const
(****************************************************************************
 *
 * DirectPlayVoice CLSIDs
 *
 ****************************************************************************)


  // {B9F3EB85-B781-4ac1-8D90-93A05EE37D7D}
  CLSID_DirectPlayVoiceClient: TGUID = '{b9f3eb85-b781-4ac1-8d90-93a05ee37d7d}';
  {$EXTERNALSYM CLSID_DirectPlayVoiceClient}

  // {D3F5B8E6-9B78-4a4c-94EA-CA2397B663D3}
  CLSID_DirectPlayVoiceServer: TGUID = '{d3f5b8e6-9b78-4a4c-94ea-ca2397b663d3}';
  {$EXTERNALSYM CLSID_DirectPlayVoiceServer}

  // {0F0F094B-B01C-4091-A14D-DD0CD807711A}
  CLSID_DirectPlayVoiceTest: TGUID = '{0f0f094b-b01c-4091-a14d-dd0cd807711a}';
  {$EXTERNALSYM CLSID_DirectPlayVoiceTest}

(****************************************************************************
 *
 * DirectPlayVoice Compression Type GUIDs
 *
 ****************************************************************************)

  // MS-ADPCM 32.8 kbit/s
  //
  // {699B52C1-A885-46a8-A308-97172419ADC7}
  DPVCTGUID_ADPCM: TGUID = '{699b52c1-a885-46a8-a308-97172419adc7}';
  {$EXTERNALSYM DPVCTGUID_ADPCM}

  // Microsoft GSM 6.10 13 kbit/s
  //
  // {24768C60-5A0D-11d3-9BE4-525400D985E7}
  DPVCTGUID_GSM: TGUID = '{24768c60-5a0d-11d3-9be4-525400d985e7}';
  {$EXTERNALSYM DPVCTGUID_GSM}

  // MS-PCM 64 kbit/s
  //
  // {8DE12FD4-7CB3-48ce-A7E8-9C47A22E8AC5}
  DPVCTGUID_NONE: TGUID = '{8de12fd4-7cb3-48ce-a7e8-9c47a22e8ac5}';
  {$EXTERNALSYM DPVCTGUID_NONE}

  // Voxware SC03 3.2kbit/s
  //
  // {7D82A29B-2242-4f82-8F39-5D1153DF3E41}
  DPVCTGUID_SC03: TGUID = '{7d82a29b-2242-4f82-8f39-5d1153df3e41}';
  {$EXTERNALSYM DPVCTGUID_SC03}

  // Voxware SC06 6.4kbit/s
  //
  // {53DEF900-7168-4633-B47F-D143916A13C7}
  DPVCTGUID_SC06: TGUID = '{53def900-7168-4633-b47f-d143916a13c7}';
  {$EXTERNALSYM DPVCTGUID_SC06}

  // TrueSpeech(TM) 8.6 kbit/s
  //
  // {D7954361-5A0B-11d3-9BE4-525400D985E7}
  DPVCTGUID_TRUESPEECH: TGUID = '{d7954361-5a0b-11d3-9be4-525400d985e7}';
  {$EXTERNALSYM DPVCTGUID_TRUESPEECH}

  // Voxware VR12 1.4kbit/s
  //
  // {FE44A9FE-8ED4-48bf-9D66-1B1ADFF9FF6D}
  DPVCTGUID_VR12: TGUID = '{fe44a9fe-8ed4-48bf-9d66-1b1adff9ff6d}';
  {$EXTERNALSYM DPVCTGUID_VR12}

  // Define the default compression type
  DPVCTGUID_DEFAULT: TGUID = '{7d82a29b-2242-4f82-8f39-5d1153df3e41}'; // DPVCTGUID_SC03;
  {$EXTERNALSYM DPVCTGUID_DEFAULT}

(****************************************************************************
 *
 * DirectPlayVoice Callback Functions
 *
 ****************************************************************************)

type
  TDVMessageHandler = function(pvUserContext: Pointer; dwMessageType: DWORD; lpMessage: Pointer): HResult; stdcall;
  {$NODEFINE TDVMessageHandler}
  {$HPPEMIT 'typedef PDVMESSAGEHANDLER TDVMessageHandler;'}

(****************************************************************************
 *
 * DirectPlayVoice Datatypes (Non-Structure / Non-Message)
 *
 ****************************************************************************)

  PDVID = ^DVID;
  DVID = DWORD;
  {$EXTERNALSYM DVID}
  TDVID = DVID;

(****************************************************************************
 *
 * DirectPlayVoice Message Types
 *
 ****************************************************************************)

const
  DVMSGID_BASE                        = $0000;
  {$EXTERNALSYM DVMSGID_BASE}

  DVMSGID_CREATEVOICEPLAYER           = (DVMSGID_BASE+$0001);
  {$EXTERNALSYM DVMSGID_CREATEVOICEPLAYER}
  DVMSGID_DELETEVOICEPLAYER           = (DVMSGID_BASE+$0002);
  {$EXTERNALSYM DVMSGID_DELETEVOICEPLAYER}
  DVMSGID_SESSIONLOST                 = (DVMSGID_BASE+$0003);
  {$EXTERNALSYM DVMSGID_SESSIONLOST}
  DVMSGID_PLAYERVOICESTART            = (DVMSGID_BASE+$0004);
  {$EXTERNALSYM DVMSGID_PLAYERVOICESTART}
  DVMSGID_PLAYERVOICESTOP             = (DVMSGID_BASE+$0005);
  {$EXTERNALSYM DVMSGID_PLAYERVOICESTOP}
  DVMSGID_RECORDSTART                 = (DVMSGID_BASE+$0006);
  {$EXTERNALSYM DVMSGID_RECORDSTART}
  DVMSGID_RECORDSTOP                  = (DVMSGID_BASE+$0007);
  {$EXTERNALSYM DVMSGID_RECORDSTOP}
  DVMSGID_CONNECTRESULT               = (DVMSGID_BASE+$0008);
  {$EXTERNALSYM DVMSGID_CONNECTRESULT}
  DVMSGID_DISCONNECTRESULT            = (DVMSGID_BASE+$0009);
  {$EXTERNALSYM DVMSGID_DISCONNECTRESULT}
  DVMSGID_INPUTLEVEL                  = (DVMSGID_BASE+$000A);
  {$EXTERNALSYM DVMSGID_INPUTLEVEL}
  DVMSGID_OUTPUTLEVEL                 = (DVMSGID_BASE+$000B);
  {$EXTERNALSYM DVMSGID_OUTPUTLEVEL}
  DVMSGID_HOSTMIGRATED                = (DVMSGID_BASE+$000C);
  {$EXTERNALSYM DVMSGID_HOSTMIGRATED}
  DVMSGID_SETTARGETS                  = (DVMSGID_BASE+$000D);
  {$EXTERNALSYM DVMSGID_SETTARGETS}
  DVMSGID_PLAYEROUTPUTLEVEL           = (DVMSGID_BASE+$000E);
  {$EXTERNALSYM DVMSGID_PLAYEROUTPUTLEVEL}
  DVMSGID_LOSTFOCUS                   = (DVMSGID_BASE+$0010);
  {$EXTERNALSYM DVMSGID_LOSTFOCUS}
  DVMSGID_GAINFOCUS                   = (DVMSGID_BASE+$0011);
  {$EXTERNALSYM DVMSGID_GAINFOCUS}
  DVMSGID_LOCALHOSTSETUP              = (DVMSGID_BASE+$0012);
  {$EXTERNALSYM DVMSGID_LOCALHOSTSETUP}
  DVMSGID_MAXBASE                     = (DVMSGID_LOCALHOSTSETUP);
  {$EXTERNALSYM DVMSGID_MAXBASE}
  DVMSGID_MINBASE                     = (DVMSGID_CREATEVOICEPLAYER);
  {$EXTERNALSYM DVMSGID_MINBASE}

(****************************************************************************
 *
 * DirectPlayVoice Constants
 *
 ****************************************************************************)

  //
  // Buffer Aggresiveness Value Ranges
  //
  DVBUFFERAGGRESSIVENESS_MIN          = $00000001;
  {$EXTERNALSYM DVBUFFERAGGRESSIVENESS_MIN}
  DVBUFFERAGGRESSIVENESS_MAX          = $00000064;
  {$EXTERNALSYM DVBUFFERAGGRESSIVENESS_MAX}
  DVBUFFERAGGRESSIVENESS_DEFAULT      = $00000000;
  {$EXTERNALSYM DVBUFFERAGGRESSIVENESS_DEFAULT}

  //
  // Buffer Quality Value Ranges
  //
  DVBUFFERQUALITY_MIN                 = $00000001;
  {$EXTERNALSYM DVBUFFERQUALITY_MIN}
  DVBUFFERQUALITY_MAX                 = $00000064;
  {$EXTERNALSYM DVBUFFERQUALITY_MAX}
  DVBUFFERQUALITY_DEFAULT             = $00000000;
  {$EXTERNALSYM DVBUFFERQUALITY_DEFAULT}

  DVID_SYS                = 0;
  {$EXTERNALSYM DVID_SYS}

  //
  // Used to identify the session host in client/server
  //
  DVID_SERVERPLAYER       = 1;
  {$EXTERNALSYM DVID_SERVERPLAYER}

  //
  // Used to target all players
  //
  DVID_ALLPLAYERS         = 0;
  {$EXTERNALSYM DVID_ALLPLAYERS}

  //
  // Used to identify the main buffer
  //
  DVID_REMAINING          = $FFFFFFFF;
  {$EXTERNALSYM DVID_REMAINING}

  //
  // Input level range
  //
  DVINPUTLEVEL_MIN                    = $00000000;
  {$EXTERNALSYM DVINPUTLEVEL_MIN}
  DVINPUTLEVEL_MAX                    = $00000063; // 99 decimal
  {$EXTERNALSYM DVINPUTLEVEL_MAX}

  DVNOTIFYPERIOD_MINPERIOD            = 20;
  {$EXTERNALSYM DVNOTIFYPERIOD_MINPERIOD}


  DVPLAYBACKVOLUME_DEFAULT            = DSBVOLUME_MAX;
  {$EXTERNALSYM DVPLAYBACKVOLUME_DEFAULT}

  DVRECORDVOLUME_LAST                 = $00000001;
  {$EXTERNALSYM DVRECORDVOLUME_LAST}


  //
  // Use the default value
  //
  DVTHRESHOLD_DEFAULT               = $FFFFFFFF;
  {$EXTERNALSYM DVTHRESHOLD_DEFAULT}

  //
  // Threshold Ranges
  //
  DVTHRESHOLD_MIN                   = $00000000;
  {$EXTERNALSYM DVTHRESHOLD_MIN}
  DVTHRESHOLD_MAX                   = $00000063;	// 99 decimal
  {$EXTERNALSYM DVTHRESHOLD_MAX}

  //
  // Threshold field is not used
  //
  DVTHRESHOLD_UNUSED                = $FFFFFFFE;
  {$EXTERNALSYM DVTHRESHOLD_UNUSED}

  //
  // Session Types
  //
  DVSESSIONTYPE_PEER                  = $00000001;
  {$EXTERNALSYM DVSESSIONTYPE_PEER}
  DVSESSIONTYPE_MIXING                = $00000002;
  {$EXTERNALSYM DVSESSIONTYPE_MIXING}
  DVSESSIONTYPE_FORWARDING            = $00000003;
  {$EXTERNALSYM DVSESSIONTYPE_FORWARDING}
  DVSESSIONTYPE_ECHO                  = $00000004;
  {$EXTERNALSYM DVSESSIONTYPE_ECHO}

(****************************************************************************
 *
 * DirectPlayVoice Flags
 *
 ****************************************************************************)


  //
  // Enable automatic adjustment of the recording volume
  //
  DVCLIENTCONFIG_AUTORECORDVOLUME     = $00000008;
  {$EXTERNALSYM DVCLIENTCONFIG_AUTORECORDVOLUME}

  //
  // Enable automatic voice activation
  //
  DVCLIENTCONFIG_AUTOVOICEACTIVATED   = $00000020;
  {$EXTERNALSYM DVCLIENTCONFIG_AUTOVOICEACTIVATED}

  //
  // Enable echo suppression
  //
  DVCLIENTCONFIG_ECHOSUPPRESSION      = $08000000;
  {$EXTERNALSYM DVCLIENTCONFIG_ECHOSUPPRESSION}

  //
  // Voice Activation manual mode
  //
  DVCLIENTCONFIG_MANUALVOICEACTIVATED = $00000004;
  {$EXTERNALSYM DVCLIENTCONFIG_MANUALVOICEACTIVATED}

  //
  // Only playback voices that have buffers created for them
  //
  DVCLIENTCONFIG_MUTEGLOBAL           = $00000010;
  {$EXTERNALSYM DVCLIENTCONFIG_MUTEGLOBAL}

  //
  // Mute the playback
  //
  DVCLIENTCONFIG_PLAYBACKMUTE         = $00000002;
  {$EXTERNALSYM DVCLIENTCONFIG_PLAYBACKMUTE}

  //
  // Mute the recording
  //
  DVCLIENTCONFIG_RECORDMUTE           = $00000001;
  {$EXTERNALSYM DVCLIENTCONFIG_RECORDMUTE}

  //
  // Complete the operation before returning
  //
  DVFLAGS_SYNC                        = $00000001;
  {$EXTERNALSYM DVFLAGS_SYNC}

  //
  // Just check to see if wizard has been run, and if so what it's results were
  //
  DVFLAGS_QUERYONLY                   = $00000002;
  {$EXTERNALSYM DVFLAGS_QUERYONLY}

  //
  // Shutdown the voice session without migrating the host
  //
  DVFLAGS_NOHOSTMIGRATE               = $00000008;
  {$EXTERNALSYM DVFLAGS_NOHOSTMIGRATE}

  //
  // Allow the back button to be enabled in the wizard
  //
  DVFLAGS_ALLOWBACK                   = $00000010;
  {$EXTERNALSYM DVFLAGS_ALLOWBACK}

  //
  // Disable host migration in the voice session
  //
  DVSESSION_NOHOSTMIGRATION           = $00000001;
  {$EXTERNALSYM DVSESSION_NOHOSTMIGRATION}

  //
  // Server controlled targetting
  //
  DVSESSION_SERVERCONTROLTARGET       = $00000002;
  {$EXTERNALSYM DVSESSION_SERVERCONTROLTARGET}

  //
  // Use DirectSound Normal Mode instead of priority
  //
  DVSOUNDCONFIG_NORMALMODE            = $00000001;
  {$EXTERNALSYM DVSOUNDCONFIG_NORMALMODE}

  //
  // Automatically select the microphone
  //
  DVSOUNDCONFIG_AUTOSELECT            = $00000002;
  {$EXTERNALSYM DVSOUNDCONFIG_AUTOSELECT}

  //
  // Run in half duplex mode
  //
  DVSOUNDCONFIG_HALFDUPLEX            = $00000004;
  {$EXTERNALSYM DVSOUNDCONFIG_HALFDUPLEX}

  //
  // No volume controls are available for the recording device
  //
  DVSOUNDCONFIG_NORECVOLAVAILABLE     = $00000010;
  {$EXTERNALSYM DVSOUNDCONFIG_NORECVOLAVAILABLE}

  //
  // Disable capture sharing
  //
  DVSOUNDCONFIG_NOFOCUS               = $20000000;
  {$EXTERNALSYM DVSOUNDCONFIG_NOFOCUS}

  //
  // Set system conversion quality to high
  //
  DVSOUNDCONFIG_SETCONVERSIONQUALITY	= $00000008;
  {$EXTERNALSYM DVSOUNDCONFIG_SETCONVERSIONQUALITY}

  //
  // Enable strict focus mode
  //
  DVSOUNDCONFIG_STRICTFOCUS           = $40000000;
  {$EXTERNALSYM DVSOUNDCONFIG_STRICTFOCUS}

  //
  // Player is in half duplex mode
  //
  DVPLAYERCAPS_HALFDUPLEX             = $00000001;
  {$EXTERNALSYM DVPLAYERCAPS_HALFDUPLEX}

  //
  // Specifies that player is the local player
  //
  DVPLAYERCAPS_LOCAL                  = $00000002;
  {$EXTERNALSYM DVPLAYERCAPS_LOCAL}


type
(****************************************************************************
 *
 * DirectPlayVoice Interface Pointer definitions
 *
 ****************************************************************************)

  IDirectPlayVoiceServer = interface;

(****************************************************************************
 *
 * DirectPlayVoice Structures (Non-Message)
 *
 ****************************************************************************)


  //
  // DirectPlayVoice Caps
  // (GetCaps / SetCaps)
  //
  PDVCaps = ^TDVCaps;
  DVCAPS = packed record
    dwSize:   DWORD;                 // Size of this structure
    dwFlags:   DWORD;                // Caps flags
  end;
  {$EXTERNALSYM DVCAPS}
  TDVCaps = DVCAPS;

  //
  // DirectPlayVoice Client Configuration
  // (Connect / GetClientConfig)
  //
  PDVClientConfig = ^TDVClientConfig;
  DVCLIENTCONFIG = packed record
    dwSize: DWORD;                 // Size of this structure
    dwFlags: DWORD;                // Flags for client config (DVCLIENTCONFIG_...)
    lRecordVolume: Longint;        // Recording volume
    lPlaybackVolume: Longint;      // Playback volume
    dwThreshold: DWORD;            // Voice Activation Threshold
    dwBufferQuality: DWORD;        // Buffer quality
    dwBufferAggressiveness: DWORD; // Buffer aggressiveness
    dwNotifyPeriod: DWORD;         // Period of notification messages (ms)
  end;
  {$EXTERNALSYM DVCLIENTCONFIG}
  TDVClientConfig = DVCLIENTCONFIG;

  //
  // DirectPlayVoice Compression Type Information
  // (GetCompressionTypes)
  //
  PDVCompressionInfo = ^TDVCompressionInfo;
  DVCOMPRESSIONINFO = packed record
    dwSize: DWORD;                 // Size of this structure
    guidType: TGUID;               // GUID that identifies this compression type
    lpszName: PWideChar;           // String name of this compression type
    lpszDescription: PWideChar;    // Description for this compression type
    dwFlags: DWORD;                // Flags for this compression type
    dwMaxBitsPerSecond: DWORD;     // Maximum # of bit/s this compression type uses
  end;
  {$EXTERNALSYM DVCOMPRESSIONINFO}
  TDVCompressionInfo = DVCOMPRESSIONINFO;

  //
  // DirectPlayVoice Session Description
  // (Host / GetSessionDesc)
  //
  PDVSessionDesc = ^TDVSessionDesc;
  DVSESSIONDESC = packed record
    dwSize: DWORD;                 // Size of this structure
    dwFlags: DWORD;                // Session flags (DVSESSION_...)
    dwSessionType: DWORD;          // Session type (DVSESSIONTYPE_...)
    guidCT: TGUID;                 // Compression Type to use
    dwBufferQuality: DWORD;        // Buffer quality
    dwBufferAggressiveness: DWORD; // Buffer aggresiveness
  end;
  {$EXTERNALSYM DVSESSIONDESC}
  TDVSessionDesc = DVSESSIONDESC;

  //
  // DirectPlayVoice Client Sound Device Configuration
  // (Connect / GetSoundDeviceConfig)
  //
  PDVSoundDeviceConfig = ^TDVSoundDeviceConfig;
  DVSOUNDDEVICECONFIG = packed record
    dwSize: DWORD;                 // Size of this structure
    dwFlags: DWORD;                // Flags for sound config (DVSOUNDCONFIG_...)
    guidPlaybackDevice: TGUID;     // GUID of the playback device to use
    lpdsPlaybackDevice: IDirectSound; // DirectSound Object to use (optional)
    guidCaptureDevice: TGUID;      // GUID of the capture device to use
    lpdsCaptureDevice: IDirectSoundCapture; // DirectSoundCapture Object to use (optional)
    hwndAppWindow: HWND;           // HWND of your application's top-level window
    lpdsMainBuffer: IDirectSoundBuffer; // DirectSoundBuffer to use for playback (optional)
    dwMainBufferFlags: DWORD;      // Flags to pass to Play() on the main buffer
    dwMainBufferPriority: DWORD;   // Priority to set when calling Play() on the main buffer
  end;
  {$EXTERNALSYM DVSOUNDDEVICECONFIG}
  TDVSoundDeviceConfig = DVSOUNDDEVICECONFIG;

(****************************************************************************
 *
 * DirectPlayVoice message handler call back structures
 *
 ****************************************************************************)

  //
  // Result of the Connect() call.  (If it wasn't called Async)
  // (DVMSGID_CONNECTRESULT)
  //
  PDVMsgConnectResult = ^TDVMsgConnectResult;
  DVMSG_CONNECTRESULT = packed record
    dwSize: DWORD;                         // Size of this structure
    hrResult: HRESULT;                     // Result of the Connect() call
  end;
  {$EXTERNALSYM DVMSG_CONNECTRESULT}
  TDVMsgConnectResult = DVMSG_CONNECTRESULT;

  //
  // A new player has entered the voice session
  // (DVMSGID_CREATEVOICEPLAYER)
  //
  PDVMsgCreateVoicePlayer = ^TDVMsgCreateVoicePlayer;
  DVMSG_CREATEVOICEPLAYER = packed record
    dwSize: DWORD;                         // Size of this structure
    dvidPlayer: TDVID;                     // DVID of the player who joined
    dwFlags: DWORD;                        // Player flags (DVPLAYERCAPS_...)
    pvPlayerContext: Pointer;              // Context value for this player (user set)
  end;
  {$EXTERNALSYM DVMSG_CREATEVOICEPLAYER}
  TDVMsgCreateVoicePlayer = DVMSG_CREATEVOICEPLAYER;

  //
  // A player has left the voice session
  // (DVMSGID_DELETEVOICEPLAYER)
  //
  PDVMsgDeleteVoicePlayer = ^TDVMsgDeleteVoicePlayer;
  DVMSG_DELETEVOICEPLAYER = packed record
    dwSize: DWORD;                         // Size of this structure
    dvidPlayer: TDVID;                     // DVID of the player who left
    pvPlayerContext: Pointer;              // Context value for the player
  end;
  {$EXTERNALSYM DVMSG_DELETEVOICEPLAYER}
  TDVMsgDeleteVoicePlayer = DVMSG_DELETEVOICEPLAYER;

  //
  // Result of the Disconnect() call.  (If it wasn't called Async)
  // (DVMSGID_DISCONNECTRESULT)
  //
  PDVMsgDisconnectResult = ^TDVMsgDisconnectResult;
  DVMSG_DISCONNECTRESULT = packed record
    dwSize: DWORD;                         // Size of this structure
    hrResult: HRESULT;                     // Result of the Disconnect() call
  end;
  {$EXTERNALSYM DVMSG_DISCONNECTRESULT}
  TDVMsgDisconnectResult = DVMSG_DISCONNECTRESULT;

  //
  // The voice session host has migrated.
  // (DVMSGID_HOSTMIGRATED)
  //
  PDVMsgHostMigrated = ^TDVMsgHostMigrated;
  DVMSG_HOSTMIGRATED = packed record
    dwSize: DWORD;         // Size of this structure
    dvidNewHostID: TDVID;  // DVID of the player who is now the host
    pdvServerInterface: IDirectPlayVoiceServer; // Pointer to the new host object (if local player is now host)
  end;
  {$EXTERNALSYM DVMSG_HOSTMIGRATED}
  TDVMsgHostMigrated = DVMSG_HOSTMIGRATED;

  //
  // The current input level / recording volume on the local machine
  // (DVMSGID_INPUTLEVEL)
  //
  PDVMsgInputlevel = ^TDVMsgInputlevel;
  DVMSG_INPUTLEVEL = packed record
    dwSize: DWORD;                         // Size of this structure
    dwPeakLevel: DWORD;                    // Current peak level of the audio
    lRecordVolume: Longint;                // Current recording volume
    pvLocalPlayerContext: Pointer;         // Context value for the local player
  end;
  {$EXTERNALSYM DVMSG_INPUTLEVEL}
  TDVMsgInputlevel = DVMSG_INPUTLEVEL;

  //
  // The local client is about to become the new host
  // (DVMSGID_LOCALHOSTSETUP)
  //
  PDVMsgLocalHostSetup = ^TDVMsgLocalHostSetup;
  DVMSG_LOCALHOSTSETUP = packed record
    dwSize: DWORD;             // Size of this structure
    pvContext: Pointer;        // Context value to be passed to Initialize() of new host object
    pMessageHandler: TDVMessageHandler; // Message handler to be used by new host object
  end;
  {$EXTERNALSYM DVMSG_LOCALHOSTSETUP}
  TDVMsgLocalHostSetup = DVMSG_LOCALHOSTSETUP;

  //
  // The current output level for the combined output of all incoming streams.
  // (DVMSGID_OUTPUTLEVEL)
  //
  PDVMsgOutputLevel = ^TDVMsgOutputLevel;
  DVMSG_OUTPUTLEVEL = packed record
    dwSize: DWORD;                         // Size of this structure
    dwPeakLevel: DWORD;                    // Current peak level of the output
    lOutputVolume: Longint;                // Current playback volume
    pvLocalPlayerContext: Pointer;         // Context value for the local player
  end;
  {$EXTERNALSYM DVMSG_OUTPUTLEVEL}
  TDVMsgOutputLevel = DVMSG_OUTPUTLEVEL;

  //
  // The current peak level of an individual player's incoming audio stream as it is
  // being played back.
  // (DVMSGID_PLAYEROUTPUTLEVEL)
  //
  PDVMsgPlayerOutputLevel = ^TDVMsgPlayerOutputLevel;
  DVMSG_PLAYEROUTPUTLEVEL = packed record
    dwSize: DWORD;                         // Size of this structure
    dvidSourcePlayerID: TDVID;             // DVID of the player
    dwPeakLevel: DWORD;                    // Peak level of the player's stream
    pvPlayerContext: Pointer;              // Context value for the player
  end;
  {$EXTERNALSYM DVMSG_PLAYEROUTPUTLEVEL}
  TDVMsgPlayerOutputLevel = DVMSG_PLAYEROUTPUTLEVEL;

  //
  // An audio stream from the specified player has started playing back on the local client.
  // (DVMSGID_PLAYERVOICESTART).
  //
  PDVMsgPlayerVoiceStart = ^TDVMsgPlayerVoiceStart;
  DVMSG_PLAYERVOICESTART = packed record
    dwSize: DWORD;                         // Size of this structure
    dvidSourcePlayerID: TDVID;             // DVID of the Player
    pvPlayerContext: Pointer;              // Context value for this player
  end;
  {$EXTERNALSYM DVMSG_PLAYERVOICESTART}
  TDVMsgPlayerVoiceStart = DVMSG_PLAYERVOICESTART;

  //
  // The audio stream from the specified player has stopped playing back on the local client.
  // (DVMSGID_PLAYERVOICESTOP)
  //
  PDVMsgPlayerVoiceStop = ^TDVMsgPlayerVoiceStop;
  DVMSG_PLAYERVOICESTOP = packed record
    dwSize:   DWORD;                         // Size of this structure
    dvidSourcePlayerID:    DVID;             // DVID of the player
    pvPlayerContext:	Pointer;                // Context value for this player
  end;
  {$EXTERNALSYM DVMSG_PLAYERVOICESTOP}
  TDVMsgPlayerVoiceStop = DVMSG_PLAYERVOICESTOP;

  //
  // Transmission has started on the local machine
  // (DVMSGID_RECORDSTART)
  //
  PDVMsgRecordStart = ^TDVMsgRecordStart;
  DVMSG_RECORDSTART = packed record
    dwSize:   DWORD;                         // Size of this structure
    dwPeakLevel:   DWORD;                    // Peak level that caused transmission to start
    pvLocalPlayerContext:	Pointer;           // Context value for the local player
  end;
  {$EXTERNALSYM DVMSG_RECORDSTART}
  TDVMsgRecordStart = DVMSG_RECORDSTART;

  //
  // Transmission has stopped on the local machine
  // (DVMSGID_RECORDSTOP)
  //
  PDVMsgRecordStop = ^TDVMsgRecordStop;
  DVMSG_RECORDSTOP = packed record
    dwSize: DWORD;                         // Size of this structure
    dwPeakLevel: DWORD;                    // Peak level that caused transmission to stop
    pvLocalPlayerContext: Pointer;         // Context value for the local player
  end;
  {$EXTERNALSYM DVMSG_RECORDSTOP}
  TDVMsgRecordStop = DVMSG_RECORDSTOP;

  //
  // The voice session has been lost
  // (DVMSGID_SESSIONLOST)
  //
  PDVMsgSessionLost = ^TDVMsgSessionLost;
  DVMSG_SESSIONLOST = packed record
    dwSize: DWORD;                         // Size of this structure
    hrResult: HRESULT;                     // Reason the session was disconnected
  end;
  {$EXTERNALSYM DVMSG_SESSIONLOST}
  TDVMsgSessionLost = DVMSG_SESSIONLOST;

  //
  // The target list has been updated for the local client
  // (DVMSGID_SETTARGETS)
  //
  PDVMsgSetTargets = ^TDVMsgSetTargets;
  DVMSG_SETTARGETS = packed record
    dwSize: DWORD;                         // Size of this structure
    dwNumTargets: DWORD;                   // # of targets
    pdvidTargets: PDVID;                   // An array of DVIDs specifying the current targets
  end;
  {$EXTERNALSYM DVMSG_SETTARGETS}
  TDVMsgSetTargets = DVMSG_SETTARGETS;


(****************************************************************************
 *
 * DirectPlayVoice Functions
 *
 ****************************************************************************)

(*
 *
 * This function is no longer supported.  It is recommended that CoCreateInstance be used to create
 * DirectPlay voice objects.
 *
 * extern HRESULT WINAPI DirectPlayVoiceCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown);
 *
 *)

(****************************************************************************
 *
 * DirectPlay8 Application Interfaces
 *
 ****************************************************************************)

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlayVoiceClient);'}
  {$EXTERNALSYM IDirectPlayVoiceClient}
  IDirectPlayVoiceClient = interface(IUnknown)
    ['{1dfdc8ea-bcf7-41d6-b295-ab64b3b23306}']
    (*** IDirectPlayVoiceClient methods ***)
    function Initialize(pVoid: IUnknown; pMessageHandler: TDVMessageHandler;
      pUserContext: Pointer; pdwMessageMask: PDWORD; dwMessageMaskElements: DWORD): HResult; stdcall;
    function Connect(const pSoundDeviceConfig: TDVSoundDeviceConfig;
      const pdvClientConfig: TDVClientConfig; dwFlags: DWORD): HResult; stdcall;
    function Disconnect(dwFlags: DWORD): HResult; stdcall;
    function GetSessionDesc(out pvSessionDesc: TDVSessionDesc): HResult; stdcall;
    function GetClientConfig(out pClientConfig: TDVClientConfig): HResult; stdcall;
    function SetClientConfig(const pClientConfig: TDVClientConfig): HResult; stdcall;
    function GetCaps(out pDVCaps: TDVCaps): HResult; stdcall;
    function GetCompressionTypes(pData: Pointer; var pdwDataSize: DWORD;
      out pdwNumElements: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetTransmitTargets(pdvIDTargets: PDVID; dwNumTargets, dwFlags: DWORD): HResult; stdcall;
    function GetTransmitTargets(pdvIDTargets: PDVID; var dwNumTargets: DWORD; dwFlags: DWORD): HResult; stdcall;
    function Create3DSoundBuffer(dvID: TDVID; lpdsSourceBuffer: IDirectSoundBuffer;
      dwPriority, dwFlags: DWORD; out lpUserBuffer: IDirectSound3DBuffer): HResult; stdcall;
    function Delete3DSoundBuffer(dvID: TDVID; lpUserBuffer: IDirectSound3DBuffer): HResult; stdcall;
    function SetNotifyMask(pdwMessageMask: PDWORD; dwMessageMaskElements: DWORD): HResult; stdcall;
    function GetSoundDeviceConfig(pSoundDeviceConfig: PDVSoundDeviceConfig; var pdwSize: DWORD): HResult; stdcall;
  end;


  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlayVoiceServer);'}
  {$EXTERNALSYM IDirectPlayVoiceServer}
  IDirectPlayVoiceServer = interface(IUnknown)
    ['{faa1c173-0468-43b6-8a2a-ea8a4f2076c9}']
    (*** IDirectPlayVoiceServer methods ***)
    function Initialize(pVoid: IUnknown; pMessageHandler: TDVMessageHandler;
      pUserContext: Pointer; pdwMessageMask: PDWORD; dwMessageMaskElements: DWORD): HResult; stdcall;
    function StartSession(const pSessionDesc: TDVSessionDesc; dwFlags: DWORD): HResult; stdcall;
    function StopSession(dwFlags: DWORD): HResult; stdcall;
    function GetSessionDesc(out pvSessionDesc: TDVSessionDesc): HResult; stdcall;
    function SetSessionDesc(const pvSessionDesc: TDVSessionDesc): HResult; stdcall;
    function GetCaps(out pDVCaps: TDVCaps): HResult; stdcall;
    function GetCompressionTypes(pData: Pointer; var pdwDataSize: DWORD;
      out pdwNumElements: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetTransmitTargets(dvSource: TDVID; pdvIDTargets: PDVID;
      dwNumTargets, dwFlags: DWORD): HResult; stdcall;
    function GetTransmitTargets(dvSource: TDVID; pdvIDTargets: PDVID;
      var dwNumTargets: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetNotifyMask(pdwMessageMask: PDWORD; dwMessageMaskElements: DWORD): HResult; stdcall;
  end;

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlayVoiceTest);'}
  {$EXTERNALSYM IDirectPlayVoiceTest}
  IDirectPlayVoiceTest = interface(IUnknown)
    ['{d26af734-208b-41da-8224-e0ce79810be1}']
    (*** IDirectPlayVoiceTest methods ***)
    function CheckAudioSetup(pguidPlaybackDevice, pguidCaptureDevice: PGUID;
      hwndParent: hWND; dwFlags: DWORD): HResult; stdcall;
  end;

(****************************************************************************
 *
 * DirectPlayVoice Interface IIDs
 *
 ****************************************************************************)

  // {1DFDC8EA-BCF7-41d6-B295-AB64B3B23306}
  IID_IDirectPlayVoiceClient = IDirectPlayVoiceClient;
  {$EXTERNALSYM IID_IDirectPlayVoiceClient}

  // {FAA1C173-0468-43b6-8A2A-EA8A4F2076C9}
  IID_IDirectPlayVoiceServer = IDirectPlayVoiceServer;
  {$EXTERNALSYM IID_IDirectPlayVoiceServer}

  // {D26AF734-208B-41da-8224-E0CE79810BE1}
  IID_IDirectPlayVoiceTest = IDirectPlayVoiceTest;
  {$EXTERNALSYM IID_IDirectPlayVoiceTest}


(****************************************************************************
 *
 * DIRECTPLAYVOICE ERRORS
 *
 * Errors are represented by negative values and cannot be combined.
 *
 ****************************************************************************)

const
  _FACDPV  = $15;
  {$EXTERNALSYM _FACDPV}

//#define MAKE_DVHRESULT( code )          MAKE_HRESULT( 1, _FACDPV, code )

(*
#define DV_FULLDUPLEX                   MAKE_HRESULT( 0, _FACDPV,  0x0005 )
#define DV_HALFDUPLEX                   MAKE_HRESULT( 0, _FACDPV,  0x000A )
#define DV_PENDING						MAKE_HRESULT( 0, _FACDPV,  0x0010 )

#define DVERR_BUFFERTOOSMALL            MAKE_DVHRESULT(  0x001E )
#define DVERR_EXCEPTION                 MAKE_DVHRESULT(  0x004A )
#define DVERR_GENERIC                   E_FAIL
#define DVERR_INVALIDFLAGS              MAKE_DVHRESULT( 0x0078 )
#define DVERR_INVALIDOBJECT             MAKE_DVHRESULT( 0x0082 )
#define DVERR_INVALIDPARAM              E_INVALIDARG
#define DVERR_INVALIDPLAYER             MAKE_DVHRESULT( 0x0087 )
#define DVERR_INVALIDGROUP              MAKE_DVHRESULT( 0x0091 )
#define DVERR_INVALIDHANDLE             MAKE_DVHRESULT( 0x0096 )
#define DVERR_OUTOFMEMORY               E_OUTOFMEMORY
#define DVERR_PENDING                   DV_PENDING
#define DVERR_NOTSUPPORTED              E_NOTIMPL
#define DVERR_NOINTERFACE               E_NOINTERFACE
#define DVERR_SESSIONLOST               MAKE_DVHRESULT( 0x012C )
#define DVERR_NOVOICESESSION            MAKE_DVHRESULT( 0x012E )
#define DVERR_CONNECTIONLOST            MAKE_DVHRESULT( 0x0168 )
#define DVERR_NOTINITIALIZED            MAKE_DVHRESULT( 0x0169 )
#define DVERR_CONNECTED                 MAKE_DVHRESULT( 0x016A )
#define DVERR_NOTCONNECTED              MAKE_DVHRESULT( 0x016B )
#define DVERR_CONNECTABORTING           MAKE_DVHRESULT( 0x016E )
#define DVERR_NOTALLOWED                MAKE_DVHRESULT( 0x016F )
#define DVERR_INVALIDTARGET             MAKE_DVHRESULT( 0x0170 )
#define DVERR_TRANSPORTNOTHOST          MAKE_DVHRESULT( 0x0171 )
#define DVERR_COMPRESSIONNOTSUPPORTED   MAKE_DVHRESULT( 0x0172 )
#define DVERR_ALREADYPENDING            MAKE_DVHRESULT( 0x0173 )
#define DVERR_SOUNDINITFAILURE          MAKE_DVHRESULT( 0x0174 )
#define DVERR_TIMEOUT                   MAKE_DVHRESULT( 0x0175 )
#define DVERR_CONNECTABORTED            MAKE_DVHRESULT( 0x0176 )
#define DVERR_NO3DSOUND                 MAKE_DVHRESULT( 0x0177 )
#define DVERR_ALREADYBUFFERED	        MAKE_DVHRESULT( 0x0178 )
#define DVERR_NOTBUFFERED               MAKE_DVHRESULT( 0x0179 )
#define DVERR_HOSTING                   MAKE_DVHRESULT( 0x017A )
#define DVERR_NOTHOSTING                MAKE_DVHRESULT( 0x017B )
#define DVERR_INVALIDDEVICE             MAKE_DVHRESULT( 0x017C )
#define DVERR_RECORDSYSTEMERROR         MAKE_DVHRESULT( 0x017D )
#define DVERR_PLAYBACKSYSTEMERROR       MAKE_DVHRESULT( 0x017E )
#define DVERR_SENDERROR                 MAKE_DVHRESULT( 0x017F )
#define DVERR_USERCANCEL                MAKE_DVHRESULT( 0x0180 )
#define DVERR_RUNSETUP                  MAKE_DVHRESULT( 0x0183 )
#define DVERR_INCOMPATIBLEVERSION       MAKE_DVHRESULT( 0x0184 )
#define DVERR_INITIALIZED               MAKE_DVHRESULT( 0x0187 )
#define DVERR_INVALIDPOINTER            E_POINTER
#define DVERR_NOTRANSPORT               MAKE_DVHRESULT( 0x0188 )
#define DVERR_NOCALLBACK                MAKE_DVHRESULT( 0x0189 )
#define DVERR_TRANSPORTNOTINIT          MAKE_DVHRESULT( 0x018A )
#define DVERR_TRANSPORTNOSESSION        MAKE_DVHRESULT( 0x018B )
#define DVERR_TRANSPORTNOPLAYER         MAKE_DVHRESULT( 0x018C )
#define DVERR_USERBACK                  MAKE_DVHRESULT( 0x018D )
#define DVERR_NORECVOLAVAILABLE         MAKE_DVHRESULT( 0x018E )
#define DVERR_INVALIDBUFFER				MAKE_DVHRESULT( 0x018F )
#define DVERR_LOCKEDBUFFER				MAKE_DVHRESULT( 0x0190 )
*)

  MAKE_DVHRESULT_R                = (1 shl 31) or (_FACDPV shl 16);

  DV_OK                           = S_OK;
  {$EXTERNALSYM DV_OK}
  DV_FULLDUPLEX                   = (0 shl 31) or (_FACDPV shl 16) or $0005;
  {$EXTERNALSYM DV_FULLDUPLEX}
  DV_HALFDUPLEX                   = (0 shl 31) or (_FACDPV shl 16) or $000A;
  {$EXTERNALSYM DV_HALFDUPLEX}
  DV_PENDING		      	  = (0 shl 31) or (_FACDPV shl 16) or $0010;
  {$EXTERNALSYM DV_PENDING}

  DVERR_BUFFERTOOSMALL            = MAKE_DVHRESULT_R + $001E ;
  {$EXTERNALSYM DVERR_BUFFERTOOSMALL}
  DVERR_EXCEPTION                 = MAKE_DVHRESULT_R + $004A ;
  {$EXTERNALSYM DVERR_EXCEPTION}
  DVERR_GENERIC                   = E_FAIL;
  {$EXTERNALSYM DVERR_GENERIC}
  DVERR_INVALIDFLAGS              = MAKE_DVHRESULT_R + $0078 ;
  {$EXTERNALSYM DVERR_INVALIDFLAGS}
  DVERR_INVALIDOBJECT             = MAKE_DVHRESULT_R + $0082 ;
  {$EXTERNALSYM DVERR_INVALIDOBJECT}
  DVERR_INVALIDPARAM              = E_INVALIDARG;
  {$EXTERNALSYM DVERR_INVALIDPARAM}
  DVERR_INVALIDPLAYER             = MAKE_DVHRESULT_R + $0087 ;
  {$EXTERNALSYM DVERR_INVALIDPLAYER}
  DVERR_INVALIDGROUP              = MAKE_DVHRESULT_R + $0091 ;
  {$EXTERNALSYM DVERR_INVALIDGROUP}
  DVERR_INVALIDHANDLE             = MAKE_DVHRESULT_R + $0096 ;
  {$EXTERNALSYM DVERR_INVALIDHANDLE}
  DVERR_OUTOFMEMORY               = E_OUTOFMEMORY;
  {$EXTERNALSYM DVERR_OUTOFMEMORY}
  DVERR_PENDING                   = DV_PENDING;
  {$EXTERNALSYM DVERR_PENDING}
  DVERR_NOTSUPPORTED              = E_NOTIMPL;
  {$EXTERNALSYM DVERR_NOTSUPPORTED}
  DVERR_NOINTERFACE               = E_NOINTERFACE;
  {$EXTERNALSYM DVERR_NOINTERFACE}
  DVERR_SESSIONLOST               = MAKE_DVHRESULT_R + $012C ;
  {$EXTERNALSYM DVERR_SESSIONLOST}
  DVERR_NOVOICESESSION            = MAKE_DVHRESULT_R + $012E ;
  {$EXTERNALSYM DVERR_NOVOICESESSION}
  DVERR_CONNECTIONLOST            = MAKE_DVHRESULT_R + $0168 ;
  {$EXTERNALSYM DVERR_CONNECTIONLOST}
  DVERR_NOTINITIALIZED            = MAKE_DVHRESULT_R + $0169 ;
  {$EXTERNALSYM DVERR_NOTINITIALIZED}
  DVERR_CONNECTED                 = MAKE_DVHRESULT_R + $016A ;
  {$EXTERNALSYM DVERR_CONNECTED}
  DVERR_NOTCONNECTED              = MAKE_DVHRESULT_R + $016B ;
  {$EXTERNALSYM DVERR_NOTCONNECTED}
  DVERR_CONNECTABORTING           = MAKE_DVHRESULT_R + $016E ;
  {$EXTERNALSYM DVERR_CONNECTABORTING}
  DVERR_NOTALLOWED                = MAKE_DVHRESULT_R + $016F ;
  {$EXTERNALSYM DVERR_NOTALLOWED}
  DVERR_INVALIDTARGET             = MAKE_DVHRESULT_R + $0170 ;
  {$EXTERNALSYM DVERR_INVALIDTARGET}
  DVERR_TRANSPORTNOTHOST          = MAKE_DVHRESULT_R + $0171 ;
  {$EXTERNALSYM DVERR_TRANSPORTNOTHOST}
  DVERR_COMPRESSIONNOTSUPPORTED   = MAKE_DVHRESULT_R + $0172 ;
  {$EXTERNALSYM DVERR_COMPRESSIONNOTSUPPORTED}
  DVERR_ALREADYPENDING            = MAKE_DVHRESULT_R + $0173 ;
  {$EXTERNALSYM DVERR_ALREADYPENDING}
  DVERR_SOUNDINITFAILURE          = MAKE_DVHRESULT_R + $0174 ;
  {$EXTERNALSYM DVERR_SOUNDINITFAILURE}
  DVERR_TIMEOUT                   = MAKE_DVHRESULT_R + $0175 ;
  {$EXTERNALSYM DVERR_TIMEOUT}
  DVERR_CONNECTABORTED            = MAKE_DVHRESULT_R + $0176 ;
  {$EXTERNALSYM DVERR_CONNECTABORTED}
  DVERR_NO3DSOUND                 = MAKE_DVHRESULT_R + $0177 ;
  {$EXTERNALSYM DVERR_NO3DSOUND}
  DVERR_ALREADYBUFFERED	          = MAKE_DVHRESULT_R + $0178 ;
  {$EXTERNALSYM DVERR_ALREADYBUFFERED}
  DVERR_NOTBUFFERED               = MAKE_DVHRESULT_R + $0179 ;
  {$EXTERNALSYM DVERR_NOTBUFFERED}
  DVERR_HOSTING                   = MAKE_DVHRESULT_R + $017A ;
  {$EXTERNALSYM DVERR_HOSTING}
  DVERR_NOTHOSTING                = MAKE_DVHRESULT_R + $017B ;
  {$EXTERNALSYM DVERR_NOTHOSTING}
  DVERR_INVALIDDEVICE             = MAKE_DVHRESULT_R + $017C ;
  {$EXTERNALSYM DVERR_INVALIDDEVICE}
  DVERR_RECORDSYSTEMERROR         = MAKE_DVHRESULT_R + $017D ;
  {$EXTERNALSYM DVERR_RECORDSYSTEMERROR}
  DVERR_PLAYBACKSYSTEMERROR       = MAKE_DVHRESULT_R + $017E ;
  {$EXTERNALSYM DVERR_PLAYBACKSYSTEMERROR}
  DVERR_SENDERROR                 = MAKE_DVHRESULT_R + $017F ;
  {$EXTERNALSYM DVERR_SENDERROR}
  DVERR_USERCANCEL                = MAKE_DVHRESULT_R + $0180 ;
  {$EXTERNALSYM DVERR_USERCANCEL}
  DVERR_RUNSETUP                  = MAKE_DVHRESULT_R + $0183 ;
  {$EXTERNALSYM DVERR_RUNSETUP}
  DVERR_INCOMPATIBLEVERSION       = MAKE_DVHRESULT_R + $0184 ;
  {$EXTERNALSYM DVERR_INCOMPATIBLEVERSION}
  DVERR_INITIALIZED               = MAKE_DVHRESULT_R + $0187 ;
  {$EXTERNALSYM DVERR_INITIALIZED}
  DVERR_INVALIDPOINTER            = E_POINTER;
  {$EXTERNALSYM DVERR_INVALIDPOINTER}
  DVERR_NOTRANSPORT               = MAKE_DVHRESULT_R + $0188 ;
  {$EXTERNALSYM DVERR_NOTRANSPORT}
  DVERR_NOCALLBACK                = MAKE_DVHRESULT_R + $0189 ;
  {$EXTERNALSYM DVERR_NOCALLBACK}
  DVERR_TRANSPORTNOTINIT          = MAKE_DVHRESULT_R + $018A ;
  {$EXTERNALSYM DVERR_TRANSPORTNOTINIT}
  DVERR_TRANSPORTNOSESSION        = MAKE_DVHRESULT_R + $018B ;
  {$EXTERNALSYM DVERR_TRANSPORTNOSESSION}
  DVERR_TRANSPORTNOPLAYER         = MAKE_DVHRESULT_R + $018C ;
  {$EXTERNALSYM DVERR_TRANSPORTNOPLAYER}
  DVERR_USERBACK                  = MAKE_DVHRESULT_R + $018D ;
  {$EXTERNALSYM DVERR_USERBACK}
  DVERR_NORECVOLAVAILABLE         = MAKE_DVHRESULT_R + $018E ;
  {$EXTERNALSYM DVERR_NORECVOLAVAILABLE}
  DVERR_INVALIDBUFFER             = MAKE_DVHRESULT_R + $018F ;
  {$EXTERNALSYM DVERR_INVALIDBUFFER}
  DVERR_LOCKEDBUFFER              = MAKE_DVHRESULT_R + $0190 ;
  {$EXTERNALSYM DVERR_LOCKEDBUFFER}



///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Compatibility types for non-Borland compliant translations of DirectPlay8 //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

type
  PDvmsg_Connectresult = PDVMsgConnectResult;
  TDvmsg_Connectresult = TDVMsgConnectResult;
  PDvmsg_Createvoiceplayer = PDVMsgCreateVoicePlayer;
  TDvmsg_Createvoiceplayer = TDVMsgCreateVoicePlayer;
  PDvmsg_Deletevoiceplayer = PDVMsgDeleteVoicePlayer;
  TDvmsg_Deletevoiceplayer = TDVMsgDeleteVoicePlayer;
  PDvmsg_Disconnectresult = PDVMsgDisconnectResult;
  TDvmsg_Disconnectresult = TDVMsgDisconnectResult;
  PDvmsg_Hostmigrated = PDVMsgHostMigrated;
  TDvmsg_Hostmigrated = TDVMsgHostMigrated;
  PDvmsg_Inputlevel = PDVMsgInputlevel;
  TDvmsg_Inputlevel = TDVMsgInputlevel;
  PDvmsg_Localhostsetup = PDVMsgLocalHostSetup;
  TDvmsg_Localhostsetup = TDVMsgLocalHostSetup;
  PDvmsg_Outputlevel = PDVMsgOutputLevel;
  TDvmsg_Outputlevel = TDVMsgOutputLevel;
  PDvmsg_Playeroutputlevel = PDVMsgPlayerOutputLevel;
  TDvmsg_Playeroutputlevel = TDVMsgPlayerOutputLevel;
  PDvmsg_Playervoicestart = PDVMsgPlayerVoiceStart;
  TDvmsg_Playervoicestart = TDVMsgPlayerVoiceStart;
  PDvmsg_Playervoicestop = PDVMsgPlayerVoiceStop;
  TDvmsg_Playervoicestop = TDVMsgPlayerVoiceStop;
  PDvmsg_Recordstart = PDVMsgRecordStart;
  TDvmsg_Recordstart = TDVMsgRecordStart;
  PDvmsg_Recordstop = PDVMsgRecordStop;
  TDvmsg_Recordstop = TDVMsgRecordStop;
  PDvmsg_Sessionlost = PDVMsgSessionLost;
  TDvmsg_Sessionlost = TDVMsgSessionLost;
  PDvmsg_Settargets = PDVMsgSetTargets;
  TDvmsg_Settargets = TDVMsgSetTargets;

  PDPN_Application_Desc = PDPNApplicationDesc;
  TDPN_Application_Desc = TDPNApplicationDesc;
  PDPN_Caps = PDPNCaps;
  TDPN_Caps = TDPNCaps;
  PDPN_Caps_Ex = PDPNCapsEx;
  TDPN_Caps_Ex = TDPNCapsEx;
  PDPN_Connection_Info = PDPNConnectionInfo;
  TDPN_Connection_Info = TDPNConnectionInfo;
  PDPN_Group_Info = PDPNGroupInfo;
  TDPN_Group_Info = TDPNGroupInfo;
  PDPN_Player_Info = PDPNPlayerInfo;
  TDPN_Player_Info = TDPNPlayerInfo;
  PDPN_Security_Credentials = PDPNSecurityCredentials;
  TDPN_Security_Credentials = TDPNSecurityCredentials;
  PDPN_Security_Desc = PDPNSecurityDesc;
  TDPN_Security_Desc = TDPNSecurityDesc;
  PDPN_Service_Provider_Info = PDPNServiceProviderInfo;
  TDPN_Service_Provider_Info = TDPNServiceProviderInfo;
  PDPN_Sp_Caps = PDPNSpCaps;
  TDPN_Sp_Caps = TDPNSpCaps;
  PDPNMsg_Add_Player_To_Group = PDPNMsgAddPlayerToGroup;
  TDPNMsg_Add_Player_To_Group = TDPNMsgAddPlayerToGroup;
  PDPNMsg_Async_Op_Complete = PDPNMsgAsyncOpComplete;
  TDPNMsg_Async_Op_Complete = TDPNMsgAsyncOpComplete;
  PDPNMsg_Client_Info = PDPNMsgClientInfo;
  TDPNMsg_Client_Info = TDPNMsgClientInfo;
  PDPNMsg_Connect_Complete = PDPNMsgConnectComplete;
  TDPNMsg_Connect_Complete = TDPNMsgConnectComplete;
  PDPNMsg_Create_Group = PDPNMsgCreateGroup;
  TDPNMsg_Create_Group = TDPNMsgCreateGroup;
  PDPNMsg_Create_Player = PDPNMsgCreatePlayer;
  TDPNMsg_Create_Player = TDPNMsgCreatePlayer;
  PDPNMsg_Destroy_Group = PDPNMsgDestroyGroup;
  TDPNMsg_Destroy_Group = TDPNMsgDestroyGroup;
  PDPNMsg_Destroy_Player = PDPNMsgDestroyPlayer;
  TDPNMsg_Destroy_Player = TDPNMsgDestroyPlayer;
  PDPNMsg_Enum_Hosts_Query = PDPNMsgEnumHostsQuery;
  TDPNMsg_Enum_Hosts_Query = TDPNMsgEnumHostsQuery;
  PDPNMsg_Enum_Hosts_Response = PDPNMsgEnumHostsResponse;
  TDPNMsg_Enum_Hosts_Response = TDPNMsgEnumHostsResponse;
  PDPNMsg_Group_Info = PDPNMsgGroupInfo;
  TDPNMsg_Group_Info = TDPNMsgGroupInfo;
  PDPNMsg_Host_Migrate = PDPNMsgHostMigrate;
  TDPNMsg_Host_Migrate = TDPNMsgHostMigrate;
  PDPNMsg_Indicate_Connect = PDPNMsgIndicateConnect;
  TDPNMsg_Indicate_Connect = TDPNMsgIndicateConnect;
  PDPNMsg_Indicated_Connect_Aborted = PDPNMsgIndicatedConnectAborted;
  TDPNMsg_Indicated_Connect_Aborted = TDPNMsgIndicatedConnectAborted;
  PDPNMsg_Peer_Info = PDPNMsgPeerInfo;
  TDPNMsg_Peer_Info = TDPNMsgPeerInfo;
  PDPNMsg_Receive = PDPNMsgReceive;
  TDPNMsg_Receive = TDPNMsgReceive;
  PDPNMsg_Remove_Player_From_Group = PDPNMsgRemovePlayerFromGroup;
  TDPNMsg_Remove_Player_From_Group = TDPNMsgRemovePlayerFromGroup;
  PDPNMsg_Return_Buffer = PDPNMsgReturnBuffer;
  TDPNMsg_Return_Buffer = TDPNMsgReturnBuffer;
  PDPNMsg_Send_Complete = PDPNMsgSendComplete;
  TDPNMsg_Send_Complete = TDPNMsgSendComplete;
  PDPNMsg_Server_Info = PDPNMsgServerInfo;
  TDPNMsg_Server_Info = TDPNMsgServerInfo;
  PDPNMsg_Terminate_Session = PDPNMsgTerminateSession;
  TDPNMsg_Terminate_Session = TDPNMsgTerminateSession;
  PDPNMsg_Create_Thread = PDPNMsgCreateThread;
  TDPNMsg_Create_Thread = TDPNMsgCreateThread;
  PDPNMsg_Destroy_Thread = PDPNMsgDestroyThread;
  TDPNMsg_Destroy_Thread = TDPNMsgDestroyThread;
  PDPNMsg_Nat_Resolver_Query = PDPNMsgNatResolverQuery;
  TDPNMsg_Nat_Resolver_Query = TDPNMsgNatResolverQuery;


implementation

// #define MAKE_DPNHRESULT( code )  MAKE_HRESULT( 1, _DPN_FACILITY_CODE, ( code + _DPNHRESULT_BASE ) )
function MAKE_DPNHRESULT(Code: DWORD): DWORD;
begin
  Result:= DWord((1 shl 31) or (_DPN_FACILITY_CODE shl 16)) or (Code + _DPNHRESULT_BASE);
end;

end.