Leaked source code of windows server 2003
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.

63 lines
1.2 KiB

  1. /* demlock.c - SVC handler for file file locking calls
  2. *
  3. * demLockOper
  4. *
  5. * Modification History:
  6. *
  7. * Sudeepb 07-Aug-1992 Created
  8. */
  9. #include "dem.h"
  10. #include "demmsg.h"
  11. #include <softpc.h>
  12. #include "dpmtbls.h"
  13. /* demLockOper - Lock or Unlock the file data
  14. *
  15. * Entry Client(AX) : Lock = 0 Unlock = 1
  16. * Client(BX:BP) : NT Handle
  17. * Client(CX:DX) : offset in the file
  18. * Client(SI:DI) : Data Length to be locked
  19. * Exit
  20. * SUCCESS: Client CF = 0
  21. * FAILURE: Client CF = 1
  22. */
  23. VOID demLockOper (VOID)
  24. {
  25. HANDLE hFile;
  26. DWORD dwFileOffset,cbLock;
  27. // Collect all the parameters
  28. hFile = GETHANDLE(getBX(),getBP());
  29. dwFileOffset = GETULONG (getCX(),getDX());
  30. cbLock = GETULONG (getSI(),getDI());
  31. if(getAL() == 0){ // Locking case
  32. if (DPM_LockFile (hFile,
  33. dwFileOffset,
  34. 0,
  35. cbLock,
  36. 0
  37. ) == TRUE) {
  38. setCF (0);
  39. return;
  40. }
  41. }
  42. else {
  43. if (DPM_UnlockFile (hFile,
  44. dwFileOffset,
  45. 0,
  46. cbLock,
  47. 0
  48. ) == TRUE) {
  49. setCF (0);
  50. return;
  51. }
  52. }
  53. // Operation failed
  54. demClientError(hFile, (CHAR)-1);
  55. return;
  56. }