Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

621 lines
17 KiB

  1. /*++
  2. Copyright (c) 1988-1999 Microsoft Corporation
  3. Module Name:
  4. cmdproto.h
  5. Abstract:
  6. Forward procedure prototypes
  7. --*/
  8. //
  9. // Define structures names that are forward referenced in prototypes.
  10. //
  11. struct batdata;
  12. struct cmdnode;
  13. typedef struct cpyinfo CPYINFO, *PCPYINFO;
  14. struct detnode;
  15. struct envdata;
  16. struct FEA2List;
  17. struct fornode;
  18. struct ifnode;
  19. struct node;
  20. struct relem;
  21. //
  22. // Define routine types.
  23. //
  24. typedef
  25. int
  26. (*PLOOP_THROUGH_ARGS_ROUTINE) (
  27. TCHAR *String
  28. );
  29. typedef
  30. struct node *
  31. (*PPARSE_ROUTINE) (
  32. void
  33. );
  34. //
  35. // Define function prototypes.
  36. //
  37. void CMDexit(int rc);
  38. VOID
  39. InitializeDbcsLeadCharTable(
  40. );
  41. TCHAR * mystrchr(register TCHAR const *string, TCHAR c);
  42. TCHAR * mystrrchr(register TCHAR const *string, TCHAR c);
  43. size_t mystrcspn(TCHAR const *str1, TCHAR const *str2);
  44. #if CMD_DEBUG_ENABLE
  45. void Deb(ULONG, ULONG, CHAR *, ...);
  46. #endif
  47. /* Do Not Delete The Following Line - Or Put Anything After It */
  48. /* Global Declarations Follow */
  49. int BatProc(struct cmdnode *,TCHAR *,int );
  50. int BatLoop(struct batdata *,struct cmdnode *);
  51. int SetBat(struct cmdnode *,TCHAR *);
  52. void DisplayStatement(struct node *,int );
  53. void DisplayOperator(struct node *,TCHAR *);
  54. void DisplayRedirection(struct node *);
  55. CRTHANDLE OpenPosBat(struct batdata *);
  56. int eEcho(struct cmdnode *);
  57. int eKeys(struct cmdnode *);
  58. void FvarRestore(void );
  59. int eFor(struct fornode *);
  60. int FWork(struct node *,BOOL);
  61. int SubFor(struct node *,BOOL);
  62. int SFWork(struct node *,TCHAR * *,int ,BOOL);
  63. int ForFree(int );
  64. int eGoto(struct cmdnode *);
  65. int eIf(struct ifnode *);
  66. int eCmdExtVer(struct cmdnode *);
  67. int eErrorLevel(struct cmdnode *);
  68. int eDefined(struct cmdnode *);
  69. int eExist(struct cmdnode *);
  70. int eNot(struct cmdnode *);
  71. int eStrCmp(struct cmdnode *);
  72. int eGenCmp(struct cmdnode *);
  73. int ePause(struct cmdnode *);
  74. int eShift(struct cmdnode *);
  75. int eSetlocal(struct cmdnode *);
  76. int eEndlocal(struct cmdnode *);
  77. void EndAllLocals(struct batdata *);
  78. void ElclWork(struct batdata *);
  79. int eCall(struct cmdnode *);
  80. int eExtproc(struct cmdnode *);
  81. int Dir(TCHAR *);
  82. int DirSwitches(TCHAR *, int, int *, int *, int *, int *);
  83. int DirDevCheck(TCHAR *,int );
  84. void DirPrintPerFileInfo(PWIN32_FIND_DATA, int, TCHAR *, int *);
  85. long DiskFreeSpace(TCHAR );
  86. void DirError(unsigned int );
  87. unsigned SetLastRetCodeIfError(unsigned);
  88. int ePath(struct cmdnode *);
  89. int PathWork(struct cmdnode *,int );
  90. int ePrompt(struct cmdnode *);
  91. int eSet(struct cmdnode *);
  92. int SetWork(struct cmdnode *);
  93. int DisplayEnvVariable(TCHAR *);
  94. const TCHAR *
  95. MyGetEnvVarPtr(TCHAR *varname);
  96. int DisplayEnv(void );
  97. int SetEnvVar(TCHAR *,TCHAR *,struct envdata *);
  98. TCHAR *DeleteEnvVar(struct envdata *,TCHAR *,TCHAR *);
  99. TCHAR *FindEnvVar(TCHAR *,TCHAR *);
  100. int AddEnvVar(struct envdata *,TCHAR *,TCHAR *,TCHAR *,int );
  101. PTCHAR GetEnvVar(PTCHAR);
  102. struct envdata *CopyEnv(void );
  103. void ResetEnv(struct envdata *);
  104. int MoveEnv(TCHAR *, TCHAR *, ULONG );
  105. int eAppend(struct cmdnode *);
  106. int ExtCom(struct cmdnode *);
  107. int ECWork(struct cmdnode *,unsigned int ,unsigned int );
  108. int ExecPgm(struct cmdnode *,TCHAR *,unsigned int ,unsigned int, TCHAR *, TCHAR *, TCHAR * );
  109. int SearchForExecutable(struct cmdnode *,TCHAR *);
  110. int DoFind(TCHAR *,int ,TCHAR *, BOOL);
  111. void ExecError(TCHAR *);
  112. int eAssoc(struct cmdnode *);
  113. int AssocWork(struct cmdnode *);
  114. int DisplayAssoc(HKEY, TCHAR *);
  115. int SetAssoc(HKEY, TCHAR *, TCHAR *);
  116. int eFType(struct cmdnode *);
  117. int FTypeWork(struct cmdnode *);
  118. int DisplayFType(HKEY, TCHAR *);
  119. int SetFType(HKEY, TCHAR *, TCHAR *);
  120. // CFile.c
  121. void RestoreSavedDirectory( void );
  122. BOOL GetPromptOkay(const TCHAR *,BOOL *);
  123. int eCopy(struct cmdnode *);
  124. int eDelete(struct cmdnode *);
  125. int DelWork(TCHAR *);
  126. int eMove(struct cmdnode *);
  127. int MoveParse(struct cmdnode *,BOOL *,TCHAR *,TCHAR *,PCPYINFO*, unsigned int *,unsigned, unsigned);
  128. int Move(TCHAR *,TCHAR *,BOOL, PCPYINFO, unsigned int);
  129. int eRename(struct cmdnode *);
  130. int RenWork(struct cmdnode *);
  131. // int eChcp(struct cmdnode *);
  132. int eTitle(struct cmdnode *);
  133. int eStart(struct cmdnode *);
  134. int eDirectory(struct cmdnode *);
  135. int eType(struct cmdnode *);
  136. int TyWork(TCHAR *);
  137. int eVersion(struct cmdnode *);
  138. int eVolume(struct cmdnode *);
  139. int VolWork(TCHAR *);
  140. BOOL Init(TCHAR *InitialCmds[]);
  141. void GetRegistryValues(TCHAR *InitialCmds[]);
  142. void CheckSwitches(TCHAR *InitialCmds[], TCHAR *);
  143. void SetUpEnvironment(void);
  144. void InitLex(unsigned int ,INT_PTR );
  145. unsigned int Lex(TCHAR *,unsigned int );
  146. int TextCheck(TCHAR *,unsigned int *);
  147. TCHAR GetByte(void );
  148. void UnGetByte(void );
  149. void FillBuf(void );
  150. int LexCopy(TCHAR *,TCHAR *,int );
  151. void PrintPrompt(void );
  152. int IsData(void );
  153. void SubVar(void );
  154. TCHAR *MSEnvVar(jmp_buf *, TCHAR *,int *, const TCHAR);
  155. TCHAR *MSCmdVar(jmp_buf *, TCHAR *,int *, TCHAR *, TCHAR *subs[]);
  156. int Dispatch(int ,struct node *);
  157. int SetRedir(struct node *,int );
  158. int AddRedir(struct cmdnode *,struct cmdnode *);
  159. void ResetRedir(void );
  160. int FindFixAndRun(struct cmdnode *);
  161. int FindAndFix(struct cmdnode *,TCHAR *);
  162. void FreeBigBuf(int );
  163. void FreeStack(ULONG );
  164. void FreeStr( IN PTCHAR pbFree );
  165. PVOID GetBigBuf(ULONG, ULONG, unsigned int *, int);
  166. struct node *mknode(void );
  167. void *mkstr(int );
  168. TCHAR *dupstr( TCHAR *String );
  169. void *gmkstr(int );
  170. void *resize(void*, unsigned int );
  171. int eDetach(struct detnode *);
  172. int eComSep(struct node *);
  173. int eOr(struct node *);
  174. int eAnd(struct node *);
  175. int ePipe(struct node *);
  176. void PipeErr(void );
  177. int PipeWait(void );
  178. void BreakPipes(void );
  179. int eParen(struct node *);
  180. int eCls(struct cmdnode *);
  181. int eExit(struct cmdnode *);
  182. int eVerify(struct cmdnode *);
  183. int VerifyWork(struct cmdnode *);
  184. BOOLEAN GetSetVerMode(BYTE);
  185. struct node *Parser(unsigned int ,INT_PTR ,int );
  186. struct node *ParseStatement(int);
  187. struct node *ParseFor(void );
  188. struct node *ParseIf(void );
  189. struct node *ParseDetach(void );
  190. struct node *ParseRem(void );
  191. struct node *ParseS0(void );
  192. struct node *ParseS1(void );
  193. struct node *ParseS2(void );
  194. struct node *ParseS3(void );
  195. struct node *ParseS4(void );
  196. struct node *ParseS5(void );
  197. struct cmdnode *ParseCond(unsigned int );
  198. void ParseArgEqArg(struct cmdnode *);
  199. struct node *ParseCmd(void );
  200. int ParseRedir(struct relem * *);
  201. struct node *
  202. BinaryOperator (
  203. TCHAR *,
  204. int,
  205. PPARSE_ROUTINE,
  206. PPARSE_ROUTINE
  207. );
  208. TCHAR *BuildArgList(void );
  209. void GetCheckStr(TCHAR *);
  210. TCHAR *GeTexTok(unsigned int );
  211. unsigned int GeToken(unsigned int );
  212. struct cmdnode *LoadNodeTC(int );
  213. void PError(void );
  214. void PSError(void );
  215. void SpaceCat(TCHAR *,TCHAR *,TCHAR *);
  216. int eMkdir(struct cmdnode *);
  217. int MdWork(TCHAR *);
  218. int eChdir(struct cmdnode *);
  219. int ChdirWork(TCHAR *);
  220. int eRmdir(struct cmdnode *);
  221. int RdWork(TCHAR *);
  222. void
  223. parse_args(
  224. PTCHAR args,
  225. PCPYINFO source,
  226. PCPYINFO dest);
  227. void handle_switch(
  228. TCHAR *tas,
  229. PCPYINFO source,
  230. PCPYINFO dest,
  231. int parse_state,
  232. int *current_copy_mode,
  233. PBOOL ShortNameSwitch,
  234. PBOOL RestartableSwitch,
  235. PBOOL PromptOnOverwrite
  236. );
  237. int
  238. found_file(
  239. PTCHAR token,
  240. int parse_state,
  241. PCPYINFO *source,
  242. PCPYINFO *dest,
  243. int *num_sources,
  244. int *all_sources_wild,
  245. int mode);
  246. void set_mode(int ,int ,int ,PCPYINFO);
  247. PCPYINFO add_filespec_to_struct(PCPYINFO,TCHAR *,int );
  248. void Abort( void );
  249. void ExitAbort( ULONG );
  250. void SigCleanUp(void );
  251. TCHAR *TokStr(TCHAR *,TCHAR *,unsigned int );
  252. int FullPath(TCHAR *,TCHAR *, ULONG);
  253. int FileIsConsole( CRTHANDLE );
  254. int FileIsDevice( CRTHANDLE );
  255. int FileIsPipe( CRTHANDLE );
  256. int FileIsRemote( LPTSTR );
  257. int GetDir(TCHAR *,TCHAR );
  258. typedef enum {
  259. CD_SET_DRIVE_DIRECTORY,
  260. CD_SET_DIRECTORY,
  261. CD_SET_ENV,
  262. } CHANGE_OP;
  263. int ChangeDirectory( TCHAR *newdir, CHANGE_OP op );
  264. int ChangeDir(TCHAR *);
  265. int ChangeDir2(TCHAR *, BOOL);
  266. BOOL FixupPath(TCHAR *, BOOL);
  267. int ePushDir( struct cmdnode *);
  268. int ePopDir( struct cmdnode *);
  269. int GetDirStackDepth(void);
  270. int ePriv( struct cmdnode *);
  271. int
  272. LoopThroughArgs (
  273. TCHAR *,
  274. PLOOP_THROUGH_ARGS_ROUTINE,
  275. int
  276. );
  277. STATUS BuildFSFromPatterns ( PDRP, BOOLEAN, BOOLEAN, PFS * );
  278. STATUS ParseDirParms( PTCHAR, PDRP );
  279. BOOL ScanFSpec(PCPYINFO);
  280. PCPYINFO SetFsSetSaveDir(TCHAR *);
  281. int exists(TCHAR *);
  282. int exists_ex(TCHAR *, BOOL); /*@@4*/
  283. void FixPChar(TCHAR *, TCHAR);
  284. void FlushKB(void );
  285. int DriveIsFixed(TCHAR *);
  286. int Start(TCHAR *);
  287. int Chcp(TCHAR *);
  288. void Q_KbdVioCp(void );
  289. void S_KbdVioCp(void );
  290. int OnOffCheck(TCHAR *,int );
  291. void ChangeDrive(int );
  292. int PutStdOut(unsigned int MsgNum, unsigned int NumOfArgs, ...);
  293. int PutStdErr(unsigned int MsgNum, unsigned int NumOfArgs, ...);
  294. void BeginHelpPause( void );
  295. void EndHelpPause( void );
  296. int PutMsg(unsigned int MsgNum, CRTHANDLE Handle, unsigned int NumOfArgs, va_list *arglist);
  297. PTCHAR argstr1(TCHAR *,ULONG_PTR);
  298. CRTHANDLE Copen_Work(TCHAR *,unsigned int ,unsigned int );
  299. CRTHANDLE Copen_Work2(TCHAR *,unsigned int ,unsigned int, unsigned);
  300. CRTHANDLE Copen(TCHAR *,unsigned int );
  301. CRTHANDLE Copen2(TCHAR *, unsigned int, unsigned);
  302. CRTHANDLE Copen_Copy2(TCHAR *,unsigned int);
  303. CRTHANDLE Copen_Copy3(TCHAR *);
  304. unsigned long InSetList( CRTHANDLE );
  305. CRTHANDLE Cdup( CRTHANDLE );
  306. CRTHANDLE Cdup2( CRTHANDLE , CRTHANDLE );
  307. int Cclose( CRTHANDLE );
  308. void SetList( CRTHANDLE );
  309. int ( * GetFuncPtr(int ))(struct cmdnode *);
  310. int FindCmd(
  311. int entries,
  312. const TCHAR *sname,
  313. TCHAR *sflags);
  314. int KillProc(HANDLE, int );
  315. int WaitProc(HANDLE);
  316. void ParseLabel(TCHAR *,TCHAR buf[],ULONG, BOOLEAN );
  317. PTCHAR EatWS(TCHAR *,TCHAR *);
  318. int IsValidDrv(TCHAR );
  319. int IsDriveLocked(TCHAR );
  320. void PrtErr(unsigned int );
  321. PTCHAR GetMsg(unsigned MsgNum, ...);
  322. TCHAR *dayptr(unsigned int );
  323. int copy(TCHAR *);
  324. int get_full_name(PCPYINFO, TCHAR *);
  325. int
  326. do_normal_copy(
  327. PCPYINFO source,
  328. PCPYINFO dest);
  329. int do_combine_copy(PCPYINFO,PCPYINFO);
  330. PCPYINFO
  331. NewCpyInfo(
  332. void
  333. );
  334. void close_dest(PCPYINFO, PCPYINFO, TCHAR*, CRTHANDLE, LPFILETIME );
  335. int get_dest_name(PCPYINFO ,PCPYINFO ,TCHAR *, unsigned, BOOL);
  336. unsigned
  337. wildcard_rename(
  338. TCHAR *OutputBuffer,
  339. const TCHAR *dest,
  340. const TCHAR *source,
  341. ULONG sizbufr
  342. );
  343. void get_clean_filename(TCHAR *,TCHAR *,TCHAR *);
  344. BOOL MyWriteFile(CRTHANDLE, CONST VOID *, DWORD, LPDWORD);
  345. int same_file(TCHAR *,TCHAR *);
  346. void copy_error(unsigned int ,int );
  347. BOOL DestinationNeedsCtrlZ( PCPYINFO );
  348. int eDate(struct cmdnode *);
  349. int eTime(struct cmdnode *);
  350. int PrintDate(struct tm *, int, TCHAR *, int );
  351. int PrintTime(struct tm *, int, TCHAR *, int );
  352. int GetVerSetDateTime(TCHAR *,int );
  353. int VerifyDateString(LPSYSTEMTIME, TCHAR *,TCHAR *);
  354. int VerifyTimeString(LPSYSTEMTIME, TCHAR *,TCHAR *);
  355. BOOLEAN ffirst(PTCHAR, ULONG, PWIN32_FIND_DATA, PHANDLE);
  356. BOOLEAN fnext(PWIN32_FIND_DATA, ULONG, HANDLE);
  357. int f_how_many (PTCHAR, ULONG);
  358. int hstoi(TCHAR *);
  359. TCHAR *lastc(TCHAR *);
  360. TCHAR *penulc(TCHAR *);
  361. TCHAR *prevc(TCHAR *,TCHAR *);
  362. void InitLocale( VOID );
  363. unsigned WindowSwitch(void );
  364. int findclose(HANDLE);
  365. int isFATdrive(TCHAR *);
  366. int CmdPutChars( PTCHAR String, int Length );
  367. int CmdPutString( PTCHAR String );
  368. int cmd_printf(TCHAR *fmt,...);
  369. TCHAR *StripQuotes( TCHAR * );
  370. TCHAR *SkipWhiteSpace( TCHAR * );
  371. ULONG GetEnvCb( TCHAR *);
  372. int cmdfound; /* command found from parser */
  373. int cpyfirst; /* first time for DOSQFILEMODE */
  374. int cpydflag; /* flag for DOSQFILEMODE fr pars */
  375. int cpydest; /* flag for not disp bad dev msg twice */
  376. int cdevfail; /* flag for dev failed ScanFSpec */
  377. int first_file; /* @@5@J1 1st file flag from copy cmd */
  378. int first_fflag; /* @@5@J3 1st file flag from copy EAs */
  379. #ifdef UNICODE
  380. BOOLEAN fOutputUnicode; /* Unicode/Ansi output */
  381. #endif // UNICODE
  382. VOID
  383. ConverttmToFILETIME (
  384. struct tm *Time,
  385. LPFILETIME FileTime
  386. );
  387. VOID
  388. ConvertFILETIMETotm (
  389. LPFILETIME FileTime,
  390. struct tm *Time
  391. );
  392. STATUS DisplayBare ( PSCREEN, ULONG, PTCHAR, PWIN32_FIND_DATA );
  393. VOID SetDotForm ( PTCHAR, ULONG );
  394. STATUS DisplayDotForm ( PSCREEN, ULONG, PTCHAR, PWIN32_FIND_DATA );
  395. STATUS DisplaySpacedForm( PSCREEN, ULONG, PTCHAR, PWIN32_FIND_DATA );
  396. STATUS DisplayOldRest( PSCREEN, ULONG, ULONG, PWIN32_FIND_DATA );
  397. STATUS DisplayNewRest( PSCREEN, ULONG, ULONG, PWIN32_FIND_DATA );
  398. STATUS DisplayTimeDate( PSCREEN, ULONG, ULONG, PWIN32_FIND_DATA );
  399. STATUS DisplayWide ( PSCREEN, ULONG, PWIN32_FIND_DATA );
  400. STATUS DisplayFileSizes( PSCREEN, PLARGE_INTEGER, ULONG, ULONG );
  401. STATUS DisplayTotals( PSCREEN, ULONG, PLARGE_INTEGER, ULONG );
  402. STATUS DisplayDiskFreeSpace( PSCREEN, PTCHAR, ULONG, ULONG );
  403. STATUS DisplayVolInfo( PSCREEN, PTCHAR );
  404. USHORT GetMaxCbFileSize( PFS );
  405. STATUS FormatFileSize( DWORD, PLARGE_INTEGER, DWORD, PTCHAR );
  406. STATUS OpenScreen( PSCREEN * );
  407. STATUS WriteString( PSCREEN, PTCHAR );
  408. STATUS WriteMsgString( PSCREEN, ULONG , ULONG , ... );
  409. STATUS WriteFmtString(PSCREEN, PTCHAR, PVOID );
  410. STATUS WriteEol( PSCREEN );
  411. STATUS WriteTab( PSCREEN );
  412. STATUS WriteFlush( PSCREEN );
  413. STATUS WriteFlushAndEol( PSCREEN );
  414. VOID CheckPause( PSCREEN );
  415. VOID SetTab( PSCREEN, ULONG );
  416. VOID FillToCol ( PSCREEN, ULONG );
  417. ULONG PromptUser ( PTCHAR, ULONG, ULONG );
  418. void CheckCtrlC();
  419. BOOLEAN TokStrAndCheckHelp(struct cmdnode *, ULONG );
  420. BOOLEAN CheckHelpSwitch( ULONG, PTCHAR );
  421. BOOLEAN TokBufCheckHelp(PTCHAR , ULONG );
  422. PTCHAR GetTitle(struct cmdnode * );
  423. VOID SetConTitle(PTCHAR );
  424. VOID ResetConTitle( PTCHAR );
  425. void ResetConsoleMode( void );
  426. void mytcsnset ( PTCHAR string, TCHAR val, int count);
  427. BOOL ReadBufFromInput (HANDLE h, TCHAR*pBuf, int cch, int*pcch);
  428. BOOL ReadBufFromConsole (HANDLE h, TCHAR*pBuf, int cch, int*pcch);
  429. BOOL ReadBufFromFile (HANDLE h, TCHAR*pBuf, int cch, int*pcch);
  430. #if defined(FE_SB)
  431. BOOLEAN IsDBCSCodePage();
  432. BOOL IsFullWidth(TCHAR wch);
  433. int SizeOfHalfWidthString(TCHAR *pwch);
  434. #endif
  435. #ifndef WIN95_CMD
  436. typedef
  437. BOOL
  438. (WINAPI *LPCOPYFILEEX_ROUTINE)(
  439. LPCWSTR lpExistingFileName,
  440. LPCWSTR lpNewFileName,
  441. LPPROGRESS_ROUTINE lpProgressRoutine OPTIONAL,
  442. LPVOID lpData OPTIONAL,
  443. LPBOOL pbCancel OPTIONAL,
  444. DWORD dwCopyFlags
  445. );
  446. LPCOPYFILEEX_ROUTINE lpCopyFileExW;
  447. typedef
  448. VOID
  449. (WINAPI *LPSETCONSOLEINPUTEXENAME_ROUTINE)(
  450. LPCWSTR lpExeName
  451. );
  452. LPSETCONSOLEINPUTEXENAME_ROUTINE lpSetConsoleInputExeName;
  453. typedef
  454. BOOL
  455. (WINAPI *LPISDEBUGGERPRESENT_ROUTINE)( VOID );
  456. LPISDEBUGGERPRESENT_ROUTINE lpIsDebuggerPresent;
  457. #endif
  458. int SetColor(WORD attr);
  459. void DoCompleteInitialize( VOID );
  460. int DoComplete(TCHAR *buffer,int len,int maxlen,int bForward,int bPathCompletion,int bTouched );
  461. #ifdef WIN95_CMD
  462. BOOL Win95ReadConsoleA(HANDLE hIn,LPSTR pBuf,DWORD cch,LPDWORD pcch,LPVOID lpReserved);
  463. #undef ReadConsole
  464. #define ReadConsole Win95ReadConsoleA
  465. #endif
  466. // TREE.C
  467. STATUS
  468. AppendPath(
  469. OUT PTCHAR Buffer,
  470. IN ULONG BufferCount,
  471. IN PTCHAR Prefix,
  472. IN PTCHAR Suffix
  473. );
  474. STATUS
  475. WalkTree(
  476. IN PFS FileSpec,
  477. IN PSCREEN pscr,
  478. IN ULONG AttribMask,
  479. IN ULONG AttribValues,
  480. IN BOOL Recurse,
  481. IN PVOID Data OPTIONAL,
  482. IN VOID (*ErrorFunction) (STATUS, PTCHAR, PVOID) OPTIONAL,
  483. IN STATUS (*PreScanFunction) (PFS, PSCREEN, PVOID) OPTIONAL,
  484. IN STATUS (*ScanFunction) (PFS, PFF, PSCREEN, PVOID) OPTIONAL,
  485. IN STATUS (*PostScanFunction) (PFS, PSCREEN, PVOID) OPTIONAL
  486. );
  487. STATUS
  488. ExpandAndApplyToFS(
  489. IN PFS FileSpec,
  490. IN PSCREEN pscr,
  491. IN ULONG AttribMask,
  492. IN ULONG AttribValues,
  493. IN PVOID Data OPTIONAL,
  494. IN VOID (*ErrorFunction) (STATUS, PTCHAR, PVOID) OPTIONAL,
  495. IN STATUS (*PreScanFunction) (PFS, PSCREEN, PVOID) OPTIONAL,
  496. IN STATUS (*ScanFunction) (PFS, PFF, PSCREEN, PVOID) OPTIONAL,
  497. IN STATUS (*PostScanFunction) (PFS, PSCREEN, PVOID) OPTIONAL
  498. );
  499. __inline
  500. BOOL IsDrive( LPCTSTR Path )
  501. {
  502. return Path[0] != TEXT('\0') && Path[1] == TEXT(':') && Path[2] == TEXT('\0');
  503. }
  504. __inline
  505. VOID WINAPI
  506. CmdSetThreadUILanguage( WORD wReserved )
  507. {
  508. static LANGID (WINAPI *pSetThreadUILanguage)( ) = NULL;
  509. if (pSetThreadUILanguage == NULL) {
  510. // This check has to put in because hKernel32 may not have been
  511. // correctly set before a call to CmdSetThreadUILanguage is made
  512. if (hKernel32 == INVALID_HANDLE_VALUE) {
  513. hKernel32 = GetModuleHandle( TEXT("KERNEL32.DLL") );
  514. }
  515. pSetThreadUILanguage = (PVOID) GetProcAddress( hKernel32, "SetThreadUILanguage" );
  516. }
  517. if (pSetThreadUILanguage == NULL) {
  518. SetThreadLocale( MAKELCID( MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ), SORT_DEFAULT ));
  519. } else {
  520. (*pSetThreadUILanguage)( 0 );
  521. }
  522. }
  523. // DIR.C
  524. STATUS
  525. SetAttribs(
  526. IN PTCHAR pszTok,
  527. OUT PDRP pdrp
  528. );
  529. // CINIT.C
  530. VOID
  531. GetVersionString(
  532. IN OUT PTCHAR VersionString,
  533. IN ULONG Length
  534. );
  535. // cmd.c
  536. void DumpBytes( PBYTE Bytes, ULONG Length );
  537. void DumpTchars( PTCHAR Chars, ULONG Length );