From c152661eebc9366798efc780b50250280a1c8c6d Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Fri, 29 May 2026 11:11:12 +0200 Subject: [PATCH] c32ncp: use shared endian helpers Replace the local endian buffer helpers in c32ncp.c with the shared tools.c helpers. This removes the remaining c32-local get/put helpers for little-endian and big-endian packet fields while keeping the NCP wrapper logic unchanged. It also keeps c32ncp.c focused on the future ncpapi role, with generic buffer handling provided by tools.c. No behavior change. --- c32ncp.c | 326 ++++++++++++++++++++----------------------------------- 1 file changed, 119 insertions(+), 207 deletions(-) diff --git a/c32ncp.c b/c32ncp.c index 8e99795..119095c 100644 --- a/c32ncp.c +++ b/c32ncp.c @@ -27,94 +27,6 @@ /* c32ncp.c - namespace/file-system NCP API helpers for mars-dosutils */ -/* - * c32_put_word_lh - * - * Purpose: - * Writes a 16-bit little-endian value into a request buffer. - * - * Notes: - * This file will later become ncpapi.c. These local helpers remain here - * for now so the NCP API wrappers keep their packet construction isolated - * from the more general tools.c helpers. - */ -static void c32_put_word_lh(uint8 *p, uint16 v) -{ - p[0] = (uint8)(v & 0xff); - p[1] = (uint8)((v >> 8) & 0xff); -} - -/* - * c32_put_dword_lh - * - * Purpose: - * Writes a 32-bit little-endian value into a request buffer. - */ -static void c32_put_dword_lh(uint8 *p, uint32 v) -{ - p[0] = (uint8)(v & 0xff); - p[1] = (uint8)((v >> 8) & 0xff); - p[2] = (uint8)((v >> 16) & 0xff); - p[3] = (uint8)((v >> 24) & 0xff); -} - -/* - * c32_put_dword_hl - * - * Purpose: - * Writes a 32-bit high-low value into a request buffer. - * - * Notes: - * Some older file and trustee NCPs use high-low object ids or offsets even - * when the surrounding NCP87 fields are little-endian. - */ -static void c32_put_dword_hl(uint8 *p, uint32 v) -{ - p[0] = (uint8)((v >> 24) & 0xff); - p[1] = (uint8)((v >> 16) & 0xff); - p[2] = (uint8)((v >> 8) & 0xff); - p[3] = (uint8)(v & 0xff); -} - -/* - * c32_get_word_lh - * - * Purpose: - * Reads a 16-bit little-endian value from a reply buffer. - */ -static uint16 c32_get_word_lh(uint8 *p) -{ - return((uint16)(p[0] | ((uint16)p[1] << 8))); -} - -/* - * c32_get_dword_lh - * - * Purpose: - * Reads a 32-bit little-endian value from a reply buffer. - */ -static uint32 c32_get_dword_lh(uint8 *p) -{ - return((uint32)p[0] | - ((uint32)p[1] << 8) | - ((uint32)p[2] << 16) | - ((uint32)p[3] << 24)); -} - -/* - * c32_get_dword_hl - * - * Purpose: - * Reads a 32-bit high-low value from a reply buffer. - */ -static uint32 c32_get_dword_hl(uint8 *p) -{ - return(((uint32)p[0] << 24) | - ((uint32)p[1] << 16) | - ((uint32)p[2] << 8) | - (uint32)p[3]); -} - /* * c32_build_handle_path * @@ -158,8 +70,8 @@ static UI c32_build_handle_path(uint8 *buf, uint8 dhandle, memset(buf, 0, 0x140); if (dhandle) { - c32_put_word_lh(buf + 1, (uint16)dhandle); - c32_put_word_lh(buf + 3, dirbase); + tool_put_word_lh(buf + 1, (uint16)dhandle); + tool_put_word_lh(buf + 3, dirbase); buf[5] = style; } else { buf[5] = 0xff; @@ -193,7 +105,7 @@ static UI c32_build_handle_path(uint8 *buf, uint8 dhandle, } used = (UI)(p - buf); - c32_put_word_lh(buf + 0x13c, used); + tool_put_word_lh(buf + 0x13c, used); return(used); } @@ -222,8 +134,8 @@ static UI c32_build_handle_path_from_dos_path(uint8 *buf, uint8 dhandle, memset(buf, 0, 0x140); if (dhandle) { - c32_put_word_lh(buf + 1, (uint16)dhandle); - c32_put_word_lh(buf + 3, dirbase); + tool_put_word_lh(buf + 1, (uint16)dhandle); + tool_put_word_lh(buf + 3, dirbase); buf[5] = style; } else { buf[5] = 0xff; @@ -282,7 +194,7 @@ static UI c32_build_handle_path_from_dos_path(uint8 *buf, uint8 dhandle, *countp = (uint8)count; used = (UI)(p - buf); - c32_put_word_lh(buf + 0x13c, used); + tool_put_word_lh(buf + 0x13c, used); return(used); } @@ -328,10 +240,10 @@ int c32_get_ncp_handle(uint16 *handle_lo, uint16 *handle_hi) memset(mapout, 0, sizeof(mapout)); C32_MapVar_Probe(4, 0, mapout); - map_ret_ax = c32_get_word_lh(mapout + 14); - map_ret_dx = c32_get_word_lh(mapout + 16); - cref_lo = c32_get_word_lh(mapout + 22); - cref_hi = c32_get_word_lh(mapout + 24); + map_ret_ax = tool_get_word_lh(mapout + 14); + map_ret_dx = tool_get_word_lh(mapout + 16); + cref_lo = tool_get_word_lh(mapout + 22); + cref_hi = tool_get_word_lh(mapout + 24); if (map_ret_ax != 0 || map_ret_dx != 0 || (cref_lo == 0 && cref_hi == 0)) return(2); @@ -339,10 +251,10 @@ int c32_get_ncp_handle(uint16 *handle_lo, uint16 *handle_hi) memset(openout, 0, sizeof(openout)); C32_OpenRef_Probe(cref_lo, cref_hi, openout); - open_ret_ax = c32_get_word_lh(openout + 14); - open_ret_dx = c32_get_word_lh(openout + 16); - *handle_lo = c32_get_word_lh(openout + 18); - *handle_hi = c32_get_word_lh(openout + 20); + open_ret_ax = tool_get_word_lh(openout + 14); + open_ret_dx = tool_get_word_lh(openout + 16); + *handle_lo = tool_get_word_lh(openout + 18); + *handle_hi = tool_get_word_lh(openout + 20); if (open_ret_ax != 0 || open_ret_dx != 0 || (*handle_lo == 0 && *handle_hi == 0)) return(3); @@ -458,10 +370,10 @@ int ncp87_01_open_create_entry(const char *path_name, hdr[0] = 1; /* NCP87 subfunction 1 */ hdr[1] = 0; /* DOS namespace */ hdr[2] = open_create_mode; - c32_put_word_lh(hdr + 3, search_attrs); - c32_put_dword_lh(hdr + 5, 0x00000FFFUL); /* RIM_ALL, keeps size handy */ - c32_put_dword_lh(hdr + 9, create_attrs); - c32_put_word_lh(hdr + 13, desired_access); + tool_put_word_lh(hdr + 3, search_attrs); + tool_put_dword_lh(hdr + 5, 0x00000FFFUL); /* RIM_ALL, keeps size handy */ + tool_put_dword_lh(hdr + 9, create_attrs); + tool_put_word_lh(hdr + 13, desired_access); path_len = c32_build_handle_path_from_dos_path(path, (uint8)dir_handle, 0, 0, path_name); @@ -477,9 +389,9 @@ int ncp87_01_open_create_entry(const char *path_name, rep1, sizeof(rep1), rawout); - raw_ret_ax = c32_get_word_lh(rawout + 14); - raw_ret_dx = c32_get_word_lh(rawout + 16); - actual_lo = c32_get_word_lh(rawout + 18); + raw_ret_ax = tool_get_word_lh(rawout + 14); + raw_ret_dx = tool_get_word_lh(rawout + 16); + actual_lo = tool_get_word_lh(rawout + 18); if (actual_out) *actual_out = actual_lo; if (handle_lo_out) *handle_lo_out = handle_lo; @@ -495,7 +407,7 @@ int ncp87_01_open_create_entry(const char *path_name, /* NetWareInfoStruct follows FileHandle[6]/OpenCreateAction/Reserved. */ if (file_size_out) - *file_size_out = c32_get_dword_lh(rep0 + 8 + 10); + *file_size_out = tool_get_dword_lh(rep0 + 8 + 10); return(0); } @@ -548,9 +460,9 @@ int ncp74_file_server_copy(const C32_NWFILE_HANDLE6 *src, memcpy(req.src_handle, src->h, 6); memcpy(req.dst_handle, dst->h, 6); - c32_put_dword_hl(req.src_offset, src_offset); - c32_put_dword_hl(req.dst_offset, dst_offset); - c32_put_dword_hl(req.count, count); + tool_put_dword_hl(req.src_offset, src_offset); + tool_put_dword_hl(req.dst_offset, dst_offset); + tool_put_dword_hl(req.count, count); req.len = 1 + 6 + 6 + 4 + 4 + 4; repl.len = 4; @@ -559,7 +471,7 @@ int ncp74_file_server_copy(const C32_NWFILE_HANDLE6 *src, return(-neterrno); if (copied_out) - *copied_out = c32_get_dword_hl(repl.copied); + *copied_out = tool_get_dword_hl(repl.copied); return(0); } @@ -651,8 +563,8 @@ int ncp87_06_obtain_rim_attributes(const char *name, hdr[0] = 6; /* NCP87 subfunction 6 */ hdr[1] = 0; /* source namespace DOS */ hdr[2] = 0; /* target namespace DOS */ - c32_put_word_lh(hdr + 3, 0x0006); /* SA_ALL */ - c32_put_dword_lh(hdr + 5, 0x00000004UL); /* RIM_ATTRIBUTES */ + tool_put_word_lh(hdr + 3, 0x0006); /* SA_ALL */ + tool_put_dword_lh(hdr + 5, 0x00000004UL); /* RIM_ATTRIBUTES */ path_len = c32_build_handle_path(path, (uint8)dir_handle, 0, 0, 1, name, NULL, NULL); @@ -668,9 +580,9 @@ int ncp87_06_obtain_rim_attributes(const char *name, rep1, 0x100, rawout); - raw_ret_ax = c32_get_word_lh(rawout + 14); - raw_ret_dx = c32_get_word_lh(rawout + 16); - actual_lo = c32_get_word_lh(rawout + 18); + raw_ret_ax = tool_get_word_lh(rawout + 14); + raw_ret_dx = tool_get_word_lh(rawout + 16); + actual_lo = tool_get_word_lh(rawout + 18); if (raw_ret_ax != 0 || raw_ret_dx != 0) return(20); @@ -680,7 +592,7 @@ int ncp87_06_obtain_rim_attributes(const char *name, * REP0+4 little-endian dword = DOS attributes * Example LOGIN.EXE: 20h archive. */ - *attr_out = c32_get_dword_lh(rep0 + 4); + *attr_out = tool_get_dword_lh(rep0 + 4); if (actual_out) *actual_out = actual_lo; if (handle_lo_out) *handle_lo_out = handle_lo; @@ -754,8 +666,8 @@ int ncp87_06_obtain_ndir_info(const char *path_name, hdr[0] = 6; /* NCP87 subfunction 6 */ hdr[1] = 0; /* source namespace DOS */ hdr[2] = 0; /* target namespace DOS */ - c32_put_word_lh(hdr + 3, 0x0006); /* SA_ALL */ - c32_put_dword_lh(hdr + 5, 0x00000FFFUL); /* RIM_ALL */ + tool_put_word_lh(hdr + 3, 0x0006); /* SA_ALL */ + tool_put_dword_lh(hdr + 5, 0x00000FFFUL); /* RIM_ALL */ path_len = c32_build_handle_path_from_dos_path(path, (uint8)dir_handle, 0, 0, path_name); @@ -771,9 +683,9 @@ int ncp87_06_obtain_ndir_info(const char *path_name, rep1, sizeof(rep1), rawout); - raw_ret_ax = c32_get_word_lh(rawout + 14); - raw_ret_dx = c32_get_word_lh(rawout + 16); - actual_lo = c32_get_word_lh(rawout + 18); + raw_ret_ax = tool_get_word_lh(rawout + 14); + raw_ret_dx = tool_get_word_lh(rawout + 16); + actual_lo = tool_get_word_lh(rawout + 18); if (actual_out) *actual_out = actual_lo; if (handle_lo_out) *handle_lo_out = handle_lo; @@ -782,30 +694,30 @@ int ncp87_06_obtain_ndir_info(const char *path_name, if (raw_ret_ax != 0 || raw_ret_dx != 0) return(20); - info_out->space_allocated = c32_get_dword_lh(rep0 + 0); - info_out->attributes = c32_get_dword_lh(rep0 + 4); - info_out->flags = c32_get_word_lh(rep0 + 8); - info_out->data_size = c32_get_dword_lh(rep0 + 10); - info_out->total_size = c32_get_dword_lh(rep0 + 14); - info_out->number_of_streams = c32_get_word_lh(rep0 + 18); - info_out->creation_time = c32_get_word_lh(rep0 + 20); - info_out->creation_date = c32_get_word_lh(rep0 + 22); - info_out->creator_id = c32_get_dword_hl(rep0 + 24); - info_out->modify_time = c32_get_word_lh(rep0 + 28); - info_out->modify_date = c32_get_word_lh(rep0 + 30); - info_out->modifier_id = c32_get_dword_hl(rep0 + 32); - info_out->last_access_date = c32_get_word_lh(rep0 + 36); - info_out->archive_time = c32_get_word_lh(rep0 + 38); - info_out->archive_date = c32_get_word_lh(rep0 + 40); - info_out->archiver_id = c32_get_dword_hl(rep0 + 42); - info_out->inherited_rights = c32_get_word_lh(rep0 + 46); - info_out->dir_ent_num = c32_get_dword_lh(rep0 + 48); - info_out->dos_dir_num = c32_get_dword_lh(rep0 + 52); - info_out->vol_number = c32_get_dword_lh(rep0 + 56); - info_out->ea_data_size = c32_get_dword_lh(rep0 + 60); - info_out->ea_key_count = c32_get_dword_lh(rep0 + 64); - info_out->ea_key_size = c32_get_dword_lh(rep0 + 68); - info_out->ns_creator = c32_get_dword_lh(rep0 + 72); + info_out->space_allocated = tool_get_dword_lh(rep0 + 0); + info_out->attributes = tool_get_dword_lh(rep0 + 4); + info_out->flags = tool_get_word_lh(rep0 + 8); + info_out->data_size = tool_get_dword_lh(rep0 + 10); + info_out->total_size = tool_get_dword_lh(rep0 + 14); + info_out->number_of_streams = tool_get_word_lh(rep0 + 18); + info_out->creation_time = tool_get_word_lh(rep0 + 20); + info_out->creation_date = tool_get_word_lh(rep0 + 22); + info_out->creator_id = tool_get_dword_hl(rep0 + 24); + info_out->modify_time = tool_get_word_lh(rep0 + 28); + info_out->modify_date = tool_get_word_lh(rep0 + 30); + info_out->modifier_id = tool_get_dword_hl(rep0 + 32); + info_out->last_access_date = tool_get_word_lh(rep0 + 36); + info_out->archive_time = tool_get_word_lh(rep0 + 38); + info_out->archive_date = tool_get_word_lh(rep0 + 40); + info_out->archiver_id = tool_get_dword_hl(rep0 + 42); + info_out->inherited_rights = tool_get_word_lh(rep0 + 46); + info_out->dir_ent_num = tool_get_dword_lh(rep0 + 48); + info_out->dos_dir_num = tool_get_dword_lh(rep0 + 52); + info_out->vol_number = tool_get_dword_lh(rep0 + 56); + info_out->ea_data_size = tool_get_dword_lh(rep0 + 60); + info_out->ea_key_count = tool_get_dword_lh(rep0 + 64); + info_out->ea_key_size = tool_get_dword_lh(rep0 + 68); + info_out->ns_creator = tool_get_dword_lh(rep0 + 72); namelen = rep0[76]; if (namelen > 255) @@ -891,22 +803,22 @@ int ncp87_07_modify_dos_info(const char *name, *p++ = 7; /* subfunction: modify DOS info */ *p++ = 0; /* namespace DOS */ *p++ = 0; /* reserved */ - c32_put_word_lh(p, 0x0006); p += 2; /* SA_ALL */ - c32_put_dword_lh(p, change_mask); p += 4; + tool_put_word_lh(p, 0x0006); p += 2; /* SA_ALL */ + tool_put_dword_lh(p, change_mask); p += 4; - c32_put_dword_lh(p, info->attributes); p += 4; - c32_put_word_lh(p, info->creation_time); p += 2; - c32_put_word_lh(p, info->creation_date); p += 2; - c32_put_dword_hl(p, info->creator_id); p += 4; - c32_put_word_lh(p, info->modify_time); p += 2; - c32_put_word_lh(p, info->modify_date); p += 2; - c32_put_dword_hl(p, info->modifier_id); p += 4; - c32_put_word_lh(p, info->last_access_date); p += 2; - c32_put_word_lh(p, info->archive_time); p += 2; - c32_put_word_lh(p, info->archive_date); p += 2; - c32_put_dword_hl(p, info->archiver_id); p += 4; - c32_put_word_lh(p, info->inherited_rights); p += 2; - c32_put_dword_lh(p, info->maximum_space); p += 4; + tool_put_dword_lh(p, info->attributes); p += 4; + tool_put_word_lh(p, info->creation_time); p += 2; + tool_put_word_lh(p, info->creation_date); p += 2; + tool_put_dword_hl(p, info->creator_id); p += 4; + tool_put_word_lh(p, info->modify_time); p += 2; + tool_put_word_lh(p, info->modify_date); p += 2; + tool_put_dword_hl(p, info->modifier_id); p += 4; + tool_put_word_lh(p, info->last_access_date); p += 2; + tool_put_word_lh(p, info->archive_time); p += 2; + tool_put_word_lh(p, info->archive_date); p += 2; + tool_put_dword_hl(p, info->archiver_id); p += 4; + tool_put_word_lh(p, info->inherited_rights); p += 2; + tool_put_dword_lh(p, info->maximum_space); p += 4; mod_len = (UI)(p - modbuf); path_len = c32_build_handle_path(path, (uint8)dir_handle, 0, 0, 1, @@ -923,9 +835,9 @@ int ncp87_07_modify_dos_info(const char *name, rep1, sizeof(rep1), rawout); - raw_ret_ax = c32_get_word_lh(rawout + 14); - raw_ret_dx = c32_get_word_lh(rawout + 16); - actual_lo = c32_get_word_lh(rawout + 18); + raw_ret_ax = tool_get_word_lh(rawout + 14); + raw_ret_dx = tool_get_word_lh(rawout + 16); + actual_lo = tool_get_word_lh(rawout + 18); if (actual_out) *actual_out = actual_lo; @@ -1035,8 +947,8 @@ int ncp87_1d_get_effective_rights(const char *path_name, hdr[0] = 29; hdr[1] = 0; /* source namespace DOS */ hdr[2] = 0; /* target namespace DOS */ - c32_put_word_lh(hdr + 3, 0x0006); /* SA_ALL */ - c32_put_dword_lh(hdr + 5, 0L); /* reserved */ + tool_put_word_lh(hdr + 3, 0x0006); /* SA_ALL */ + tool_put_dword_lh(hdr + 5, 0L); /* reserved */ path_len = c32_build_handle_path_from_dos_path(path, (uint8)dir_handle, 0, 0, path_name); @@ -1052,9 +964,9 @@ int ncp87_1d_get_effective_rights(const char *path_name, rep1, sizeof(rep1), rawout); - raw_ret_ax = c32_get_word_lh(rawout + 14); - raw_ret_dx = c32_get_word_lh(rawout + 16); - actual_lo = c32_get_word_lh(rawout + 18); + raw_ret_ax = tool_get_word_lh(rawout + 14); + raw_ret_dx = tool_get_word_lh(rawout + 16); + actual_lo = tool_get_word_lh(rawout + 18); if (actual_out) *actual_out = actual_lo; if (handle_lo_out) *handle_lo_out = handle_lo; @@ -1063,8 +975,8 @@ int ncp87_1d_get_effective_rights(const char *path_name, if (raw_ret_ax != 0 || raw_ret_dx != 0) return(20); - rights0 = c32_get_word_lh(rep0 + 0); - rights4 = c32_get_word_lh(rep0 + 4); + rights0 = tool_get_word_lh(rep0 + 0); + rights4 = tool_get_word_lh(rep0 + 4); /* * Most NCP replies start at REP0+0. The existing RIM_ATTRIBUTES helper @@ -1140,12 +1052,12 @@ int ncp87_1d_get_effective_rights_by_dirent(uint8 vol_number, hdr[0] = 0x1d; hdr[1] = 0; hdr[2] = 0; - c32_put_word_lh(hdr + 3, 0x0006); - c32_put_dword_lh(hdr + 5, 0L); + tool_put_word_lh(hdr + 3, 0x0006); + tool_put_dword_lh(hdr + 5, 0L); memset(path, 0, sizeof(path)); path[0] = vol_number; - c32_put_dword_lh(path + 1, dos_dir_number); + tool_put_dword_lh(path + 1, dos_dir_number); path[5] = 1; path[6] = 0; @@ -1160,9 +1072,9 @@ int ncp87_1d_get_effective_rights_by_dirent(uint8 vol_number, rep1, sizeof(rep1), rawout); - raw_ret_ax = c32_get_word_lh(rawout + 14); - raw_ret_dx = c32_get_word_lh(rawout + 16); - actual_lo = c32_get_word_lh(rawout + 18); + raw_ret_ax = tool_get_word_lh(rawout + 14); + raw_ret_dx = tool_get_word_lh(rawout + 16); + actual_lo = tool_get_word_lh(rawout + 18); if (actual_out) *actual_out = actual_lo; if (handle_lo_out) *handle_lo_out = handle_lo; @@ -1276,8 +1188,8 @@ int ncp22_27_set_trustee_rights(const char *path_name, req.func = 0x27; /* NCP22/27 Add Ext Trustee */ req.dirhandle = 0; /* volume-qualified path follows */ - c32_put_dword_hl(req.trustee_id, object_id); - c32_put_word_lh(req.trustee_rights, rights); + tool_put_dword_hl(req.trustee_id, object_id); + tool_put_word_lh(req.trustee_rights, rights); req.pathlen = (uint8)pathlen; memcpy(req.path, ncppath, pathlen); req.len = 9 + pathlen; @@ -1335,7 +1247,7 @@ int ncp22_2b_delete_trustee_rights(const char *path_name, req.func = 0x2b; /* NCP22/43 Delete Trustee */ req.dirhandle = 0; /* volume-qualified path follows */ - c32_put_dword_hl(req.trustee_id, object_id); + tool_put_dword_hl(req.trustee_id, object_id); req.reserved = 0; /* NCP22/2B has a reserved byte before pathlen */ req.pathlen = (uint8)pathlen; memcpy(req.path, ncppath, pathlen); @@ -1411,9 +1323,9 @@ int ncp87_0a_add_trustee_rights(const char *path_name, hdr[0] = 10; hdr[1] = 0; /* DOS namespace */ hdr[2] = 0; /* reserved */ - c32_put_word_lh(hdr + 3, 0x8006); /* SA_ALL: files/subdirs + system + hidden */ - c32_put_word_lh(hdr + 5, rights_mask); - c32_put_word_lh(hdr + 7, 1); /* one trustee */ + tool_put_word_lh(hdr + 3, 0x8006); /* SA_ALL: files/subdirs + system + hidden */ + tool_put_word_lh(hdr + 5, rights_mask); + tool_put_word_lh(hdr + 7, 1); /* one trustee */ memset(reqpath, 0, sizeof(reqpath)); path_struct_len = c32_build_handle_path_from_dos_path(reqpath, @@ -1437,8 +1349,8 @@ int ncp87_0a_add_trustee_rights(const char *path_name, return(2); tp = reqpath + 307; - c32_put_dword_hl(tp, object_id); tp += 4; - c32_put_word_lh(tp, rights); tp += 2; + tool_put_dword_hl(tp, object_id); tp += 4; + tool_put_word_lh(tp, rights); tp += 2; reqpath_len = (UI)(tp - reqpath); memset(rep0, 0, sizeof(rep0)); @@ -1452,9 +1364,9 @@ int ncp87_0a_add_trustee_rights(const char *path_name, rep1, sizeof(rep1), rawout); - raw_ret_ax = c32_get_word_lh(rawout + 14); - raw_ret_dx = c32_get_word_lh(rawout + 16); - actual_lo = c32_get_word_lh(rawout + 18); + raw_ret_ax = tool_get_word_lh(rawout + 14); + raw_ret_dx = tool_get_word_lh(rawout + 16); + actual_lo = tool_get_word_lh(rawout + 18); if (actual_out) *actual_out = actual_lo; if (handle_lo_out) *handle_lo_out = handle_lo; @@ -1523,8 +1435,8 @@ int ncp87_05_find_trustee_rights(const char *path_name, hdr[0] = 5; /* NCP87 subfunction 5: scan trustees */ hdr[1] = 0; /* DOS namespace */ hdr[2] = 0; /* reserved */ - c32_put_word_lh(hdr + 3, 0x8006); /* SA_ALL: files/subdirs + system + hidden */ - c32_put_dword_lh(hdr + 5, seq); /* search sequence, starts at zero */ + tool_put_word_lh(hdr + 3, 0x8006); /* SA_ALL: files/subdirs + system + hidden */ + tool_put_dword_lh(hdr + 5, seq); /* search sequence, starts at zero */ path_len = c32_build_handle_path_from_dos_path(path, (uint8)dir_handle, @@ -1542,9 +1454,9 @@ int ncp87_05_find_trustee_rights(const char *path_name, rep1, sizeof(rep1), rawout); - raw_ret_ax = c32_get_word_lh(rawout + 14); - raw_ret_dx = c32_get_word_lh(rawout + 16); - actual_lo = c32_get_word_lh(rawout + 18); + raw_ret_ax = tool_get_word_lh(rawout + 14); + raw_ret_dx = tool_get_word_lh(rawout + 16); + actual_lo = tool_get_word_lh(rawout + 18); if (actual_out) *actual_out = actual_lo; if (handle_lo_out) *handle_lo_out = handle_lo; @@ -1553,18 +1465,18 @@ int ncp87_05_find_trustee_rights(const char *path_name, if (raw_ret_ax != 0 || raw_ret_dx != 0) return(0xff); /* Client32 returns an error when no trustees are present. */ - next_seq = c32_get_dword_lh(rep0 + 0); - count = c32_get_word_lh(rep0 + 4); + next_seq = tool_get_dword_lh(rep0 + 0); + count = tool_get_word_lh(rep0 + 4); if (count > 20) count = 20; tp = rep0 + 6; for (i = 0; i < count; i++) { - uint32 tid = c32_get_dword_hl(tp); - uint16 trights = c32_get_word_lh(tp + 4); + uint32 tid = tool_get_dword_hl(tp); + uint16 trights = tool_get_word_lh(tp + 4); - if (tid == object_id || c32_get_dword_lh(tp) == object_id) { + if (tid == object_id || tool_get_dword_lh(tp) == object_id) { *rights_out = trights; return(0); } @@ -1625,7 +1537,7 @@ int ncp87_0b_delete_trustee_rights(const char *path_name, hdr[0] = 11; /* NCP87 subfunction 11: delete trustee */ hdr[1] = 0; /* DOS namespace */ hdr[2] = 0; /* reserved */ - c32_put_word_lh(hdr + 3, 1); /* one trustee */ + tool_put_word_lh(hdr + 3, 1); /* one trustee */ memset(reqpath, 0, sizeof(reqpath)); path_struct_len = c32_build_handle_path_from_dos_path(reqpath, @@ -1637,8 +1549,8 @@ int ncp87_0b_delete_trustee_rights(const char *path_name, return(2); tp = reqpath + 307; - c32_put_dword_hl(tp, object_id); tp += 4; - c32_put_word_lh(tp, 0); tp += 2; + tool_put_dword_hl(tp, object_id); tp += 4; + tool_put_word_lh(tp, 0); tp += 2; reqpath_len = (UI)(tp - reqpath); memset(rep0, 0, sizeof(rep0)); @@ -1652,9 +1564,9 @@ int ncp87_0b_delete_trustee_rights(const char *path_name, rep1, sizeof(rep1), rawout); - raw_ret_ax = c32_get_word_lh(rawout + 14); - raw_ret_dx = c32_get_word_lh(rawout + 16); - actual_lo = c32_get_word_lh(rawout + 18); + raw_ret_ax = tool_get_word_lh(rawout + 14); + raw_ret_dx = tool_get_word_lh(rawout + 16); + actual_lo = tool_get_word_lh(rawout + 18); if (actual_out) *actual_out = actual_lo; if (handle_lo_out) *handle_lo_out = handle_lo;