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.

769 lines
18 KiB

  1. /* demfcb.c - SVC handlers for misc. FCB operations
  2. *
  3. * demCloseFCB
  4. * demCreateFCB
  5. * demDate16
  6. * demDeleteFCB
  7. * demFCBIO
  8. * demGetFileInfo
  9. * demOpenFCB
  10. * demRenameFCB
  11. *
  12. * Modification History:
  13. *
  14. * Sudeepb 09-Apr-1991 Created
  15. * Sudeepb 21-Nov-1991 Added FCB based IO functions
  16. * Jonle 30-Jun-1994 add wild card support for fcb rename
  17. */
  18. #include "dem.h"
  19. #include "demmsg.h"
  20. #include <softpc.h>
  21. #include <winbase.h>
  22. #include <mvdm.h>
  23. #define DOT '.'
  24. #define QMARK '?'
  25. /* demDeleteFCB - FCB based File Delete
  26. *
  27. *
  28. * Entry - Client (ES:DI) - Full File Path
  29. * Client (AL) - 0 if not extended FCB
  30. * Client (DL) - File Attr. to be deleted (valid only if Al !=0 )
  31. *
  32. * Exit
  33. * SUCCESS
  34. * Client (CF) = 0
  35. *
  36. * FAILURE
  37. * Client (CF) = 1
  38. * Client (AX) = system status code
  39. * HARD ERROR
  40. * Client (CF) = 1
  41. * Client (AX) = 0ffffh
  42. *
  43. * Notes: Following are the rules for FCB based delete:
  44. * 1. If normal FCB than dont allow delete on hidden,system files
  45. * 2. if extended FCB than search attributes should include hidden,
  46. * system or read-only if that kind of file is to be deleted.
  47. */
  48. VOID demDeleteFCB (VOID)
  49. {
  50. HANDLE hFind;
  51. LPSTR lpFileName;
  52. BYTE bClientAttr=0;
  53. BOOL fExtendedFCB=FALSE;
  54. WIN32_FIND_DATA wfBuffer;
  55. BOOL fSuccess = FALSE;
  56. DWORD dwAttr;
  57. USHORT uErr;
  58. CHAR szPath_buffer[_MAX_PATH];
  59. CHAR szDrive[_MAX_DRIVE];
  60. CHAR szDir[_MAX_DIR];
  61. CHAR szFname[_MAX_FNAME];
  62. CHAR szExt[_MAX_EXT];
  63. DWORD dwErrCode = 0, dwErrCodeKeep = 0;
  64. // Get the file name
  65. lpFileName = (LPSTR) GetVDMAddr (getES(),getDI());
  66. _splitpath( lpFileName, szDrive, szDir, szFname, szExt );
  67. // Check if handling extended FCB
  68. if(getAL() != 0){
  69. bClientAttr = getDL();
  70. /* Special case for delete volume label (INT 21 Func 13H, Attr = 8H */
  71. if((bClientAttr == ATTR_VOLUME_ID)) {
  72. if((uErr = demDeleteLabel(lpFileName[DRIVEBYTE]))) {
  73. setCF(1);
  74. setAX(uErr);
  75. return;
  76. }
  77. setAX(0);
  78. setCF(0);
  79. return;
  80. }
  81. bClientAttr &= (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM);
  82. fExtendedFCB = TRUE;
  83. }
  84. // Find the first instance of file
  85. if((hFind = FindFirstFileOem (lpFileName,&wfBuffer)) == (HANDLE)-1){
  86. demClientError(INVALID_HANDLE_VALUE, *lpFileName);
  87. return;
  88. }
  89. // loop for all files which match the name and attributes
  90. do {
  91. // Check if read_only,hidden or system file
  92. if((dwAttr= wfBuffer.dwFileAttributes & (FILE_ATTRIBUTE_READONLY |
  93. FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM))){
  94. // if so, try next file if normal FCB case. If extended fcb case
  95. // then check if right attributes are given by client.
  96. if(fExtendedFCB && ((dwAttr & (DWORD)bClientAttr) == dwAttr)){
  97. // Yes, right attributes are given. So if the file is read
  98. // only then change the modes to normal. Note NT will
  99. // delete hidden and system files anyway.
  100. if (dwAttr & FILE_ATTRIBUTE_READONLY){
  101. strcpy( szPath_buffer, szDrive);
  102. strcat( szPath_buffer, szDir);
  103. strcat( szPath_buffer, wfBuffer.cFileName);
  104. // if set attributes fail try next file
  105. if(SetFileAttributesOem (szPath_buffer,
  106. FILE_ATTRIBUTE_NORMAL) == -1)
  107. continue;
  108. }
  109. }
  110. else {
  111. dwErrCodeKeep = ERROR_ACCESS_DENIED;
  112. continue;
  113. }
  114. }
  115. strcpy( szPath_buffer, szDrive);
  116. strcat( szPath_buffer, szDir);
  117. strcat( szPath_buffer, wfBuffer.cFileName);
  118. if(DeleteFileOem(szPath_buffer) == FALSE) {
  119. dwErrCode = GetLastError();
  120. SetLastError(dwErrCode);
  121. if (((dwErrCode >= ERROR_WRITE_PROTECT) &&
  122. (dwErrCode <= ERROR_GEN_FAILURE)) ||
  123. dwErrCode == ERROR_WRONG_DISK ) {
  124. demClientError(INVALID_HANDLE_VALUE, szPath_buffer[0]);
  125. return;
  126. }
  127. continue;
  128. }
  129. // We have deleted at least one file, so report success
  130. fSuccess = TRUE;
  131. } while (FindNextFileOem(hFind,&wfBuffer) == TRUE);
  132. if(FindClose(hFind) == FALSE)
  133. demPrintMsg (MSG_INVALID_HFIND);
  134. if (fSuccess == TRUE){
  135. setCF(0);
  136. return;
  137. }
  138. setCF(1);
  139. if(dwErrCodeKeep)
  140. setAX((SHORT) dwErrCodeKeep);
  141. else
  142. setAX(ERROR_FILE_NOT_FOUND);
  143. return;
  144. }
  145. /* demRenameFCB - FCB based Rename file
  146. *
  147. * Entry - Client (DS:SI) Sources file to be renamed
  148. * Client (ES:DI) Destination file to be renamed to
  149. *
  150. * Exit - SUCCESS
  151. * Client (CF) = 0
  152. *
  153. * FAILURE
  154. * Client(CF) = 1
  155. * Client(AX) = error code
  156. */
  157. VOID demRenameFCB (VOID)
  158. {
  159. LPSTR lpSrc,lpDst;
  160. DWORD dw;
  161. HANDLE hFind;
  162. PCHAR pNewDstFilePart;
  163. PCHAR pDstFilePart;
  164. PCHAR pCurrSrcFilePart;
  165. WIN32_FIND_DATA W32FindData;
  166. CHAR NewDst[MAX_PATH];
  167. CHAR CurrSrc[MAX_PATH];
  168. lpSrc = (LPSTR) GetVDMAddr (getDS(),getSI());
  169. lpDst = (LPSTR) GetVDMAddr (getES(),getDI());
  170. // Find the first instance of the source file
  171. hFind = FindFirstFileOem (lpSrc,&W32FindData);
  172. if (hFind == INVALID_HANDLE_VALUE) {
  173. dw = GetLastError();
  174. if (dw == ERROR_BAD_PATHNAME || dw == ERROR_DIRECTORY ) {
  175. SetLastError(ERROR_PATH_NOT_FOUND);
  176. }
  177. demClientError(INVALID_HANDLE_VALUE, *lpSrc);
  178. return;
  179. }
  180. //
  181. // Source string consists of the path taken from the original
  182. // source specified plus the filename part retrieved from the
  183. // FindFile call
  184. //
  185. strcpy(CurrSrc, lpSrc);
  186. pCurrSrcFilePart = strrchr(CurrSrc, '\\');
  187. pCurrSrcFilePart++;
  188. //
  189. // Destination string is template for meta character substitution
  190. //
  191. pDstFilePart = strrchr(lpDst, '\\');
  192. pDstFilePart++;
  193. //
  194. // NewDst string is constructed from template and the source string
  195. // when doing meta file character substitution.
  196. //
  197. strcpy(NewDst, lpDst);
  198. pNewDstFilePart = strrchr(NewDst, '\\');
  199. pNewDstFilePart++;
  200. do {
  201. PCHAR pNew;
  202. PCHAR pSrc;
  203. PCHAR pDst;
  204. strcpy(pCurrSrcFilePart,
  205. W32FindData.cAlternateFileName[0]
  206. ? W32FindData.cAlternateFileName
  207. : W32FindData.cFileName //// ??? hpfs lfns ????
  208. );
  209. pSrc = pCurrSrcFilePart; // source fname
  210. pNew = pNewDstFilePart; // dest fname to be constructed
  211. pDst = pDstFilePart; // raw dest fname template (with metas)
  212. while (*pDst) {
  213. //
  214. // If Found a '?' in Dest template, use character from src
  215. //
  216. if (*pDst == QMARK) {
  217. if (*pSrc != DOT && *pSrc)
  218. *pNew++ = *pSrc++;
  219. }
  220. //
  221. // if Found a DOT in Dest template, Align DOTS between Src\Dst
  222. //
  223. else if (*pDst == DOT) {
  224. while (*pSrc != DOT && *pSrc) { // mov src to one past DOT
  225. pSrc++;
  226. }
  227. if (*pSrc)
  228. pSrc++;
  229. *pNew++ = DOT;
  230. }
  231. //
  232. // Nothing special found, use character from Dest template
  233. //
  234. else {
  235. if (*pSrc != DOT && *pSrc)
  236. pSrc++;
  237. *pNew++ = *pDst;
  238. }
  239. pDst++;
  240. }
  241. *pNew = '\0';
  242. //
  243. // MoveFile does not return error if dst and src are the same,
  244. // but DOS does, so check first..
  245. //
  246. if (!_stricmp (CurrSrc, NewDst)) {
  247. setCF(1);
  248. setAX(0x5);
  249. FindClose(hFind);
  250. return;
  251. }
  252. if (!MoveFileOem(CurrSrc, NewDst)){
  253. demClientError(INVALID_HANDLE_VALUE, *lpSrc);
  254. FindClose(hFind);
  255. return;
  256. }
  257. } while (FindNextFileOem(hFind,&W32FindData));
  258. //
  259. // If the search on the source string for any reason besides
  260. // no more files, then its a genuine error.
  261. //
  262. dw = GetLastError();
  263. if (dw != ERROR_NO_MORE_FILES) {
  264. if (dw == ERROR_BAD_PATHNAME || dw == ERROR_DIRECTORY ) {
  265. SetLastError(ERROR_PATH_NOT_FOUND);
  266. }
  267. demClientError(INVALID_HANDLE_VALUE, *lpSrc);
  268. }
  269. else {
  270. setCF(0);
  271. }
  272. FindClose(hFind);
  273. return;
  274. }
  275. /* demCloseFCB - Close the NT handle associated with the FCB being closed.
  276. *
  277. * Entry - Client (AX:SI) DWORD NT handle
  278. *
  279. * Exit - SUCCESS
  280. * Client (CF) = 0
  281. *
  282. * FAILURE
  283. * Client(CF) = 1
  284. * Client(AX) = error code
  285. */
  286. VOID demCloseFCB (VOID)
  287. {
  288. HANDLE hFile;
  289. hFile = GETHANDLE (getAX(),getSI());
  290. if(hFile == 0) {
  291. setCF(0);
  292. return;
  293. }
  294. if (CloseHandle (hFile) == FALSE){
  295. demClientError(hFile, (CHAR)-1);
  296. return;
  297. }
  298. setCF(0);
  299. return;
  300. }
  301. /* demCreateFCB - An FCB is being created get the NT handle.
  302. *
  303. * Entry - Client (AL) Creation Mode
  304. * 00 - Normal File
  305. * 01 - Read-only file
  306. * 02 - Hidden File
  307. * 04 - System file
  308. * Client (DS:SI) Full path filename
  309. * Client (ES:DI) SFT address
  310. *
  311. * Exit - SUCCESS
  312. * Client (CF) = 0
  313. * Client (AX:BP) = NT Handle
  314. * Client (BX) = Time
  315. * Client (CX) = Date
  316. * Client (DX:SI) = Size
  317. *
  318. * FAILURE
  319. * Client(CF) = 1
  320. * Client(AX) = error code
  321. */
  322. VOID demCreateFCB (VOID)
  323. {
  324. demFCBCommon (CREATE_ALWAYS);
  325. return;
  326. }
  327. /* demDate16 - Get the current date/time in DOS FCB format.
  328. *
  329. * Entry - None
  330. *
  331. * Exit - Always Success
  332. * Client (AX) has date
  333. * Client (DX) has time
  334. * NOTES:
  335. *
  336. * DemDate16 returns the current date in AX, current time in DX in this format
  337. * AX - YYYYYYYMMMMDDDDD years months days
  338. * DX - HHHHHMMMMMMSSSSS hours minutes seconds/2
  339. */
  340. VOID demDate16 (VOID)
  341. {
  342. SYSTEMTIME TimeDate;
  343. GetLocalTime(&TimeDate);
  344. // date is stored in a packed word: ((year-1980)*512) + (month*32) + day
  345. setAX ( (USHORT) (((TimeDate.wYear-1980) << 9 ) |
  346. ((TimeDate.wMonth & 0xf) << 5 ) |
  347. (TimeDate.wDay & 0x1f))
  348. );
  349. setDX ( (USHORT) ((TimeDate.wHour << 11) |
  350. ((TimeDate.wMinute & 0x3f) << 5) |
  351. ((TimeDate.wSecond / 2) & 0x1f))
  352. );
  353. return;
  354. }
  355. /* demFCBIO - Carry out the FCB based IO operation.
  356. *
  357. * Entry - Client (BX) = 1 if read operation, 0 if write
  358. * Client (AX:BP) NT Handle
  359. * Client (DI:DX) offset to start the operation with
  360. * Client (CX) Count of bytes
  361. *
  362. * Exit - SUCCESS
  363. * Client (CF) = 0
  364. * Client (CX) = counts of bytes read/written
  365. * Client (AX:BX) = size
  366. *
  367. * FAILURE
  368. * Client(CF) = 1
  369. * Client(AX) = error code
  370. */
  371. VOID demFCBIO (VOID)
  372. {
  373. HANDLE hFile;
  374. ULONG CurOffset;
  375. PVOID pBuf;
  376. DWORD dwBytesIO;
  377. DWORD dwSize,dwSizeHigh;
  378. DWORD dwErrCode;
  379. hFile = GETHANDLE (getAX(),getBP());
  380. CurOffset = (((ULONG)getDI()) << 16) + (ULONG)getDX();
  381. if (SetFilePointer (hFile,
  382. (LONG)CurOffset,
  383. NULL,
  384. (DWORD)FILE_BEGIN) == -1L){
  385. demClientError(hFile, (CHAR)-1);
  386. return ;
  387. }
  388. pBuf = (PVOID)GetVDMAddr(*((PUSHORT)pulDTALocation + 1),
  389. *((PUSHORT)pulDTALocation));
  390. if(getBX()) { // Read Operation
  391. if (ReadFile (hFile,
  392. pBuf,
  393. (DWORD)getCX(),
  394. &dwBytesIO,
  395. NULL) == FALSE){
  396. Sim32FlushVDMPointer(*pulDTALocation, getCX(), pBuf, FALSE);
  397. Sim32FreeVDMPointer(*pulDTALocation, getCX(), pBuf, FALSE);
  398. demClientError(hFile, (CHAR)-1);
  399. return ;
  400. }
  401. Sim32FlushVDMPointer (*pulDTALocation, getCX(),pBuf, FALSE);
  402. Sim32FreeVDMPointer (*pulDTALocation, getCX(), pBuf, FALSE);
  403. }
  404. else {
  405. if (WriteFile (hFile,
  406. pBuf,
  407. (DWORD)getCX(),
  408. &dwBytesIO,
  409. NULL) == FALSE) {
  410. // If disk is full then we should return number of bytes written
  411. // AX = 1 and CF = 1
  412. dwErrCode = GetLastError();
  413. if(dwErrCode == ERROR_DISK_FULL) {
  414. setCX( (USHORT) dwBytesIO);
  415. setAX(1);
  416. setCF(1);
  417. return;
  418. }
  419. SetLastError(dwErrCode);
  420. demClientError(hFile, (CHAR)-1);
  421. return ;
  422. }
  423. }
  424. // Get File Size
  425. if((dwSize = GetFileSize(hFile,&dwSizeHigh)) == -1){
  426. demPrintMsg(MSG_FILEINFO);
  427. ASSERT(FALSE);
  428. demClientError(hFile, (CHAR)-1);
  429. return;
  430. }
  431. if(dwSizeHigh) {
  432. demPrintMsg(MSG_FILESIZE_TOOBIG);
  433. ASSERT(FALSE);
  434. demClientError(hFile, (CHAR)-1);
  435. return;
  436. }
  437. // Setup the exit registers
  438. setCX((USHORT)dwBytesIO);
  439. setBX((USHORT)dwSize);
  440. setAX((USHORT)(dwSize >> 16 ));
  441. setCF(0);
  442. return;
  443. }
  444. /* demGetFileInfo - Get Misc. file info in FCB format.
  445. *
  446. * Entry - Client (DS:SI) full path file name
  447. *
  448. * Exit - SUCCESS
  449. * Client (CF) = 0
  450. * Client (AX) = Attribute of file
  451. * Client (CX) = Time stamp of file
  452. * Client (DX = Date stamp of file
  453. * Client (BX:DI)= Size of file (32 bit)
  454. *
  455. * FAILURE
  456. * Client(CF) = 1
  457. * Client(AX) = error code
  458. */
  459. VOID demGetFileInfo (VOID)
  460. {
  461. HANDLE hFile;
  462. LPSTR lpFileName;
  463. WORD wDate,wTime;
  464. DWORD dwSize,dwAttr;
  465. lpFileName = (LPSTR) GetVDMAddr (getDS(),getSI());
  466. if ((hFile = CreateFileOem(lpFileName,
  467. GENERIC_READ,
  468. FILE_SHARE_READ,
  469. NULL,
  470. OPEN_EXISTING,
  471. 0,
  472. NULL)) == (HANDLE)-1){
  473. demClientError(INVALID_HANDLE_VALUE, *lpFileName);
  474. return;
  475. }
  476. // Get Misc. INfo
  477. if (demGetMiscInfo (hFile,&wTime, &wDate, &dwSize) == FALSE) {
  478. CloseHandle (hFile);
  479. return;
  480. }
  481. CloseHandle (hFile);
  482. if ((dwAttr = GetFileAttributesOem (lpFileName)) == -1) {
  483. demClientError(INVALID_HANDLE_VALUE, *lpFileName);
  484. return;
  485. }
  486. if (dwAttr == FILE_ATTRIBUTE_NORMAL)
  487. dwAttr = 0;
  488. setAX((USHORT)dwAttr);
  489. setCX(wTime);
  490. setDX(wDate);
  491. setDI((USHORT)dwSize);
  492. setBX((USHORT)(dwSize >> 16));
  493. return;
  494. }
  495. /* demOpenFCB - An FCB is being opened get the NT handle.
  496. *
  497. * Entry - Client (AL) Open Mode
  498. * Client (DS:SI) Full path filename
  499. *
  500. * Exit - SUCCESS
  501. * Client (CF) = 0
  502. * Client (AX:BP) = NT Handle
  503. * Client (BX) = Time
  504. * Client (CX) = Date
  505. * Client (DX:SI) = Size
  506. *
  507. * FAILURE
  508. * Client(CF) = 1
  509. * Client(AX) = error code
  510. */
  511. VOID demOpenFCB (VOID)
  512. {
  513. demFCBCommon (OPEN_EXISTING);
  514. return;
  515. }
  516. /* demFCBCommon - FCB Open/Create.
  517. *
  518. * Entry - CreateDirective - Open/Create
  519. * Client (AL) Open Mode
  520. * Client (DS:SI) Full path filename
  521. *
  522. * Exit - SUCCESS
  523. * Client (CF) = 0
  524. * Client (AX:BP) = NT Handle
  525. * Client (BX) = Time
  526. * Client (CX) = Date
  527. * Client (DX:SI) = Size
  528. *
  529. * FAILURE
  530. * Client(CF) = 1
  531. * Client(AX) = error code
  532. */
  533. VOID demFCBCommon (ULONG CreateDirective)
  534. {
  535. HANDLE hFile;
  536. LPSTR lpFileName;
  537. UCHAR uchMode,uchAccess;
  538. DWORD dwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
  539. DWORD dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
  540. WORD wDate,wTime;
  541. DWORD dwSize,dwAttr=0;
  542. USHORT uErr;
  543. SECURITY_ATTRIBUTES sa;
  544. lpFileName = (LPSTR) GetVDMAddr (getDS(),getSI());
  545. uchMode = getAL();
  546. /* Special case for delete volume label (INT 21 Func 13H, Attr = 8H */
  547. if((uchMode == ATTR_VOLUME_ID) && (CreateDirective == CREATE_ALWAYS)) {
  548. if((uErr = demCreateLabel(lpFileName[DRIVEBYTE],
  549. lpFileName+LABELOFF))) {
  550. setCF(1);
  551. setAX(uErr);
  552. return;
  553. }
  554. setAX(0);
  555. setBP(0);
  556. setCF(0);
  557. return;
  558. }
  559. // In create case AL has creation attributes. By default
  560. // Access is for read/write and sharing for both. In open
  561. // case AL has appropriate access and sharing information.
  562. if((CreateDirective == CREATE_ALWAYS) && ((uchMode &0xff) == 0)) {
  563. dwAttr = FILE_ATTRIBUTE_NORMAL;
  564. dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_READ;
  565. }
  566. else {
  567. uchAccess = uchMode & (UCHAR)ACCESS_MASK;
  568. if (uchAccess == OPEN_FOR_READ)
  569. dwDesiredAccess = GENERIC_READ;
  570. else if (uchAccess == OPEN_FOR_WRITE)
  571. dwDesiredAccess = GENERIC_WRITE;
  572. uchMode = uchMode & (UCHAR)SHARING_MASK;
  573. switch (uchMode) {
  574. case SHARING_DENY_BOTH:
  575. dwShareMode = 0;
  576. break;
  577. case SHARING_DENY_WRITE:
  578. dwShareMode = FILE_SHARE_READ;
  579. break;
  580. case SHARING_DENY_READ:
  581. dwShareMode = FILE_SHARE_WRITE;
  582. break;
  583. }
  584. }
  585. sa.nLength = sizeof (SECURITY_ATTRIBUTES);
  586. sa.lpSecurityDescriptor = NULL;
  587. sa.bInheritHandle = TRUE;
  588. if ((hFile = CreateFileOem(lpFileName,
  589. dwDesiredAccess,
  590. dwShareMode | FILE_SHARE_DELETE,
  591. &sa,
  592. CreateDirective,
  593. dwAttr,
  594. NULL)) == (HANDLE)-1){
  595. demClientError(INVALID_HANDLE_VALUE, *lpFileName);
  596. return;
  597. }
  598. // Get Misc. INfo
  599. if (demGetMiscInfo (hFile,&wTime, &wDate, &dwSize) == FALSE)
  600. return;
  601. // Setup the exit registers
  602. setBX(wTime);
  603. setCX(wDate);
  604. setBP((USHORT)hFile);
  605. setAX((USHORT)((ULONG)hFile >> 16));
  606. setSI((USHORT)dwSize);
  607. setDX((USHORT)(dwSize >> 16));
  608. setCF(0);
  609. return;
  610. }
  611. BOOL demGetMiscInfo (hFile, lpTime, lpDate, lpSize)
  612. HANDLE hFile;
  613. LPWORD lpTime;
  614. LPWORD lpDate;
  615. LPDWORD lpSize;
  616. {
  617. FILETIME LastWriteTime,ftLocal;
  618. DWORD dwSizeHigh=0;
  619. if(GetFileTime (hFile,NULL,NULL,&LastWriteTime) == -1){
  620. demPrintMsg(MSG_FILEINFO);
  621. ASSERT(FALSE);
  622. demClientError(hFile, (CHAR)-1);
  623. CloseHandle (hFile);
  624. return FALSE;
  625. }
  626. FileTimeToLocalFileTime (&LastWriteTime,&ftLocal);
  627. if(FileTimeToDosDateTime(&ftLocal,
  628. lpDate,
  629. lpTime) == FALSE){
  630. demPrintMsg(MSG_FILEINFO);
  631. ASSERT(FALSE);
  632. demClientError(hFile, (CHAR)-1);
  633. return FALSE;
  634. }
  635. if((*lpSize = GetFileSize(hFile,&dwSizeHigh)) == -1){
  636. demPrintMsg(MSG_FILEINFO);
  637. ASSERT(FALSE);
  638. demClientError(hFile, (CHAR)-1);
  639. return FALSE;
  640. }
  641. if(dwSizeHigh) {
  642. demPrintMsg(MSG_FILESIZE_TOOBIG);
  643. ASSERT(FALSE);
  644. demClientError(hFile, (CHAR)-1);
  645. return FALSE;
  646. }
  647. return TRUE;
  648. }