bool cli_get_quota_handle(struct cli_state *cli, int *quota_fnum) { *quota_fnum = cli_nt_create_full(cli, FAKE_FILE_NAME_QUOTA_WIN32, 0x00000016, DESIRED_ACCESS_PIPE, 0x00000000, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x00000000, 0x03); if (*quota_fnum == (-1)) { return False; } return True; }
void nb_createx(const char *fname, unsigned create_options, unsigned create_disposition, int handle) { int fd, i; uint32 desired_access; if (create_options & FILE_DIRECTORY_FILE) { desired_access = FILE_READ_DATA; } else { desired_access = FILE_READ_DATA | FILE_WRITE_DATA; } fd = cli_nt_create_full(c, fname, 0, desired_access, 0x0, FILE_SHARE_READ|FILE_SHARE_WRITE, create_disposition, create_options, 0); if (fd == -1 && handle != -1) { printf("ERROR: cli_nt_create_full failed for %s - %s\n", fname, cli_errstr(c)); exit(1); } if (fd != -1 && handle == -1) { printf("ERROR: cli_nt_create_full succeeded for %s\n", fname); exit(1); } if (fd == -1) return; for (i=0;i<MAX_FILES;i++) { if (ftable[i].handle == 0) break; } if (i == MAX_FILES) { printf("(%d) file table full for %s\n", line_count, fname); exit(1); } ftable[i].handle = handle; ftable[i].fd = fd; }
int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess) { return cli_nt_create_full(cli, fname, 0, DesiredAccess, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_EXISTS_OPEN, 0x0, 0x0); }