Filter:   InfoImg
download jwalmdfs.pas
Language: Delphi
License: LGPL
Copyright: (C) 1995-2001 Microsoft } (C) 1999-2001 }
LOC: 368
Project Info
FreePascal
Server: FreePascal
Type: zip
...rc\packages\extra\winunits\
   activex.pp
   buildjwa.pp
   commctrl.pp
   comobj.pp
   jedi.inc
   jediapilib.inc
   jwaaccctrl.pas
   jwaaclapi.pas
   jwaaclui.pas
   jwaactiveds.pas
   jwaadsdb.pas
   jwaadserr.pas
   jwaadshlp.pas
   jwaadsnms.pas
   jwaadsprop.pas
   jwaadssts.pas
   jwaadstlb.pas
   jwaadtgen.pas
   jwaaf_irda.pas
   jwaatalkwsh.pas
   jwaauthif.pas
   jwaauthz.pas
   jwabatclass.pas
   jwabits.pas
   jwabits1_5.pas
   jwabitscfg.pas
   jwabitsmsg.pas
   jwablberr.pas
   jwabluetoothapis.pas
   jwabthdef.pas
   jwabthsdpdef.pas
   jwabugcodes.pas
   jwacderr.pas
   jwacmnquery.pas
   jwacolordlg.pas
   jwacpl.pas
   jwacplext.pas
   jwacryptuiapi.pas
   jwadbt.pas
   jwadde.pas
   jwadhcpcsdk.pas
   jwadhcpsapi.pas
   jwadhcpssdk.pas
   jwadlgs.pas
   jwadsadmin.pas
   jwadsclient.pas
   jwadsgetdc.pas
   jwadskquota.pas
   jwadsquery.pas
   jwadsrole.pas
   jwadssec.pas
   jwaerrorrep.pas
   jwaexcpt.pas
   jwafaxdev.pas
   jwafaxext.pas
   jwafaxmmc.pas
   jwafaxroute.pas
   jwagpedit.pas
   jwahherror.pas
   jwahtmlGuid.pas
   jwahtmlhelp.pas
   jwaiaccess.pas
   jwaiadmext.pas
   jwaicmpapi.pas
   jwaiiscnfg.pas
   jwaimagehlp.pas
   jwaimapi.pas
   jwaimapierror.pas
   jwaime.pas
   jwaioevent.pas
   jwaipexport.pas
   jwaiphlpapi.pas
   jwaipifcons.pas
   jwaipinfoid.pas
   jwaiprtrmib.pas
   jwaiptypes.pas
   jwaisguids.pas
   jwaissper16.pas
   jwalmaccess.pas
   jwalmalert.pas
   jwalmapibuf.pas
   jwalmat.pas
   jwalmaudit.pas
   jwalmconfig.pas
   jwalmcons.pas
   jwalmdfs.pas
   jwalmerr.pas
   jwalmerrlog.pas
   jwalmjoin.pas
   jwalmmsg.pas
   jwalmremutl.pas
   jwalmrepl.pas
   jwalmserver.pas
   jwalmshare.pas
   jwalmsname.pas
   jwalmstats.pas
   jwalmsvc.pas
   jwalmuse.pas
   jwalmuseflg.pas
   jwalmwksta.pas
   jwaloadperf.pas
   jwalpmapi.pas
   jwamciavi.pas
   jwamprerror.pas
   jwamsi.pas
   jwamsidefs.pas
   jwamsiquery.pas
   jwamstask.pas
   jwamstcpip.pas
   jwamswsock.pas
   jwanative.pas
   jwanb30.pas
   jwanetsh.pas
   jwanspapi.pas
   jwantddpar.pas
   jwantdsapi.pas
   jwantdsbcli.pas
   jwantdsbmsg.pas
   jwantldap.pas
   jwantquery.pas
   jwantsecapi.pas
   jwantstatus.pas
   jwaObjsel.pas
   jwapatchapi.pas
   jwapatchwiz.pas
   jwapbt.pas
   jwapdh.pas
   jwapdhmsg.pas
   jwapowrprof.pas
   jwaprofinfo.pas
   jwaprotocol.pas
   jwaprsht.pas
   jwapsapi.pas
   jwaqos.pas
   jwaqosname.pas
   jwaqospol.pas
   jwaqossp.pas
   jwareason.pas
   jwaregstr.pas
   jwarpc.pas
   jwarpcasync.pas
   jwarpcdce.pas
   jwarpcnsi.pas
   jwarpcnterr.pas
   jwarpcssl.pas
   jwascesvc.pas
   jwaschedule.pas
   jwaschemadef.pas
   jwasddl.pas
   jwasecext.pas
   jwasecurity.pas
   jwasens.pas
   jwasensapi.pas
   jwasensevts.pas
   jwasfc.pas
   jwashlguid.pas
   jwasisbkup.pas
   jwasnmp.pas
   jwasporder.pas
   jwasrrestoreptapi.pas
   jwasspi.pas
   jwasubauth.pas
   jwasvcguid.pas
   jwatlhelp32.pas
   jwatmschema.pas
   jwatraffic.pas
   jwauserenv.pas
   jwauxtheme.pas
   jwawbemcli.pas
   jwawinable.pas
   jwawinber.pas
   jwawincon.pas
   jwawincpl.pas
   jwawincred.pas
   jwawindns.pas
   jwawinefs.pas
   jwawinfax.pas
   jwawingdi.pas
   jwawinioctl.pas
   jwawinldap.pas
   jwawinnetwk.pas
   jwawinnls.pas
   jwawinnt.pas
   jwawinperf.pas
   jwawinreg.pas
   jwawinresrc.pas
   jwawinsafer.pas
   jwawinsock.pas
   jwawinsock2.pas
   jwawinsvc.pas
   jwawintype.pas
   jwawinver.pas
   jwawinwlx.pas
   jwawmistr.pas
   jwawownt16.pas
   jwawownt32.pas
   jwawpapi.pas
   jwawpapimsg.pas
   jwawpcrsmsg.pas
   jwawpftpmsg.pas
   jwawppstmsg.pas
   jwawpspihlp.pas
   jwawptypes.pas
   jwawpwizmsg.pas
   jwaws2atm.pas
   jwaws2bth.pas
   jwaws2dnet.pas
   jwaws2spi.pas
   jwaws2tcpip.pas
   jwawshisotp.pas
   jwawsipx.pas
   jwawsnetbs.pas
   jwawsnwlink.pas
   jwawsrm.pas
   jwawsvns.pas
   jwawtsapi32.pas
   jwazmouse.pas
   Makefile.fpc
   mmsystem.pp
   ole2.pp
   shellapi.pp
   shfolder.pp
   shlobj.pp
   winver.pp

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
{******************************************************************************}
{                                                                              }
{ Lan Manager DFS API interface Unit for Object Pascal                         }
{                                                                              }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
{ Corporation. All Rights Reserved.                                            }
{                                                                              }
{ The original file is: lmdfs.h, released November 2001. The original Pascal   }
{ code is: LmDfs.pas, released Februari 2002. The initial developer of the     }
{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
{                                                                              }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
{ Marcel van Brakel. All Rights Reserved.                                      }
{                                                                              }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
{                                                                              }
{ You may retrieve the latest version of this file at the Project JEDI         }
{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
{                                                                              }
{ 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 }
{                                                                              }
{******************************************************************************}


unit JwaLmDFS;

{$WEAKPACKAGEUNIT}

{$HPPEMIT ''}
{$HPPEMIT '#include "lmdfs.h"'}
{$HPPEMIT ''}

{$I jediapilib.inc}

interface

uses
  JwaLmCons, JwaWinType;

//
// DFS Volume state
//

const
  DFS_VOLUME_STATES             = $F;
  {$EXTERNALSYM DFS_VOLUME_STATES}

  DFS_VOLUME_STATE_OK           = 1;
  {$EXTERNALSYM DFS_VOLUME_STATE_OK}
  DFS_VOLUME_STATE_INCONSISTENT = 2;
  {$EXTERNALSYM DFS_VOLUME_STATE_INCONSISTENT}
  DFS_VOLUME_STATE_OFFLINE      = 3;
  {$EXTERNALSYM DFS_VOLUME_STATE_OFFLINE}
  DFS_VOLUME_STATE_ONLINE       = 4;
  {$EXTERNALSYM DFS_VOLUME_STATE_ONLINE}

//
// These are valid for setting the volume state on the root
// These are available to force a resynchronize on the root
// volume or to put it in a standby mode.
//

  DFS_VOLUME_STATE_RESYNCHRONIZE = $10;
  {$EXTERNALSYM DFS_VOLUME_STATE_RESYNCHRONIZE}
  DFS_VOLUME_STATE_STANDBY       = $20;
  {$EXTERNALSYM DFS_VOLUME_STATE_STANDBY}

//
// These are valid on getting the volume state on the root
// These are available to determine the flavor of DFS
// A few bits are reserved to determine the flavor of the DFS root.
// To get the flavor, and the state with DFS_VOLUME_FLAVORS.
//
// (_state & DFS_VOLUME_FLAVORS) will tell you the flavor of the dfs root.
//
//

  DFS_VOLUME_FLAVORS = $0300;
  {$EXTERNALSYM DFS_VOLUME_FLAVORS}

  DFS_VOLUME_FLAVOR_UNUSED1    = $0000;
  {$EXTERNALSYM DFS_VOLUME_FLAVOR_UNUSED1}
  DFS_VOLUME_FLAVOR_STANDALONE = $0100;
  {$EXTERNALSYM DFS_VOLUME_FLAVOR_STANDALONE}
  DFS_VOLUME_FLAVOR_AD_BLOB    = $0200;
  {$EXTERNALSYM DFS_VOLUME_FLAVOR_AD_BLOB}
  DFS_STORAGE_FLAVOR_UNUSED2   = $0300;
  {$EXTERNALSYM DFS_STORAGE_FLAVOR_UNUSED2}

//
// DFS Storage State
//

  DFS_STORAGE_STATES        = $F;
  {$EXTERNALSYM DFS_STORAGE_STATES}
  DFS_STORAGE_STATE_OFFLINE = 1;
  {$EXTERNALSYM DFS_STORAGE_STATE_OFFLINE}
  DFS_STORAGE_STATE_ONLINE  = 2;
  {$EXTERNALSYM DFS_STORAGE_STATE_ONLINE}
  DFS_STORAGE_STATE_ACTIVE  = 4;
  {$EXTERNALSYM DFS_STORAGE_STATE_ACTIVE}

//
// Level 1:
//

type
  LPDFS_INFO_1 = ^DFS_INFO_1;
  {$EXTERNALSYM LPDFS_INFO_1}
  PDFS_INFO_1 = ^DFS_INFO_1;
  {$EXTERNALSYM PDFS_INFO_1}
  _DFS_INFO_1 = record
    EntryPath: LPWSTR; // Dfs name for the top of this piece of storage
  end;
  {$EXTERNALSYM _DFS_INFO_1}
  DFS_INFO_1 = _DFS_INFO_1;
  {$EXTERNALSYM DFS_INFO_1}
  TDfsInfo1 = DFS_INFO_1;
  PDfsInfo1 = PDFS_INFO_1;

//
// Level 2:
//

  LPDFS_INFO_2 = ^DFS_INFO_2;
  {$EXTERNALSYM LPDFS_INFO_2}
  PDFS_INFO_2 = ^DFS_INFO_2;
  {$EXTERNALSYM PDFS_INFO_2}
  _DFS_INFO_2 = record
    EntryPath: LPWSTR; // Dfs name for the top of this volume
    Comment: LPWSTR; // Comment for this volume
    State: DWORD; // State of this volume, one of DFS_VOLUME_STATE_*
    NumberOfStorages: DWORD; // Number of storages for this volume
  end;
  {$EXTERNALSYM _DFS_INFO_2}
  DFS_INFO_2 = _DFS_INFO_2;
  {$EXTERNALSYM DFS_INFO_2}
  TDfsInfo2 = DFS_INFO_2;
  PDfsInfo2 = PDFS_INFO_2;

  LPDFS_STORAGE_INFO = ^DFS_STORAGE_INFO;
  {$EXTERNALSYM LPDFS_STORAGE_INFO}
  PDFS_STORAGE_INFO = ^DFS_STORAGE_INFO;
  {$EXTERNALSYM PDFS_STORAGE_INFO}
  _DFS_STORAGE_INFO = record
    State: ULONG; // State of this storage, one of DFS_STORAGE_STATE_*
    // possibly OR'd with DFS_STORAGE_STATE_ACTIVE
    ServerName: LPWSTR; // Name of server hosting this storage
    ShareName: LPWSTR; // Name of share hosting this storage
  end;
  {$EXTERNALSYM _DFS_STORAGE_INFO}
  DFS_STORAGE_INFO = _DFS_STORAGE_INFO;
  {$EXTERNALSYM DFS_STORAGE_INFO}
  TDfsStorageInfo = DFS_STORAGE_INFO;
  PDfsStorageInfo = PDFS_STORAGE_INFO;

//
// Level 3:
//

  LPDFS_INFO_3 = ^DFS_INFO_3;
  {$EXTERNALSYM LPDFS_INFO_3}
  PDFS_INFO_3 = ^DFS_INFO_3;
  {$EXTERNALSYM PDFS_INFO_3}
  _DFS_INFO_3 = record
    EntryPath: LPWSTR; // Dfs name for the top of this volume
    Comment: LPWSTR; // Comment for this volume
    State: DWORD; // State of this volume, one of DFS_VOLUME_STATE_*
    NumberOfStorages: DWORD; // Number of storage servers for this volume
    Storage: LPDFS_STORAGE_INFO; // An array (of NumberOfStorages elements) of storage-specific information.
  end;
  {$EXTERNALSYM _DFS_INFO_3}
  DFS_INFO_3 = _DFS_INFO_3;
  {$EXTERNALSYM DFS_INFO_3}
  TDfsInfo3 = DFS_INFO_3;
  PDfsInfo3 = PDFS_INFO_3;

//
// Level 4:
//

  LPDFS_INFO_4 = ^DFS_INFO_4;
  {$EXTERNALSYM LPDFS_INFO_4}
  PDFS_INFO_4 = ^DFS_INFO_4;
  {$EXTERNALSYM PDFS_INFO_4}
  _DFS_INFO_4 = record
    EntryPath: LPWSTR; // Dfs name for the top of this volume
    Comment: LPWSTR; // Comment for this volume
    State: DWORD; // State of this volume, one of DFS_VOLUME_STATE_*
    Timeout: ULONG; // Timeout, in seconds, of this junction point
    Guid: GUID; // Guid of this junction point
    NumberOfStorages: DWORD; // Number of storage servers for this volume
    Storage: LPDFS_STORAGE_INFO; // An array (of NumberOfStorages elements) of storage-specific information.
  end;
  {$EXTERNALSYM _DFS_INFO_4}
  DFS_INFO_4 = _DFS_INFO_4;
  {$EXTERNALSYM DFS_INFO_4}
  TDfsInfo4 = DFS_INFO_4;
  PDfsInfo4 = PDFS_INFO_4;

//
// Level 100:
//

  LPDFS_INFO_100 = ^DFS_INFO_100;
  {$EXTERNALSYM LPDFS_INFO_100}
  PDFS_INFO_100 = ^DFS_INFO_100;
  {$EXTERNALSYM PDFS_INFO_100}
  _DFS_INFO_100 = record
    Comment: LPWSTR; // Comment for this volume or storage
  end;
  {$EXTERNALSYM _DFS_INFO_100}
  DFS_INFO_100 = _DFS_INFO_100;
  {$EXTERNALSYM DFS_INFO_100}
  TDfsInfo100 = DFS_INFO_100;
  PDfsInfo100 = PDFS_INFO_100;

//
// Level 101:
//

  LPDFS_INFO_101 = ^DFS_INFO_101;
  {$EXTERNALSYM LPDFS_INFO_101}
  PDFS_INFO_101 = ^DFS_INFO_101;
  {$EXTERNALSYM PDFS_INFO_101}
  _DFS_INFO_101 = record
    State: DWORD; // State of this storage, one of DFS_STORAGE_STATE_*
    // possibly OR'd with DFS_STORAGE_STATE_ACTIVE
  end;
  {$EXTERNALSYM _DFS_INFO_101}
  DFS_INFO_101 = _DFS_INFO_101;
  {$EXTERNALSYM DFS_INFO_101}
  TDfsInfo101 = DFS_INFO_101;
  PDfsInfo101 = PDFS_INFO_101;

//
// Level 102:
//

  LPDFS_INFO_102 = ^DFS_INFO_102;
  {$EXTERNALSYM LPDFS_INFO_102}
  PDFS_INFO_102 = ^DFS_INFO_102;
  {$EXTERNALSYM PDFS_INFO_102}
  _DFS_INFO_102 = record
    Timeout: ULONG; // Timeout, in seconds, of the junction
  end;
  {$EXTERNALSYM _DFS_INFO_102}
  DFS_INFO_102 = _DFS_INFO_102;
  {$EXTERNALSYM DFS_INFO_102}
  TDfsInfo102 = DFS_INFO_102;
  PDfsInfo102 = PDFS_INFO_102;

//
// Level 200:
//

  LPDFS_INFO_200 = ^DFS_INFO_200;
  {$EXTERNALSYM LPDFS_INFO_200}
  PDFS_INFO_200 = ^DFS_INFO_200;
  {$EXTERNALSYM PDFS_INFO_200}
  _DFS_INFO_200 = record
    FtDfsName: LPWSTR; // FtDfs name
  end;
  {$EXTERNALSYM _DFS_INFO_200}
  DFS_INFO_200 = _DFS_INFO_200;
  {$EXTERNALSYM DFS_INFO_200}
  TDfsInfo200 = DFS_INFO_200;
  PDfsInfo200 = PDFS_INFO_200;

//
// Level 300:
//

  LPDFS_INFO_300 = ^DFS_INFO_300;
  {$EXTERNALSYM LPDFS_INFO_300}
  PDFS_INFO_300 = ^DFS_INFO_300;
  {$EXTERNALSYM PDFS_INFO_300}
  _DFS_INFO_300 = record
    Flags: DWORD;
    DfsName: LPWSTR; // Dfs name
  end;
  {$EXTERNALSYM _DFS_INFO_300}
  DFS_INFO_300 = _DFS_INFO_300;
  {$EXTERNALSYM DFS_INFO_300}
  TDfsInfo300 = DFS_INFO_300;
  PDfsInfo300 = PDFS_INFO_300;

//
// Add a new volume or additional storage for an existing volume at
// DfsEntryPath.
//

function NetDfsAdd(DfsEntryPath, ServerName, ShareName, Comment: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsAdd}

//
// Flags:
//

const
  DFS_ADD_VOLUME     = 1; // Add a new volume to the DFS if not already there
  {$EXTERNALSYM DFS_ADD_VOLUME}
  DFS_RESTORE_VOLUME = 2; // Volume/Replica is being restored - do not verify share etc.
  {$EXTERNALSYM DFS_RESTORE_VOLUME}

//
// Setup/teardown API's for standard and FtDfs roots.
//

function NetDfsAddStdRoot(ServerName, RootShare, Comment: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsAddStdRoot}

function NetDfsRemoveStdRoot(ServerName, RootShare: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsRemoveStdRoot}

function NetDfsAddFtRoot(ServerName, RootShare, FtDfsName, Comment: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsAddFtRoot}

function NetDfsRemoveFtRoot(ServerName, RootShare, FtDfsName: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsRemoveFtRoot}

function NetDfsRemoveFtRootForced(DomainName, ServerName, RootShare, FtDfsName: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsRemoveFtRootForced}

//
// Call to reinitialize the dfsmanager on a machine
//

function NetDfsManagerInitialize(ServerName: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsManagerInitialize}

function NetDfsAddStdRootForced(ServerName, RootShare, Comment, Store: LPWSTR): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsAddStdRootForced}

function NetDfsGetDcAddress(ServerName: LPWSTR; var DcIpAddress: LPWSTR; var IsRoot: BOOLEAN; Timeout: PULONG): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsGetDcAddress}

//
// Flags for NetDfsSetDcAddress()
//

const
  NET_DFS_SETDC_FLAGS   = $00000000;
  {$EXTERNALSYM NET_DFS_SETDC_FLAGS}
  NET_DFS_SETDC_TIMEOUT = $00000001;
  {$EXTERNALSYM NET_DFS_SETDC_TIMEOUT}
  NET_DFS_SETDC_INITPKT = $00000002;
  {$EXTERNALSYM NET_DFS_SETDC_INITPKT}

//
// Structures used for site reporting
//

type
  LPDFS_SITENAME_INFO = ^DFS_SITENAME_INFO;
  {$EXTERNALSYM LPDFS_SITENAME_INFO}
  PDFS_SITENAME_INFO = ^DFS_SITENAME_INFO;
  {$EXTERNALSYM PDFS_SITENAME_INFO}
  DFS_SITENAME_INFO = record
    SiteFlags: ULONG; // Below
    SiteName: LPWSTR;
  end;
  {$EXTERNALSYM DFS_SITENAME_INFO}
  TDfsSiteNameInfo = DFS_SITENAME_INFO;
  PDfsSiteNameInfo = PDFS_SITENAME_INFO;

// SiteFlags

const
  DFS_SITE_PRIMARY = $1; // This site returned by DsGetSiteName()
  {$EXTERNALSYM DFS_SITE_PRIMARY}

type
  LPDFS_SITELIST_INFO = ^DFS_SITELIST_INFO;
  {$EXTERNALSYM LPDFS_SITELIST_INFO}
  PDFS_SITELIST_INFO = ^DFS_SITELIST_INFO;
  {$EXTERNALSYM PDFS_SITELIST_INFO}
  DFS_SITELIST_INFO = record
    cSites: ULONG;
    Site: array [0..0] of DFS_SITENAME_INFO;
  end;
  {$EXTERNALSYM DFS_SITELIST_INFO}
  TDfsSiteListInfo = DFS_SITELIST_INFO;
  PDfsSiteListInfo = PDFS_SITELIST_INFO;

//
// Remove a volume or additional storage for volume from the Dfs at
// DfsEntryPath. When applied to the last storage in a volume, removes
// the volume from the DFS.
//

function NetDfsRemove(DfsEntryPath, ServerName, ShareName: LPWSTR): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsRemove}

//
// Get information about all of the volumes in the Dfs. DfsName is
// the "server" part of the UNC name used to refer to this particular Dfs.
//
// Valid levels are 1-4, 200
//

function NetDfsEnum(DfsName: LPWSTR; Level, PrefMaxLen: DWORD; var Buffer: LPBYTE; EntriesRead, ResumeHandle: LPDWORD): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsEnum}

//
// Get information about the volume or storage.
// If ServerName and ShareName are specified, the information returned
// is specific to that server and share, else the information is specific
// to the volume as a whole.
//
// Valid levels are 1-4, 100
//

function NetDfsGetInfo(DfsEntryPath, ServerName, ShareName: LPWSTR; Level: DWORD; var Buffer: LPBYTE): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsGetInfo}

//
// Set info about the volume or storage.
// If ServerName and ShareName are specified, the information set is
// specific to that server and share, else the information is specific
// to the volume as a whole.
//
// Valid levels are 100, 101 and 102
//

function NetDfsSetInfo(DfsEntryPath, ServerName, ShareName: LPWSTR; Level: DWORD; Buffer: LPBYTE): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsSetInfo}

//
// Get client's cached information about the volume or storage.
// If ServerName and ShareName are specified, the information returned
// is specific to that server and share, else the information is specific
// to the volume as a whole.
//
// Valid levels are 1-4
//

function NetDfsGetClientInfo(DfsEntryPath, ServerName, ShareName: LPWSTR; Level: DWORD; var Buffer: LPBYTE): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsGetClientInfo}

//
// Set client's cached info about the volume or storage.
// If ServerName and ShareName are specified, the information set is
// specific to that server and share, else the information is specific
// to the volume as a whole.
//
// Valid levels are 101 and 102.
//

function NetDfsSetClientInfo(DfsEntryPath, ServerName, ShareName: LPWSTR; Level: DWORD; Buffer: LPBYTE): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsSetClientInfo}

//
// Move a DFS volume and all subordinate volumes from one place in the
// DFS to another place in the DFS.
//

function NetDfsMove(DfsEntryPath: LPWSTR; DfsNewEntryPath: LPWSTR): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsMove}

function NetDfsRename(Path: LPWSTR; NewPath: LPWSTR): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetDfsRename}

implementation

{$IFDEF DYNAMIC_LINK}

var
  _NetDfsAdd: Pointer;

function NetDfsAdd;
begin
  GetProcedureAddress(_NetDfsAdd, netapi32, 'NetDfsAdd');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsAdd]
  end;
end;

var
  _NetDfsAddStdRoot: Pointer;

function NetDfsAddStdRoot;
begin
  GetProcedureAddress(_NetDfsAddStdRoot, netapi32, 'NetDfsAddStdRoot');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsAddStdRoot]
  end;
end;

var
  _NetDfsRemoveStdRoot: Pointer;

function NetDfsRemoveStdRoot;
begin
  GetProcedureAddress(_NetDfsRemoveStdRoot, netapi32, 'NetDfsRemoveStdRoot');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsRemoveStdRoot]
  end;
end;

var
  _NetDfsAddFtRoot: Pointer;

function NetDfsAddFtRoot;
begin
  GetProcedureAddress(_NetDfsAddFtRoot, netapi32, 'NetDfsAddFtRoot');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsAddFtRoot]
  end;
end;

var
  _NetDfsRemoveFtRoot: Pointer;

function NetDfsRemoveFtRoot;
begin
  GetProcedureAddress(_NetDfsRemoveFtRoot, netapi32, 'NetDfsRemoveFtRoot');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsRemoveFtRoot]
  end;
end;

var
  _NetDfsRemoveFtRootForced: Pointer;

function NetDfsRemoveFtRootForced;
begin
  GetProcedureAddress(_NetDfsRemoveFtRootForced, netapi32, 'NetDfsRemoveFtRootForced');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsRemoveFtRootForced]
  end;
end;

var
  _NetDfsManagerInitialize: Pointer;

function NetDfsManagerInitialize;
begin
  GetProcedureAddress(_NetDfsManagerInitialize, netapi32, 'NetDfsManagerInitialize');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsManagerInitialize]
  end;
end;

var
  _NetDfsAddStdRootForced: Pointer;

function NetDfsAddStdRootForced;
begin
  GetProcedureAddress(_NetDfsAddStdRootForced, netapi32, 'NetDfsAddStdRootForced');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsAddStdRootForced]
  end;
end;

var
  _NetDfsGetDcAddress: Pointer;

function NetDfsGetDcAddress;
begin
  GetProcedureAddress(_NetDfsGetDcAddress, netapi32, 'NetDfsGetDcAddress');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsGetDcAddress]
  end;
end;

var
  _NetDfsRemove: Pointer;

function NetDfsRemove;
begin
  GetProcedureAddress(_NetDfsRemove, netapi32, 'NetDfsRemove');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsRemove]
  end;
end;

var
  _NetDfsEnum: Pointer;

function NetDfsEnum;
begin
  GetProcedureAddress(_NetDfsEnum, netapi32, 'NetDfsEnum');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsEnum]
  end;
end;

var
  _NetDfsGetInfo: Pointer;

function NetDfsGetInfo;
begin
  GetProcedureAddress(_NetDfsGetInfo, netapi32, 'NetDfsGetInfo');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsGetInfo]
  end;
end;

var
  _NetDfsSetInfo: Pointer;

function NetDfsSetInfo;
begin
  GetProcedureAddress(_NetDfsSetInfo, netapi32, 'NetDfsSetInfo');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsSetInfo]
  end;
end;

var
  _NetDfsGetClientInfo: Pointer;

function NetDfsGetClientInfo;
begin
  GetProcedureAddress(_NetDfsGetClientInfo, netapi32, 'NetDfsGetClientInfo');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsGetClientInfo]
  end;
end;

var
  _NetDfsSetClientInfo: Pointer;

function NetDfsSetClientInfo;
begin
  GetProcedureAddress(_NetDfsSetClientInfo, netapi32, 'NetDfsSetClientInfo');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsSetClientInfo]
  end;
end;

var
  _NetDfsMove: Pointer;

function NetDfsMove;
begin
  GetProcedureAddress(_NetDfsMove, netapi32, 'NetDfsMove');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsMove]
  end;
end;

var
  _NetDfsRename: Pointer;

function NetDfsRename;
begin
  GetProcedureAddress(_NetDfsRename, netapi32, 'NetDfsRename');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetDfsRename]
  end;
end;

{$ELSE}

function NetDfsAdd; external netapi32 name 'NetDfsAdd';
function NetDfsAddStdRoot; external netapi32 name 'NetDfsAddStdRoot';
function NetDfsRemoveStdRoot; external netapi32 name 'NetDfsRemoveStdRoot';
function NetDfsAddFtRoot; external netapi32 name 'NetDfsAddFtRoot';
function NetDfsRemoveFtRoot; external netapi32 name 'NetDfsRemoveFtRoot';
function NetDfsRemoveFtRootForced; external netapi32 name 'NetDfsRemoveFtRootForced';
function NetDfsManagerInitialize; external netapi32 name 'NetDfsManagerInitialize';
function NetDfsAddStdRootForced; external netapi32 name 'NetDfsAddStdRootForced';
function NetDfsGetDcAddress; external netapi32 name 'NetDfsGetDcAddress';
function NetDfsRemove; external netapi32 name 'NetDfsRemove';
function NetDfsEnum; external netapi32 name 'NetDfsEnum';
function NetDfsGetInfo; external netapi32 name 'NetDfsGetInfo';
function NetDfsSetInfo; external netapi32 name 'NetDfsSetInfo';
function NetDfsGetClientInfo; external netapi32 name 'NetDfsGetClientInfo';
function NetDfsSetClientInfo; external netapi32 name 'NetDfsSetClientInfo';
function NetDfsMove; external netapi32 name 'NetDfsMove';
function NetDfsRename; external netapi32 name 'NetDfsRename';

{$ENDIF DYNAMIC_LINK}

end.