Bunch More Work, mostly cleanup and organization.
Wanted to do this now before it gets out of hand. Ideally, this can be used for a Winelib-like option eventually, too, where you don't load OS/2 binaries at all but rather compile and link your OS/2-based source code against this API reimplementation.
This commit is contained in:
1 parent
6220544d06
commit
bee2afe62b
21 files changed
+1256
-260
No files matched your search
@@ -13,7 +13,7 @@ static int sanityCheckExe(uint8 **_exe, uint32 *_exelen)
|
||||
return 0;
|
||||
}
|
||||
const uint32 header_offset = *((uint32 *) (*_exe + 0x3C));
|
||||
//printf("header offset is %u\n", (unsigned int) header_offset);
|
||||
//printf("header offset is %u\n", (uint) header_offset);
|
||||
if ((header_offset + sizeof (LxHeader)) >= *_exelen) {
|
||||
fprintf(stderr, "not an OS/2 LX EXE\n");
|
||||
return 0;
|
||||
@@ -35,22 +35,22 @@ static int sanityCheckExe(uint8 **_exe, uint32 *_exelen)
|
||||
}
|
||||
|
||||
if (lx->lx_version != 0) {
|
||||
fprintf(stderr, "Program is unknown LX EXE version (%u)\n", (unsigned int) lx->lx_version);
|
||||
fprintf(stderr, "Program is unknown LX EXE version (%u)\n", (uint) lx->lx_version);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lx->cpu_type > 3) { // 1==286, 2==386, 3==486
|
||||
fprintf(stderr, "Program needs unknown CPU type (%u)\n", (unsigned int) lx->cpu_type);
|
||||
fprintf(stderr, "Program needs unknown CPU type (%u)\n", (uint) lx->cpu_type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lx->os_type != 1) { // 1==OS/2, others: dos4, windows, win386, unknown.
|
||||
fprintf(stderr, "Program needs unknown OS type (%u)\n", (unsigned int) lx->os_type);
|
||||
fprintf(stderr, "Program needs unknown OS type (%u)\n", (uint) lx->os_type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lx->page_size != 4096) {
|
||||
fprintf(stderr, "Program page size isn't 4096 (%u)\n", (unsigned int) lx->page_size);
|
||||
fprintf(stderr, "Program page size isn't 4096 (%u)\n", (uint) lx->page_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
return;
|
||||
|
||||
const LxHeader *lx = (const LxHeader *) exe;
|
||||
printf("module version: %u\n", (unsigned int) lx->module_version);
|
||||
printf("module version: %u\n", (uint) lx->module_version);
|
||||
|
||||
printf("module flags:");
|
||||
if (lx->module_flags & 0x4) printf(" LIBINIT");
|
||||
@@ -84,44 +84,44 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
if (lx->module_flags & 0x40000000) printf(" LIBTERM");
|
||||
printf("\n");
|
||||
|
||||
printf("Number of pages in module: %u\n", (unsigned int) lx->module_num_pages);
|
||||
printf("EIP Object number: %u\n", (unsigned int) lx->eip_object);
|
||||
printf("EIP: 0x%X\n", (unsigned int) lx->eip);
|
||||
printf("ESP Object number: %u\n", (unsigned int) lx->esp_object);
|
||||
printf("ESP: 0x%X\n", (unsigned int) lx->esp);
|
||||
printf("Page size: %u\n", (unsigned int) lx->page_size);
|
||||
printf("Page offset shift: %u\n", (unsigned int) lx->page_offset_shift);
|
||||
printf("Fixup section size: %u\n", (unsigned int) lx->fixup_section_size);
|
||||
printf("Fixup section checksum: 0x%X\n", (unsigned int) lx->fixup_section_checksum);
|
||||
printf("Loader section size: %u\n", (unsigned int) lx->loader_section_size);
|
||||
printf("Loader section checksum: 0x%X\n", (unsigned int) lx->loader_section_checksum);
|
||||
printf("Object table offset: %u\n", (unsigned int) lx->object_table_offset);
|
||||
printf("Number of objects in module: %u\n", (unsigned int) lx->module_num_objects);
|
||||
printf("Object page table offset: %u\n", (unsigned int) lx->object_page_table_offset);
|
||||
printf("Object iterated pages offset: %u\n", (unsigned int) lx->object_iter_pages_offset);
|
||||
printf("Resource table offset: %u\n", (unsigned int) lx->resource_table_offset);
|
||||
printf("Number of resource table entries: %u\n", (unsigned int) lx->num_resource_table_entries);
|
||||
printf("Resident name table offset: %u\n", (unsigned int) lx->resident_name_table_offset);
|
||||
printf("Entry table offset: %u\n", (unsigned int) lx->entry_table_offset);
|
||||
printf("Module directives offset: %u\n", (unsigned int) lx->module_directives_offset);
|
||||
printf("Number of module directives: %u\n", (unsigned int) lx->num_module_directives);
|
||||
printf("Fixup page table offset: %u\n", (unsigned int) lx->fixup_page_table_offset);
|
||||
printf("Fixup record table offset: %u\n", (unsigned int) lx->fixup_record_table_offset);
|
||||
printf("Import module table offset: %u\n", (unsigned int) lx->import_module_table_offset);
|
||||
printf("Number of inport module entries: %u\n", (unsigned int) lx->num_import_mod_entries);
|
||||
printf("Import procedure name table offset: %u\n", (unsigned int) lx->import_proc_table_offset);
|
||||
printf("Per-page checksum offset: %u\n", (unsigned int) lx->per_page_checksum_offset);
|
||||
printf("Data pages offset: %u\n", (unsigned int) lx->data_pages_offset);
|
||||
printf("Number of preload pages: %u\n", (unsigned int) lx->num_preload_pages);
|
||||
printf("Non-resident name table offset: %u\n", (unsigned int) lx->non_resident_name_table_offset);
|
||||
printf("Non-resident name table length: %u\n", (unsigned int) lx->non_resident_name_table_len);
|
||||
printf("Non-resident name table checksum: 0x%X\n", (unsigned int) lx->non_resident_name_table_checksum);
|
||||
printf("Auto data segment object number: %u\n", (unsigned int) lx->auto_ds_object_num);
|
||||
printf("Debug info offset: %u\n", (unsigned int) lx->debug_info_offset);
|
||||
printf("Debug info length: %u\n", (unsigned int) lx->debug_info_len);
|
||||
printf("Number of instance pages in preload section: %u\n", (unsigned int) lx->num_instance_preload);
|
||||
printf("Number of instance pages in demand section: %u\n", (unsigned int) lx->num_instance_demand);
|
||||
printf("Heap size: %u\n", (unsigned int) lx->heapsize);
|
||||
printf("Number of pages in module: %u\n", (uint) lx->module_num_pages);
|
||||
printf("EIP Object number: %u\n", (uint) lx->eip_object);
|
||||
printf("EIP: 0x%X\n", (uint) lx->eip);
|
||||
printf("ESP Object number: %u\n", (uint) lx->esp_object);
|
||||
printf("ESP: 0x%X\n", (uint) lx->esp);
|
||||
printf("Page size: %u\n", (uint) lx->page_size);
|
||||
printf("Page offset shift: %u\n", (uint) lx->page_offset_shift);
|
||||
printf("Fixup section size: %u\n", (uint) lx->fixup_section_size);
|
||||
printf("Fixup section checksum: 0x%X\n", (uint) lx->fixup_section_checksum);
|
||||
printf("Loader section size: %u\n", (uint) lx->loader_section_size);
|
||||
printf("Loader section checksum: 0x%X\n", (uint) lx->loader_section_checksum);
|
||||
printf("Object table offset: %u\n", (uint) lx->object_table_offset);
|
||||
printf("Number of objects in module: %u\n", (uint) lx->module_num_objects);
|
||||
printf("Object page table offset: %u\n", (uint) lx->object_page_table_offset);
|
||||
printf("Object iterated pages offset: %u\n", (uint) lx->object_iter_pages_offset);
|
||||
printf("Resource table offset: %u\n", (uint) lx->resource_table_offset);
|
||||
printf("Number of resource table entries: %u\n", (uint) lx->num_resource_table_entries);
|
||||
printf("Resident name table offset: %u\n", (uint) lx->resident_name_table_offset);
|
||||
printf("Entry table offset: %u\n", (uint) lx->entry_table_offset);
|
||||
printf("Module directives offset: %u\n", (uint) lx->module_directives_offset);
|
||||
printf("Number of module directives: %u\n", (uint) lx->num_module_directives);
|
||||
printf("Fixup page table offset: %u\n", (uint) lx->fixup_page_table_offset);
|
||||
printf("Fixup record table offset: %u\n", (uint) lx->fixup_record_table_offset);
|
||||
printf("Import module table offset: %u\n", (uint) lx->import_module_table_offset);
|
||||
printf("Number of inport module entries: %u\n", (uint) lx->num_import_mod_entries);
|
||||
printf("Import procedure name table offset: %u\n", (uint) lx->import_proc_table_offset);
|
||||
printf("Per-page checksum offset: %u\n", (uint) lx->per_page_checksum_offset);
|
||||
printf("Data pages offset: %u\n", (uint) lx->data_pages_offset);
|
||||
printf("Number of preload pages: %u\n", (uint) lx->num_preload_pages);
|
||||
printf("Non-resident name table offset: %u\n", (uint) lx->non_resident_name_table_offset);
|
||||
printf("Non-resident name table length: %u\n", (uint) lx->non_resident_name_table_len);
|
||||
printf("Non-resident name table checksum: 0x%X\n", (uint) lx->non_resident_name_table_checksum);
|
||||
printf("Auto data segment object number: %u\n", (uint) lx->auto_ds_object_num);
|
||||
printf("Debug info offset: %u\n", (uint) lx->debug_info_offset);
|
||||
printf("Debug info length: %u\n", (uint) lx->debug_info_len);
|
||||
printf("Number of instance pages in preload section: %u\n", (uint) lx->num_instance_preload);
|
||||
printf("Number of instance pages in demand section: %u\n", (uint) lx->num_instance_demand);
|
||||
printf("Heap size: %u\n", (uint) lx->heapsize);
|
||||
|
||||
/* This is apparently a requirement as of OS/2 2.0, according to lxexe.txt. */
|
||||
if ((lx->object_iter_pages_offset != 0) && (lx->object_iter_pages_offset != lx->data_pages_offset)) {
|
||||
@@ -130,12 +130,12 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
|
||||
// when an LX file says "object" it's probably more like "section" or "segment" ...?
|
||||
printf("\n");
|
||||
printf("Object table (%u entries):\n", (unsigned int) lx->module_num_objects);
|
||||
printf("Object table (%u entries):\n", (uint) lx->module_num_objects);
|
||||
for (uint32 i = 0; i < lx->module_num_objects; i++) {
|
||||
const LxObjectTableEntry *obj = ((const LxObjectTableEntry *) (exe + lx->object_table_offset)) + i;
|
||||
printf("Object #%u:\n", (unsigned int) i+1);
|
||||
printf("Virtual size: %u\n", (unsigned int) obj->virtual_size);
|
||||
printf("Relocation base address: 0x%X\n", (unsigned int) obj->reloc_base_addr);
|
||||
printf("Object #%u:\n", (uint) i+1);
|
||||
printf("Virtual size: %u\n", (uint) obj->virtual_size);
|
||||
printf("Relocation base address: 0x%X\n", (uint) obj->reloc_base_addr);
|
||||
printf("Object flags:");
|
||||
if (obj->object_flags & 0x1) printf(" READ");
|
||||
if (obj->object_flags & 0x2) printf(" WRITE");
|
||||
@@ -155,18 +155,18 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
if (obj->object_flags & 0x4000) printf(" CONFORM");
|
||||
if (obj->object_flags & 0x8000) printf(" IOPL");
|
||||
printf("\n");
|
||||
printf("Page table index: %u\n", (unsigned int) obj->page_table_index);
|
||||
printf("Number of page table entries: %u\n", (unsigned int) obj->num_page_table_entries);
|
||||
printf("System-reserved field: %u\n", (unsigned int) obj->reserved);
|
||||
printf("Page table index: %u\n", (uint) obj->page_table_index);
|
||||
printf("Number of page table entries: %u\n", (uint) obj->num_page_table_entries);
|
||||
printf("System-reserved field: %u\n", (uint) obj->reserved);
|
||||
|
||||
printf("Object pages:\n");
|
||||
const LxObjectPageTableEntry *objpage = ((const LxObjectPageTableEntry *) (exe + lx->object_page_table_offset)) + (obj->page_table_index - 1);
|
||||
const uint32 *fixuppage = (((const uint32 *) (exe + lx->fixup_page_table_offset)) + (obj->page_table_index - 1));
|
||||
for (uint32 i = 0; i < obj->num_page_table_entries; i++, objpage++, fixuppage++) {
|
||||
printf("Object Page #%u:\n", (unsigned int) (i + obj->page_table_index));
|
||||
printf("Page data offset: 0x%X\n", (unsigned int) objpage->page_data_offset);
|
||||
printf("Page data size: %u\n", (unsigned int) objpage->data_size);
|
||||
printf("Page flags: (%u)", (unsigned int) objpage->flags);
|
||||
printf("Object Page #%u:\n", (uint) (i + obj->page_table_index));
|
||||
printf("Page data offset: 0x%X\n", (uint) objpage->page_data_offset);
|
||||
printf("Page data size: %u\n", (uint) objpage->data_size);
|
||||
printf("Page flags: (%u)", (uint) objpage->flags);
|
||||
if (objpage->flags == 0x0) printf(" PHYSICAL");
|
||||
else if (objpage->flags == 0x1) printf(" ITERATED");
|
||||
else if (objpage->flags == 0x2) printf(" INVALID");
|
||||
@@ -177,13 +177,13 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
printf("\n");
|
||||
const uint32 fixupoffset = *fixuppage;
|
||||
const uint32 fixuplen = fixuppage[1] - fixuppage[0];
|
||||
printf("Page's fixup record offset: %u\n", (unsigned int) fixupoffset);
|
||||
printf("Page's fixup record size: %u\n", (unsigned int) fixuplen);
|
||||
printf("Page's fixup record offset: %u\n", (uint) fixupoffset);
|
||||
printf("Page's fixup record size: %u\n", (uint) fixuplen);
|
||||
printf("Fixup records:\n");
|
||||
const uint8 *fixup = (exe + lx->fixup_record_table_offset) + fixupoffset;
|
||||
const uint8 *fixupend = fixup + fixuplen;
|
||||
for (uint32 i = 0; fixup < fixupend; i++) {
|
||||
printf("Fixup Record #%u:\n", (unsigned int) (i + 1));
|
||||
printf("Fixup Record #%u:\n", (uint) (i + 1));
|
||||
printf("Source type: ");
|
||||
const uint8 srctype = *(fixup++);
|
||||
if (srctype & 0x10) printf("[FIXUPTOALIAS] ");
|
||||
@@ -220,7 +220,7 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
uint8 srclist_count = 0;
|
||||
if (srctype & 0x20) { // source list
|
||||
srclist_count = *(fixup++);
|
||||
printf("Source offset list count: %u\n", (unsigned int) srclist_count);
|
||||
printf("Source offset list count: %u\n", (uint) srclist_count);
|
||||
} else {
|
||||
const sint16 srcoffset = *((sint16 *) fixup); fixup += 2;
|
||||
printf("Source offset: %d\n", (int) srcoffset);
|
||||
@@ -232,10 +232,10 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
printf("Internal fixup record:\n");
|
||||
if (fixupflags & 0x40) { // 16 bit value
|
||||
const uint16 val = *((uint16 *) fixup); fixup += 2;
|
||||
printf("Object: %u\n", (unsigned int) val);
|
||||
printf("Object: %u\n", (uint) val);
|
||||
} else {
|
||||
const uint8 val = *(fixup++);
|
||||
printf("Object: %u\n", (unsigned int) val);
|
||||
printf("Object: %u\n", (uint) val);
|
||||
} // else
|
||||
|
||||
printf("Target offset: ");
|
||||
@@ -243,10 +243,10 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
printf("[not used for 16-bit selector fixups]\n");
|
||||
} else if (fixupflags & 0x10) { // 32-bit target offset
|
||||
const uint32 val = *((uint32 *) fixup); fixup += 4;
|
||||
printf("%u\n", (unsigned int) val);
|
||||
printf("%u\n", (uint) val);
|
||||
} else { // 16-bit target offset
|
||||
const uint16 val = *((uint16 *) fixup); fixup += 2;
|
||||
printf("%u\n", (unsigned int) val);
|
||||
printf("%u\n", (uint) val);
|
||||
} // else
|
||||
break;
|
||||
|
||||
@@ -254,21 +254,21 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
printf("Import by ordinal fixup record:\n");
|
||||
if (fixupflags & 0x40) { // 16 bit value
|
||||
const uint16 val = *((uint16 *) fixup); fixup += 2;
|
||||
printf("Module ordinal: %u\n", (unsigned int) val);
|
||||
printf("Module ordinal: %u\n", (uint) val);
|
||||
} else {
|
||||
const uint8 val = *(fixup++);
|
||||
printf("Module ordinal: %u\n", (unsigned int) val);
|
||||
printf("Module ordinal: %u\n", (uint) val);
|
||||
} // else
|
||||
|
||||
if (fixupflags & 0x80) { // 8 bit value
|
||||
const uint8 val = *(fixup++);
|
||||
printf("Import ordinal: %u\n", (unsigned int) val);
|
||||
printf("Import ordinal: %u\n", (uint) val);
|
||||
} else if (fixupflags & 0x10) { // 32-bit value
|
||||
const uint32 val = *((uint32 *) fixup); fixup += 4;
|
||||
printf("Import ordinal: %u\n", (unsigned int) val);
|
||||
printf("Import ordinal: %u\n", (uint) val);
|
||||
} else { // 16-bit value
|
||||
const uint16 val = *((uint16 *) fixup); fixup += 2;
|
||||
printf("Import ordinal: %u\n", (unsigned int) val);
|
||||
printf("Import ordinal: %u\n", (uint) val);
|
||||
} // else
|
||||
|
||||
uint32 additive = 0;
|
||||
@@ -281,7 +281,7 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
fixup += 2;
|
||||
} // else
|
||||
} // if
|
||||
printf("Additive: %u\n", (unsigned int) additive);
|
||||
printf("Additive: %u\n", (uint) additive);
|
||||
break;
|
||||
|
||||
case 0x2:
|
||||
@@ -311,15 +311,15 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
} // for
|
||||
|
||||
printf("\n");
|
||||
printf("Resource table (%u entries):\n", (unsigned int) lx->num_resource_table_entries);
|
||||
printf("Resource table (%u entries):\n", (uint) lx->num_resource_table_entries);
|
||||
for (uint32 i = 0; i < lx->num_resource_table_entries; i++) {
|
||||
const LxResourceTableEntry *rsrc = ((const LxResourceTableEntry *) (exe + lx->resource_table_offset)) + i;
|
||||
printf("%u:\n", (unsigned int) i);
|
||||
printf("Type ID: %u\n", (unsigned int) rsrc->type_id);
|
||||
printf("Name ID: %u\n", (unsigned int) rsrc->name_id);
|
||||
printf("Resource size: %u\n", (unsigned int) rsrc->resource_size);
|
||||
printf("Object: %u\n", (unsigned int) rsrc->object);
|
||||
printf("Offset: 0x%X\n", (unsigned int) rsrc->offset);
|
||||
printf("%u:\n", (uint) i);
|
||||
printf("Type ID: %u\n", (uint) rsrc->type_id);
|
||||
printf("Name ID: %u\n", (uint) rsrc->name_id);
|
||||
printf("Resource size: %u\n", (uint) rsrc->resource_size);
|
||||
printf("Object: %u\n", (uint) rsrc->object);
|
||||
printf("Offset: 0x%X\n", (uint) rsrc->offset);
|
||||
printf("\n");
|
||||
} // for
|
||||
|
||||
@@ -334,7 +334,7 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
const uint8 bundletype = (*entryptr) & ~0x80;
|
||||
const uint8 paramtypes = (*(entryptr++) & 0x80) ? 1 : 0;
|
||||
|
||||
printf("Bundle %d (%u entries): ", bundleid, (unsigned int) numentries);
|
||||
printf("Bundle %d (%u entries): ", bundleid, (uint) numentries);
|
||||
bundleid++;
|
||||
|
||||
if (paramtypes)
|
||||
@@ -343,85 +343,85 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
switch (bundletype) {
|
||||
case 0x00:
|
||||
printf("UNUSED\n");
|
||||
printf(" %u unused entries.\n\n", (unsigned int) numentries);
|
||||
printf(" %u unused entries.\n\n", (uint) numentries);
|
||||
ordinal += numentries;
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
printf("16BIT\n");
|
||||
printf(" Object number: %u\n", (unsigned int) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
printf(" Object number: %u\n", (uint) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
for (uint8 i = 0; i < numentries; i++) {
|
||||
printf(" %d:\n", ordinal++);
|
||||
printf(" Flags:");
|
||||
if (*entryptr & 0x1) printf(" EXPORTED");
|
||||
printf("\n");
|
||||
printf(" Parameter word count: %u\n", (unsigned int) ((*entryptr & 0xF8) >> 3)); entryptr++;
|
||||
printf(" Offset: %u\n", (unsigned int) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
printf(" Parameter word count: %u\n", (uint) ((*entryptr & 0xF8) >> 3)); entryptr++;
|
||||
printf(" Offset: %u\n", (uint) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
printf("\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
printf("286CALLGATE\n");
|
||||
printf(" Object number: %u\n", (unsigned int) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
printf(" Object number: %u\n", (uint) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
for (uint8 i = 0; i < numentries; i++) {
|
||||
printf(" %d:\n", ordinal++);
|
||||
printf(" Flags:");
|
||||
if (*entryptr & 0x1) printf(" EXPORTED");
|
||||
printf("\n");
|
||||
printf(" Parameter word count: %u\n", (unsigned int) ((*entryptr & 0xF8) >> 3)); entryptr++;
|
||||
printf(" Offset: %u\n", (unsigned int) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
printf(" Callgate selector: %u\n", (unsigned int) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
printf(" Parameter word count: %u\n", (uint) ((*entryptr & 0xF8) >> 3)); entryptr++;
|
||||
printf(" Offset: %u\n", (uint) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
printf(" Callgate selector: %u\n", (uint) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
printf("\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x03: printf("32BIT\n");
|
||||
printf(" Object number: %u\n", (unsigned int) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
printf(" Object number: %u\n", (uint) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
for (uint8 i = 0; i < numentries; i++) {
|
||||
printf(" %d:\n", ordinal++);
|
||||
printf(" Flags:");
|
||||
if (*entryptr & 0x1) printf(" EXPORTED");
|
||||
printf("\n");
|
||||
printf(" Parameter word count: %u\n", (unsigned int) ((*entryptr & 0xF8) >> 3)); entryptr++;
|
||||
printf(" Offset: %u\n", (unsigned int) *((const uint32 *) entryptr)); entryptr += 4;
|
||||
printf(" Parameter word count: %u\n", (uint) ((*entryptr & 0xF8) >> 3)); entryptr++;
|
||||
printf(" Offset: %u\n", (uint) *((const uint32 *) entryptr)); entryptr += 4;
|
||||
printf("\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x04: printf("FORWARDER\n"); break;
|
||||
printf(" Reserved field: %u\n", (unsigned int) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
printf(" Reserved field: %u\n", (uint) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
for (uint8 i = 0; i < numentries; i++) {
|
||||
printf(" %d:\n", ordinal++);
|
||||
printf(" Flags:");
|
||||
const int isordinal = (*entryptr & 0x1);
|
||||
if (isordinal) printf(" IMPORTBYORDINAL");
|
||||
printf("\n");
|
||||
printf(" Reserved for future use: %u\n", (unsigned int) ((*entryptr & 0xF8) >> 3)); entryptr++;
|
||||
printf(" Module ordinal number: %u\n", (unsigned int) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
printf(" Reserved for future use: %u\n", (uint) ((*entryptr & 0xF8) >> 3)); entryptr++;
|
||||
printf(" Module ordinal number: %u\n", (uint) *((const uint16 *) entryptr)); entryptr += 2;
|
||||
if (isordinal) {
|
||||
printf(" Import ordinal number: %u\n", (unsigned int) *((const uint32 *) entryptr)); entryptr += 4;
|
||||
printf(" Import ordinal number: %u\n", (uint) *((const uint32 *) entryptr)); entryptr += 4;
|
||||
} else {
|
||||
printf(" Import name offset: %u\n", (unsigned int) *((const uint32 *) entryptr)); entryptr += 4;
|
||||
printf(" Import name offset: %u\n", (uint) *((const uint32 *) entryptr)); entryptr += 4;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("UNKNOWN (%u)\n\n", (unsigned int) bundletype);
|
||||
printf("UNKNOWN (%u)\n\n", (uint) bundletype);
|
||||
break; // !!! FIXME: what to do?
|
||||
} // switch
|
||||
} // while
|
||||
printf("\n");
|
||||
|
||||
printf("Module directives (%u entries):\n", (unsigned int) lx->num_module_directives);
|
||||
printf("Module directives (%u entries):\n", (uint) lx->num_module_directives);
|
||||
const uint8 *dirptr = exe + lx->module_directives_offset;
|
||||
for (uint32 i = 0; i < lx->num_module_directives; i++) {
|
||||
printf("%u:\n", (unsigned int) i+1);
|
||||
printf("Directive ID: %u\n", (unsigned int) *((const uint16 *) dirptr)); dirptr += 2;
|
||||
printf("Data size: %u\n", (unsigned int) *((const uint16 *) dirptr)); dirptr += 2;
|
||||
printf("Data offset: %u\n", (unsigned int) *((const uint32 *) dirptr)); dirptr += 4;
|
||||
printf("%u:\n", (uint) i+1);
|
||||
printf("Directive ID: %u\n", (uint) *((const uint16 *) dirptr)); dirptr += 2;
|
||||
printf("Data size: %u\n", (uint) *((const uint16 *) dirptr)); dirptr += 2;
|
||||
printf("Data offset: %u\n", (uint) *((const uint32 *) dirptr)); dirptr += 4;
|
||||
printf("\n");
|
||||
// !!! FIXME: verify record directive table, etc, based on Directive ID
|
||||
}
|
||||
@@ -435,7 +435,7 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
printf("\n");
|
||||
|
||||
|
||||
printf("Import modules (%u entries):\n", (unsigned int) lx->num_import_mod_entries);
|
||||
printf("Import modules (%u entries):\n", (uint) lx->num_import_mod_entries);
|
||||
const uint8 *import_modules_table = exe + lx->import_module_table_offset;
|
||||
for (uint32 i = 0; i < lx->num_import_mod_entries; i++) {
|
||||
char name[128];
|
||||
@@ -444,7 +444,7 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
memcpy(name, import_modules_table, namelen);
|
||||
import_modules_table += namelen;
|
||||
name[namelen] = '\0';
|
||||
printf("%u: %s\n", (unsigned int) i+1, name);
|
||||
printf("%u: %s\n", (uint) i+1, name);
|
||||
}
|
||||
|
||||
const uint8 *name_table;
|
||||
@@ -458,7 +458,7 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
name[namelen] = '\0';
|
||||
name_table += namelen;
|
||||
const uint16 ordinal = *((const uint16 *) name_table); name_table += 2;
|
||||
printf("%u: '%s' (ordinal %u)\n", (unsigned int) i, name, (unsigned int) ordinal);
|
||||
printf("%u: '%s' (ordinal %u)\n", (uint) i, name, (uint) ordinal);
|
||||
} // for
|
||||
|
||||
printf("Non-resident name table:\n");
|
||||
@@ -471,7 +471,7 @@ static void parseExe(const char *exefname, uint8 *exe, uint32 exelen)
|
||||
name[namelen] = '\0';
|
||||
name_table += namelen;
|
||||
const uint16 ordinal = *((const uint16 *) name_table); name_table += 2;
|
||||
printf("%u: '%s' (ordinal %u)\n", (unsigned int) i, name, (unsigned int) ordinal);
|
||||
printf("%u: '%s' (ordinal %u)\n", (uint) i, name, (uint) ordinal);
|
||||
} // for
|
||||
|
||||
#if 0
|
||||
|
||||
+29
-25
@@ -24,7 +24,7 @@ static int sanityCheckLxModule(uint8 **_exe, uint32 *_exelen)
|
||||
return 0;
|
||||
}
|
||||
const uint32 header_offset = *((uint32 *) (*_exe + 0x3C));
|
||||
//printf("header offset is %u\n", (unsigned int) header_offset);
|
||||
//printf("header offset is %u\n", (uint) header_offset);
|
||||
if ((header_offset + sizeof (LxHeader)) >= *_exelen) {
|
||||
fprintf(stderr, "not an OS/2 LX module\n");
|
||||
return 0;
|
||||
@@ -46,22 +46,22 @@ static int sanityCheckLxModule(uint8 **_exe, uint32 *_exelen)
|
||||
}
|
||||
|
||||
if (lx->lx_version != 0) {
|
||||
fprintf(stderr, "Program is unknown LX module version (%u)\n", (unsigned int) lx->lx_version);
|
||||
fprintf(stderr, "Program is unknown LX module version (%u)\n", (uint) lx->lx_version);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lx->cpu_type > 3) { // 1==286, 2==386, 3==486
|
||||
fprintf(stderr, "Program needs unknown CPU type (%u)\n", (unsigned int) lx->cpu_type);
|
||||
fprintf(stderr, "Program needs unknown CPU type (%u)\n", (uint) lx->cpu_type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lx->os_type != 1) { // 1==OS/2, others: dos4, windows, win386, unknown.
|
||||
fprintf(stderr, "Program needs unknown OS type (%u)\n", (unsigned int) lx->os_type);
|
||||
fprintf(stderr, "Program needs unknown OS type (%u)\n", (uint) lx->os_type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lx->page_size != 4096) {
|
||||
fprintf(stderr, "Program page size isn't 4096 (%u)\n", (unsigned int) lx->page_size);
|
||||
fprintf(stderr, "Program page size isn't 4096 (%u)\n", (uint) lx->page_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ static __attribute__((noreturn)) void runLxModule(LxModule *lxmod, const int arg
|
||||
lxmod->cmd = cmd;
|
||||
|
||||
// ...and you pass it the pointer to argv0. This is (at least as far as the docs suggest) appended to the environment table.
|
||||
printf("jumping into LX land...! eip=0x%X esp=0x%X\n", (unsigned int) lxmod->eip, (unsigned int) lxmod->esp); fflush(stdout);
|
||||
printf("jumping into LX land...! eip=0x%X esp=0x%X\n", (uint) lxmod->eip, (uint) lxmod->esp); fflush(stdout);
|
||||
|
||||
// !!! FIXME: need to set up OS/2 TIB and put it in FS register.
|
||||
__asm__ __volatile__ (
|
||||
@@ -344,7 +344,7 @@ static __attribute__((noreturn)) void runLxModule(LxModule *lxmod, const int arg
|
||||
static void runLxLibraryInitOrTerm(LxModule *lxmod, const int isTermination)
|
||||
{
|
||||
// ...and you pass it the pointer to argv0. This is (at least as far as the docs suggest) appended to the environment table.
|
||||
printf("jumping into LX land to %s library...! eip=0x%X esp=0x%X\n", isTermination ? "terminate" : "initialize", (unsigned int) lxmod->eip, (unsigned int) GLoaderState->main_module->esp); fflush(stdout);
|
||||
printf("jumping into LX land to %s library...! eip=0x%X esp=0x%X\n", isTermination ? "terminate" : "initialize", (uint) lxmod->eip, (uint) GLoaderState->main_module->esp); fflush(stdout);
|
||||
|
||||
// !!! FIXME: need to set up OS/2 TIB and put it in FS register.
|
||||
__asm__ __volatile__ (
|
||||
@@ -391,7 +391,7 @@ static void freeLxModule(LxModule *lxmod)
|
||||
|
||||
// !!! FIXME: mutex from here
|
||||
lxmod->refcount--;
|
||||
printf("unref'd module '%s' to %u\n", lxmod->name, (unsigned int) lxmod->refcount);
|
||||
printf("unref'd module '%s' to %u\n", lxmod->name, (uint) lxmod->refcount);
|
||||
if (lxmod->refcount > 0)
|
||||
return; // something is still using it.
|
||||
|
||||
@@ -434,7 +434,7 @@ static LxModule *loadLxModuleByModuleNameInternal(const char *modname, const int
|
||||
|
||||
static uint32 getModuleProcAddrByOrdinal(const LxModule *module, const uint32 ordinal)
|
||||
{
|
||||
fprintf(stderr, "lookup module == '%s', ordinal == %u\n", module->name, (unsigned int) ordinal);
|
||||
printf("lookup module == '%s', ordinal == %u\n", module->name, (uint) ordinal);
|
||||
|
||||
const LxExportedOrdinal *expord = module->exported_ordinals;
|
||||
for (uint32 i = 0; i < module->num_ordinals; i++, expord++) {
|
||||
@@ -444,7 +444,7 @@ static uint32 getModuleProcAddrByOrdinal(const LxModule *module, const uint32 or
|
||||
|
||||
#if 1
|
||||
char entry[128];
|
||||
snprintf(entry, sizeof (entry), "ORDINAL_%u", (unsigned int) ordinal);
|
||||
snprintf(entry, sizeof (entry), "ORDINAL_%u", (uint) ordinal);
|
||||
return generateMissingTrampoline(module->name, entry);
|
||||
#else
|
||||
return 0;
|
||||
@@ -454,7 +454,7 @@ static uint32 getModuleProcAddrByOrdinal(const LxModule *module, const uint32 or
|
||||
#if 0
|
||||
static uint32 getModuleProcAddrByName(const LxModule *module, const char *name)
|
||||
{
|
||||
fprintf(stderr, "lookup module == '%s', name == '%s'\n", module->name, name);
|
||||
printf("lookup module == '%s', name == '%s'\n", module->name, name);
|
||||
|
||||
const LxExportedName *expname = module->exported_names;
|
||||
for (uint32 i = 0; i < module->num_names; i++, expname++) {
|
||||
@@ -474,9 +474,9 @@ static void doFixup(uint8 *page, const sint16 offset, const uint32 finalval, con
|
||||
{
|
||||
#if 1
|
||||
if (finalsize == 6) {
|
||||
printf("fixing up %p to 0x%X:0x%X (6 bytes)...\n", page + offset, (unsigned int) finalval2, (unsigned int) finalval);
|
||||
printf("fixing up %p to 0x%X:0x%X (6 bytes)...\n", page + offset, (uint) finalval2, (uint) finalval);
|
||||
} else {
|
||||
printf("fixing up %p to 0x%X (%u bytes)...\n", page + offset, (unsigned int) finalval, (unsigned int) finalsize);
|
||||
printf("fixing up %p to 0x%X (%u bytes)...\n", page + offset, (uint) finalval, (uint) finalsize);
|
||||
} // else
|
||||
fflush(stdout);
|
||||
#endif
|
||||
@@ -493,7 +493,7 @@ static void doFixup(uint8 *page, const sint16 offset, const uint32 finalval, con
|
||||
break;
|
||||
} // case
|
||||
default:
|
||||
fprintf(stderr, "BUG! Unexpected fixup final size of %u\n", (unsigned int) finalsize);
|
||||
fprintf(stderr, "BUG! Unexpected fixup final size of %u\n", (uint) finalsize);
|
||||
exit(1);
|
||||
} // switch
|
||||
} // doFixup
|
||||
@@ -501,13 +501,15 @@ static void doFixup(uint8 *page, const sint16 offset, const uint32 finalval, con
|
||||
static void fixupPage(const uint8 *exe, LxModule *lxmod, const LxObjectTableEntry *obj, const uint32 pagenum, uint8 *page)
|
||||
{
|
||||
const LxHeader *lx = &lxmod->lx;
|
||||
const LxObjectTableEntry *origobj = ((const LxObjectTableEntry *) (exe + lx->object_table_offset));
|
||||
const uint32 *fixuppage = (((const uint32 *) (exe + lx->fixup_page_table_offset)) + ((obj->page_table_index - 1) + pagenum));
|
||||
const uint32 fixupoffset = *fixuppage;
|
||||
const uint32 fixuplen = fixuppage[1] - fixuppage[0];
|
||||
const uint8 *fixup = (exe + lx->fixup_record_table_offset) + fixupoffset;
|
||||
const uint8 *fixupend = fixup + fixuplen;
|
||||
|
||||
int record = 0;
|
||||
while (fixup < fixupend) {
|
||||
record++; printf("FIXUP obj #%u page #%u record #: %d\n", (uint) (obj - origobj), (uint) pagenum, record);
|
||||
const uint8 srctype = *(fixup++);
|
||||
const uint8 fixupflags = *(fixup++);
|
||||
uint8 srclist_count = 0;
|
||||
@@ -586,7 +588,7 @@ static void fixupPage(const uint8 *exe, LxModule *lxmod, const LxObjectTableEntr
|
||||
if (moduleid == 0) {
|
||||
fprintf(stderr, "uhoh, looking for module ordinal 0, which is illegal.\n");
|
||||
} else if (moduleid > lx->num_import_mod_entries) {
|
||||
fprintf(stderr, "uhoh, looking for module ordinal %u, but only %u available.\n", (unsigned int) moduleid, (unsigned int) lx->num_import_mod_entries);
|
||||
fprintf(stderr, "uhoh, looking for module ordinal %u, but only %u available.\n", (uint) moduleid, (uint) lx->num_import_mod_entries);
|
||||
} else {
|
||||
finalval = getModuleProcAddrByOrdinal(lxmod->dependencies[moduleid-1], importid);
|
||||
} // else
|
||||
@@ -719,14 +721,16 @@ static LxModule *loadLxModule(const char *fname, uint8 *exe, uint32 exelen, int
|
||||
if ((vsize % lx->page_size) != 0)
|
||||
vsize += lx->page_size - (vsize % lx->page_size);
|
||||
|
||||
const int mmapflags = MAP_ANON | MAP_PRIVATE | (isDLL ? 0 : MAP_FIXED);
|
||||
const int mmapflags = MAP_POPULATE | MAP_ANON | MAP_PRIVATE | (isDLL ? 0 : MAP_FIXED);
|
||||
void *base = isDLL ? NULL : (void *) ((size_t) obj->reloc_base_addr);
|
||||
void *mmapaddr = mmap(base, vsize, PROT_READ|PROT_WRITE, mmapflags, -1, 0);
|
||||
// we'll mprotect() these pages to the proper permissions later.
|
||||
|
||||
printf("mmap(%p, %u, RW-, ANON|PRIVATE%s, -1, 0) == %p\n", base, (uint) vsize, isDLL ? "" : "|FIXED", mmapaddr);
|
||||
|
||||
if (mmapaddr == ((void *) MAP_FAILED)) {
|
||||
fprintf(stderr, "mmap(%p, %u, RW-, ANON|PRIVATE%s, -1, 0) failed (%d): %s\n",
|
||||
base, (unsigned int) vsize, isDLL ? "" : "|FIXED", errno, strerror(errno));
|
||||
base, (uint) vsize, isDLL ? "" : "|FIXED", errno, strerror(errno));
|
||||
goto loadlx_failed;
|
||||
} // if
|
||||
|
||||
@@ -769,7 +773,7 @@ static LxModule *loadLxModule(const char *fname, uint8 *exe, uint32 exelen, int
|
||||
|
||||
case 0x08: // !!! FIXME: this is listed in lxlite, presumably this is exepack3 or something. Maybe this was new to Warp4, like exepack2 was new to Warp3. Pull this algorithm in from lxlite later.
|
||||
default:
|
||||
fprintf(stderr, "Don't know how to load an object page of type %u!\n", (unsigned int) objpage->flags);
|
||||
fprintf(stderr, "Don't know how to load an object page of type %u!\n", (uint) objpage->flags);
|
||||
goto loadlx_failed;
|
||||
} // switch
|
||||
|
||||
@@ -864,7 +868,7 @@ static LxModule *loadLxModule(const char *fname, uint8 *exe, uint32 exelen, int
|
||||
goto loadlx_failed;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "UNKNOWN ENTRY TYPE (%u)\n\n", (unsigned int) bundletype);
|
||||
fprintf(stderr, "UNKNOWN ENTRY TYPE (%u)\n\n", (uint) bundletype);
|
||||
goto loadlx_failed;
|
||||
} // switch
|
||||
} // while
|
||||
@@ -879,7 +883,7 @@ static LxModule *loadLxModule(const char *fname, uint8 *exe, uint32 exelen, int
|
||||
for (uint32 i = 0; i < lx->num_import_mod_entries; i++) {
|
||||
const uint8 namelen = *(import_modules_table++);
|
||||
if (namelen > 127) {
|
||||
fprintf(stderr, "Import module %u name is > 127 chars (%u). Corrupt file or bug!\n", (unsigned int) (i + 1), (unsigned int) namelen);
|
||||
fprintf(stderr, "Import module %u name is > 127 chars (%u). Corrupt file or bug!\n", (uint) (i + 1), (uint) namelen);
|
||||
goto loadlx_failed;
|
||||
}
|
||||
char name[128];
|
||||
@@ -921,7 +925,7 @@ static LxModule *loadLxModule(const char *fname, uint8 *exe, uint32 exelen, int
|
||||
|
||||
if (mprotect(retval->mmaps[i].addr, retval->mmaps[i].size, prot) == -1) {
|
||||
fprintf(stderr, "mprotect(%p, %u, %s%s%s, ANON|PRIVATE|FIXED, -1, 0) failed (%d): %s\n",
|
||||
retval->mmaps[i].addr, (unsigned int) retval->mmaps[i].size,
|
||||
retval->mmaps[i].addr, (uint) retval->mmaps[i].size,
|
||||
(prot&PROT_READ) ? "R" : "-",
|
||||
(prot&PROT_WRITE) ? "W" : "-",
|
||||
(prot&PROT_EXEC) ? "X" : "-",
|
||||
@@ -1023,7 +1027,7 @@ static LxModule *loadNativeReplacement(const char *fname)
|
||||
if (!retval)
|
||||
goto loadnative_failed;
|
||||
|
||||
printf("Loaded native replacement library '%s' (%u exports).\n", fname, (unsigned int) retval->num_ordinals);
|
||||
printf("Loaded native replacement library '%s' (%u exports).\n", fname, (uint) retval->num_ordinals);
|
||||
retval->nativelib = lib;
|
||||
retval->os2path = os2path;
|
||||
|
||||
@@ -1041,7 +1045,7 @@ static LxModule *loadLxModuleByModuleNameInternal(const char *modname, const int
|
||||
for (LxModule *i = GLoaderState->loaded_modules; i != NULL; i = i->next) {
|
||||
if (strcasecmp(i->name, modname) == 0) {
|
||||
i->refcount++;
|
||||
printf("ref'd module '%s' to %u\n", i->name, (unsigned int) i->refcount);
|
||||
printf("ref'd module '%s' to %u\n", i->name, (uint) i->refcount);
|
||||
return i;
|
||||
} // if
|
||||
} // for
|
||||
@@ -1072,7 +1076,7 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
const LxModule *lxmod = loadLxModuleByPath(argv[1]);
|
||||
LxModule *lxmod = loadLxModuleByPath(argv[1]);
|
||||
if (lxmod) {
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
@@ -16,6 +16,8 @@ typedef int8_t sint8;
|
||||
typedef int16_t sint16;
|
||||
typedef int32_t sint32;
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
typedef struct LxHeader
|
||||
{
|
||||
|
||||
+70
-122
@@ -1,89 +1,29 @@
|
||||
#define _POSIX_C_SOURCE 199309
|
||||
#include "native.h"
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "os2native.h"
|
||||
#include "doscalls.h"
|
||||
|
||||
NATIVE_MODULE(doscalls);
|
||||
|
||||
typedef LxModule *HMODULE;
|
||||
typedef uint32 HFILE;
|
||||
typedef uint32 HEV;
|
||||
typedef uint32 HMTX;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
QSV_MAX_PATH_LENGTH = 1,
|
||||
QSV_MAX_TEXT_SESSIONS,
|
||||
QSV_MAX_PM_SESSIONS,
|
||||
QSV_MAX_VDM_SESSIONS,
|
||||
QSV_BOOT_DRIVE,
|
||||
QSV_DYN_PRI_VARIATION,
|
||||
QSV_MAX_WAIT,
|
||||
QSV_MIN_SLICE,
|
||||
QSV_MAX_SLICE,
|
||||
QSV_PAGE_SIZE,
|
||||
QSV_VERSION_MAJOR,
|
||||
QSV_VERSION_MINOR,
|
||||
QSV_VERSION_REVISION,
|
||||
QSV_MS_COUNT,
|
||||
QSV_TIME_LOW,
|
||||
QSV_TIME_HIGH,
|
||||
QSV_TOTPHYSMEM,
|
||||
QSV_TOTRESMEM,
|
||||
QSV_TOTAVAILMEM,
|
||||
QSV_MAXPRMEM,
|
||||
QSV_MAXSHMEM,
|
||||
QSV_TIMER_INTERVAL,
|
||||
QSV_MAX_COMP_LENGTH,
|
||||
QSV_FOREGROUND_FS_SESSION,
|
||||
QSV_FOREGROUND_PROCESS
|
||||
} QuerySysInfoVariable;
|
||||
|
||||
typedef struct TIB2
|
||||
{
|
||||
uint32 tib2_ultid;
|
||||
uint32 tib2_ulpri;
|
||||
uint32 tib2_version;
|
||||
uint16 tib2_usMCCount;
|
||||
uint16 tib2_fMCForceFlag;
|
||||
} TIB2;
|
||||
|
||||
typedef struct TIB
|
||||
{
|
||||
void *tib_pexchain;
|
||||
void *tib_pstack;
|
||||
void *tib_pstacklimit;
|
||||
TIB2 *tib_ptib2;
|
||||
uint32 tib_version;
|
||||
uint32 tib_ordinal;
|
||||
} TIB;
|
||||
|
||||
typedef struct PIB
|
||||
{
|
||||
uint32 pib_ulpid;
|
||||
uint32 pib_ulppid;
|
||||
HMODULE pib_hmte;
|
||||
char *pib_pchcmd;
|
||||
char *pib_pchenv;
|
||||
uint32 pib_flstatus;
|
||||
uint32 pib_ultype;
|
||||
} PIB;
|
||||
|
||||
typedef void(*ExitListFn)(uint32 why);
|
||||
|
||||
typedef struct ExitListItem
|
||||
{
|
||||
ExitListFn fn;
|
||||
PFNEXITLIST fn;
|
||||
uint32 priority;
|
||||
struct ExitListItem *next;
|
||||
} ExitListItem;
|
||||
|
||||
static ExitListItem *GExitList = NULL;
|
||||
|
||||
static APIRET DosGetInfoBlocks(TIB **pptib, PIB **pppib)
|
||||
APIRET DosGetInfoBlocks(PTIB *pptib, PPIB *pppib)
|
||||
{
|
||||
printf("DosGetInfoBlocks\n");
|
||||
TRACE_NATIVE("DosGetInfoBlocks(%p, %p)", pptib, pppib);
|
||||
|
||||
// !!! FIXME: this is seriously incomplete.
|
||||
if (pptib != NULL) {
|
||||
static __thread TIB tib;
|
||||
@@ -113,12 +53,13 @@ printf("DosGetInfoBlocks\n");
|
||||
return 0;
|
||||
} // DosGetInfoBlocks
|
||||
|
||||
static APIRET DosQuerySysInfo(uint32 first, uint32 last, void *_buf, uint32 buflen)
|
||||
APIRET DosQuerySysInfo(ULONG first, ULONG last, PVOID _buf, ULONG buflen)
|
||||
{
|
||||
TRACE_NATIVE("DosQuerySysInfo(%u, %u, %p, %u)", (uint) first, (uint) last, _buf, (uint) buflen);
|
||||
|
||||
uint32 *buf = (uint32 *) _buf;
|
||||
printf("DosQuerySysInfo(%u, %u, %p, %u);\n", (unsigned int) first, (unsigned int) last, buf, (unsigned int) buflen);
|
||||
if (last < first) return 87; // ERROR_INVALID_PARAMETER
|
||||
if ( (buflen / sizeof (uint32)) < ((last - first) + 1) ) return 111; // ERROR_BUFFER_OVERFLOW
|
||||
if (last < first) return ERROR_INVALID_PARAMETER;
|
||||
if ( (buflen / sizeof (uint32)) < ((last - first) + 1) ) return ERROR_BUFFER_OVERFLOW;
|
||||
for (uint32 varid = first; varid <= last; varid++) {
|
||||
switch (varid) {
|
||||
case QSV_MAX_PATH_LENGTH: *(buf++) = PATH_MAX; break;
|
||||
@@ -131,6 +72,7 @@ printf("DosQuerySysInfo(%u, %u, %p, %u);\n", (unsigned int) first, (unsigned int
|
||||
case QSV_MIN_SLICE: *(buf++) = 1; break;
|
||||
case QSV_MAX_SLICE: *(buf++) = 10; break;
|
||||
case QSV_PAGE_SIZE: *(buf++) = 4096; break;
|
||||
// !!! FIXME: change the version number in some way so apps can know this isn't actually OS/2.
|
||||
case QSV_VERSION_MAJOR: *(buf++) = 20; break; // OS/2 Warp 4.0
|
||||
case QSV_VERSION_MINOR: *(buf++) = 40; break; // OS/2 Warp 4.0
|
||||
case QSV_VERSION_REVISION: *(buf++) = 0; break; // OS/2 Warp 4.0
|
||||
@@ -183,52 +125,55 @@ printf("DosQuerySysInfo(%u, %u, %p, %u);\n", (unsigned int) first, (unsigned int
|
||||
case QSV_FOREGROUND_FS_SESSION: *(buf++) = 1; break; // !!! FIXME
|
||||
case QSV_FOREGROUND_PROCESS: *(buf++) = 1; break; // !!! FIXME
|
||||
|
||||
default: return 87; // ERROR_INVALID_PARAMETER
|
||||
default: return ERROR_INVALID_PARAMETER;
|
||||
} // switch
|
||||
} // for
|
||||
|
||||
return 0; // NO_ERROR
|
||||
return NO_ERROR;
|
||||
} // DosQuerySysInfo
|
||||
|
||||
|
||||
static APIRET DosQueryModuleName(HMODULE hmod, uint32 buflen, char *buf)
|
||||
APIRET DosQueryModuleName(HMODULE hmod, ULONG buflen, PCHAR buf)
|
||||
{
|
||||
TRACE_NATIVE("DosQueryModuleName(%u, %u, %p)", (uint) hmod, (uint) buflen, buf);
|
||||
|
||||
const LxModule *lxmod = (LxModule *) hmod;
|
||||
printf("DosQueryModuleName ('%s')\n", lxmod->os2path);
|
||||
// !!! FIXME: error 6 ERROR_INVALID_HANDLE
|
||||
if (strlen(lxmod->os2path) <= buflen)
|
||||
return 24; // ERROR_BAD_LENGTH
|
||||
return ERROR_BAD_LENGTH;
|
||||
strcpy(buf, lxmod->os2path);
|
||||
return 0; // NO_ERROR
|
||||
return NO_ERROR;
|
||||
} // DosQueryModuleName
|
||||
|
||||
static APIRET DosScanEnv(char *name, char **outval)
|
||||
|
||||
APIRET DosScanEnv(PSZ name, PSZ *outval)
|
||||
{
|
||||
printf("DosScanEnv('%s')\n", name);
|
||||
TRACE_NATIVE("DosScanEnv('%s', %p)", name, outval);
|
||||
|
||||
char *env = GLoaderState->main_module->env;
|
||||
const size_t len = strlen(name);
|
||||
while (*env) {
|
||||
if ((strncmp(env, name, len) == 0) && (env[len] == '=')) {
|
||||
*outval = env + len + 1;
|
||||
return 0; // NO_ERROR
|
||||
return NO_ERROR;
|
||||
} // if
|
||||
env += strlen(env) + 1;
|
||||
} // while
|
||||
|
||||
return 203; // ERROR_ENVVAR_NOT_FOUND
|
||||
return ERROR_ENVVAR_NOT_FOUND;
|
||||
} // DosScanEnv
|
||||
|
||||
static APIRET DosWrite(HFILE h, void *buf, uint32 buflen, uint32 *actual)
|
||||
APIRET DosWrite(HFILE h, PVOID buf, ULONG buflen, PULONG actual)
|
||||
{
|
||||
TRACE_NATIVE("DosWrite(%u, %p, %u, %p)", (uint) h, buf, (uint) buflen, actual);
|
||||
// !!! FIXME: writing to a terminal should convert CR/LF to LF.
|
||||
printf("DosWrite(%u, %p, %u, %p)\n", (unsigned int) h, buf, (unsigned int) buflen, actual);
|
||||
// OS/2 appears to use 0, 1, 2 for stdin, stdout, stderr, like Unix! Hooray!
|
||||
const int rc = write((int) h, buf, buflen);
|
||||
if (rc < 0)
|
||||
return 112; // ERROR_DISK_FULL !!! FIXME: map these errors.
|
||||
return ERROR_DISK_FULL; // !!! FIXME: map these errors.
|
||||
|
||||
*actual = (uint32) rc;
|
||||
return 0; // NO_ERROR
|
||||
return NO_ERROR;
|
||||
} // DosWrite
|
||||
|
||||
static void runDosExitList(const uint32 why)
|
||||
@@ -237,7 +182,7 @@ static void runDosExitList(const uint32 why)
|
||||
for (ExitListItem *item = GExitList; item; item = next) {
|
||||
// don't run any of these more than once:
|
||||
// http://www.verycomputer.com/3_c1f6e02c06ed108e_1.htm
|
||||
ExitListFn fn = item->fn;
|
||||
PFNEXITLIST fn = item->fn;
|
||||
next = item->next;
|
||||
GExitList = next;
|
||||
free(item);
|
||||
@@ -245,18 +190,19 @@ static void runDosExitList(const uint32 why)
|
||||
} // for
|
||||
} // runDosExitList
|
||||
|
||||
static void DosExit(uint32 action, uint32 exitcode)
|
||||
VOID DosExit(ULONG action, ULONG exitcode)
|
||||
{
|
||||
printf("DosExit(%u, %u)\n", (unsigned int) action, (unsigned int) exitcode);
|
||||
TRACE_NATIVE("DosExit(%u, %u)", (uint) action, (uint) exitcode);
|
||||
|
||||
// !!! FIXME: what does a value other than 0 or 1 do here?
|
||||
if (action == 0) { // EXIT_THREAD
|
||||
if (action == EXIT_THREAD) {
|
||||
// !!! FIXME: terminate thread. If last thread: terminate process.
|
||||
fprintf(stderr, "FIXME: DosExit(0) should terminate thread, not process.\n");
|
||||
fflush(stderr);
|
||||
} // if
|
||||
|
||||
// terminate the process.
|
||||
runDosExitList(0); // 0 == TC_EXIT
|
||||
runDosExitList(TC_EXIT);
|
||||
|
||||
// !!! FIXME: finalize OS/2 DLLs before killing the process?
|
||||
|
||||
@@ -266,11 +212,12 @@ printf("DosExit(%u, %u)\n", (unsigned int) action, (unsigned int) exitcode);
|
||||
exit((int) (exitcode & 0xFFFF));
|
||||
} // DosExit
|
||||
|
||||
static APIRET DosExitList(uint32 ordercode, ExitListFn fn)
|
||||
APIRET DosExitList(ULONG ordercode, PFNEXITLIST fn)
|
||||
{
|
||||
printf("DosExitList(%u, %p)\n", (unsigned int) ordercode, fn);
|
||||
TRACE_NATIVE("DosExitList(%u, %p)", (uint) ordercode, fn);
|
||||
|
||||
if (fn == NULL)
|
||||
return 1; // ERROR_INVALID_FUNCTION
|
||||
return ERROR_INVALID_FUNCTION;
|
||||
|
||||
const uint8 cmd = ordercode & 0xFF;
|
||||
const uint8 arg = (ordercode >> 8) & 0xFF;
|
||||
@@ -279,13 +226,13 @@ printf("DosExitList(%u, %p)\n", (unsigned int) ordercode, fn);
|
||||
|
||||
// !!! FIXME: docs say this is illegal, but have to check what OS/2 actually does here.
|
||||
if ((cmd != 1) && (arg != 0))
|
||||
return 13; // ERROR_INVALID_DATA
|
||||
return ERROR_INVALID_DATA;
|
||||
|
||||
switch (cmd) {
|
||||
case 1: { // EXLST_ADD
|
||||
case EXLST_ADD: {
|
||||
ExitListItem *newitem = (ExitListItem *) malloc(sizeof (ExitListItem));
|
||||
if (!newitem)
|
||||
return 8; // ERROR_NOT_ENOUGH_MEMORY
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
for (item = GExitList; item; item = item->next) {
|
||||
if (item->priority >= ((uint32) arg))
|
||||
break;
|
||||
@@ -298,10 +245,10 @@ printf("DosExitList(%u, %p)\n", (unsigned int) ordercode, fn);
|
||||
newitem->next = GExitList;
|
||||
GExitList = newitem;
|
||||
} // else
|
||||
return 0; // NO_ERROR
|
||||
return NO_ERROR;
|
||||
} // case
|
||||
|
||||
case 2: { // EXLST_REMOVE
|
||||
case EXLST_REMOVE: {
|
||||
for (item = GExitList; item; item = item->next) {
|
||||
if (item->fn == fn) {
|
||||
if (prev)
|
||||
@@ -309,41 +256,41 @@ printf("DosExitList(%u, %p)\n", (unsigned int) ordercode, fn);
|
||||
else
|
||||
GExitList = item->next;
|
||||
free(item);
|
||||
return 0; // NO_ERROR
|
||||
return NO_ERROR;
|
||||
} // if
|
||||
prev = item;
|
||||
} // for
|
||||
return 1; // ERROR_INVALID_FUNCTION !!! FIXME: yeah?
|
||||
return ERROR_INVALID_FUNCTION; // !!! FIXME: yeah?
|
||||
} // case
|
||||
|
||||
case 3: // EXLST_EXIT
|
||||
return 0; // NO_ERROR ... just treat this as a no-op, I guess...?
|
||||
case EXLST_EXIT:
|
||||
return NO_ERROR; // ... just treat this as a no-op, I guess...?
|
||||
|
||||
default: return 13; // ERROR_INVALID_DATA
|
||||
default: return ERROR_INVALID_DATA;
|
||||
} // switch
|
||||
|
||||
return 0; // NO_ERROR
|
||||
return NO_ERROR;
|
||||
} // DosExitList
|
||||
|
||||
static APIRET DosCreateEventSem(char *name, HEV *phev, uint32 attr, uint32 state)
|
||||
APIRET DosCreateEventSem(PSZ name, PHEV phev, ULONG attr, BOOL32 state)
|
||||
{
|
||||
printf("DosCreateEventSem('%s', %p, %u, %u);\n", name, phev, (unsigned int) attr, (unsigned int) state);
|
||||
TRACE_NATIVE("DosCreateEventSem('%s', %p, %u, %u)", name, phev, (uint) attr, (uint) state);
|
||||
// !!! FIXME: write me
|
||||
return 0; // NO_ERROR
|
||||
return NO_ERROR;
|
||||
} // DosCreateEventSem
|
||||
|
||||
static APIRET DosCreateMutexSem(char *name, HMTX *phmtx, uint32 attr, uint32 state)
|
||||
APIRET DosCreateMutexSem(PSZ name, PHMTX phmtx, ULONG attr, BOOL32 state)
|
||||
{
|
||||
printf("DosCreateMutexSem('%s', %p, %u, %u);\n", name, phmtx, (unsigned int) attr, (unsigned int) state);
|
||||
TRACE_NATIVE("DosCreateMutexSem('%s', %p, %u, %u)", name, phmtx, (uint) attr, (uint) state);
|
||||
// !!! FIXME: write me
|
||||
return 0; // NO_ERROR
|
||||
return NO_ERROR;
|
||||
} // DosCreateMutexSem
|
||||
|
||||
// !!! FIXME: this is obviously not correct.
|
||||
static APIRET DosSetExceptionHandler(void *rec)
|
||||
APIRET DosSetExceptionHandler(PEXCEPTIONREGISTRATIONRECORD rec)
|
||||
{
|
||||
printf("DosSetExceptionHandler(%p);\n", rec);
|
||||
return 0; // NO_ERROR
|
||||
TRACE_NATIVE("DosSetExceptionHandler(%p)", rec);
|
||||
return NO_ERROR;
|
||||
} // DosSetExceptionHandler
|
||||
|
||||
static uint32 DosFlatToSel(void)
|
||||
@@ -351,20 +298,21 @@ static uint32 DosFlatToSel(void)
|
||||
// this actually passes the arg in eax instead of the stack.
|
||||
uint32 eax = 0;
|
||||
__asm__ __volatile__ ("" : "=a" (eax));
|
||||
printf("DosFlatToSel(%p);\n", (void *) (size_t) eax);
|
||||
TRACE_NATIVE("DosFlatToSel(%p)", (void *) (size_t) eax);
|
||||
return 0x12345678; // !!! FIXME
|
||||
} // DosFlatToSel
|
||||
|
||||
static APIRET DosSetSignalExceptionFocus(uint32 flag, uint32 *pulTimes)
|
||||
APIRET DosSetSignalExceptionFocus(BOOL32 flag, PULONG pulTimes)
|
||||
{
|
||||
printf("DosSetSignalExceptionFocus(%u, %p);\n", (unsigned int) flag, pulTimes);
|
||||
TRACE_NATIVE("DosSetSignalExceptionFocus(%u, %p)", (uint) flag, pulTimes);
|
||||
|
||||
if (flag == 0) {
|
||||
if (GLoaderState->main_module->signal_exception_focus_count == 0)
|
||||
return 300; // ERROR_ALREADY_RESET
|
||||
return ERROR_ALREADY_RESET;
|
||||
GLoaderState->main_module->signal_exception_focus_count--;
|
||||
} else if (flag == 1) {
|
||||
if (GLoaderState->main_module->signal_exception_focus_count == 0xFFFFFFFF)
|
||||
return 650; // ERROR_NESTING_TOO_DEEP
|
||||
return ERROR_NESTING_TOO_DEEP;
|
||||
GLoaderState->main_module->signal_exception_focus_count++;
|
||||
} else {
|
||||
// !!! FIXME: does OS/2 do something if flag != 0 or 1?
|
||||
@@ -375,7 +323,7 @@ static APIRET DosSetSignalExceptionFocus(uint32 flag, uint32 *pulTimes)
|
||||
|
||||
// !!! FIXME: I guess enable/disable SIGINT handler here?
|
||||
|
||||
return 0; // NO_ERROR
|
||||
return NO_ERROR;
|
||||
} // DosSetSignalExceptionFocus
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
#ifndef _INCL_DOSCALLS_H_
|
||||
#define _INCL_DOSCALLS_H_
|
||||
|
||||
#include "os2types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
EXIT_THREAD,
|
||||
EXIT_PROCESS
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
QSV_MAX_PATH_LENGTH = 1,
|
||||
QSV_MAX_TEXT_SESSIONS,
|
||||
QSV_MAX_PM_SESSIONS,
|
||||
QSV_MAX_VDM_SESSIONS,
|
||||
QSV_BOOT_DRIVE,
|
||||
QSV_DYN_PRI_VARIATION,
|
||||
QSV_MAX_WAIT,
|
||||
QSV_MIN_SLICE,
|
||||
QSV_MAX_SLICE,
|
||||
QSV_PAGE_SIZE,
|
||||
QSV_VERSION_MAJOR,
|
||||
QSV_VERSION_MINOR,
|
||||
QSV_VERSION_REVISION,
|
||||
QSV_MS_COUNT,
|
||||
QSV_TIME_LOW,
|
||||
QSV_TIME_HIGH,
|
||||
QSV_TOTPHYSMEM,
|
||||
QSV_TOTRESMEM,
|
||||
QSV_TOTAVAILMEM,
|
||||
QSV_MAXPRMEM,
|
||||
QSV_MAXSHMEM,
|
||||
QSV_TIMER_INTERVAL,
|
||||
QSV_MAX_COMP_LENGTH,
|
||||
QSV_FOREGROUND_FS_SESSION,
|
||||
QSV_FOREGROUND_PROCESS
|
||||
};
|
||||
|
||||
typedef struct TIB2
|
||||
{
|
||||
uint32 tib2_ultid;
|
||||
uint32 tib2_ulpri;
|
||||
uint32 tib2_version;
|
||||
uint16 tib2_usMCCount;
|
||||
uint16 tib2_fMCForceFlag;
|
||||
} TIB2;
|
||||
|
||||
typedef struct TIB
|
||||
{
|
||||
void *tib_pexchain;
|
||||
void *tib_pstack;
|
||||
void *tib_pstacklimit;
|
||||
TIB2 *tib_ptib2;
|
||||
uint32 tib_version;
|
||||
uint32 tib_ordinal;
|
||||
} TIB, *PTIB;
|
||||
|
||||
typedef struct PIB
|
||||
{
|
||||
uint32 pib_ulpid;
|
||||
uint32 pib_ulppid;
|
||||
HMODULE pib_hmte;
|
||||
char *pib_pchcmd;
|
||||
char *pib_pchenv;
|
||||
uint32 pib_flstatus;
|
||||
uint32 pib_ultype;
|
||||
} PIB, *PPIB;
|
||||
|
||||
typedef VOID APIENTRY FNEXITLIST(ULONG);
|
||||
typedef FNEXITLIST *PFNEXITLIST;
|
||||
|
||||
enum
|
||||
{
|
||||
TC_EXIT,
|
||||
TC_HARDERROR,
|
||||
TC_TRAP,
|
||||
TC_KILLPROCESS,
|
||||
TC_EXCEPTION
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
EXLST_ADD = 1,
|
||||
EXLST_REMOVE,
|
||||
EXLST_EXIT
|
||||
};
|
||||
|
||||
typedef void *PEXCEPTIONREGISTRATIONRECORD; // !!! FIXME
|
||||
|
||||
// !!! FIXME: these should probably get sorted alphabetically and/or grouped
|
||||
// !!! FIXME: into areas of functionality, but for now, I'm just listing them
|
||||
// !!! FIXME: in the order I implemented them to get things running.
|
||||
|
||||
APIRET OS2API DosGetInfoBlocks(PTIB *pptib, PPIB *pppib);
|
||||
APIRET OS2API DosQuerySysInfo(ULONG iStart, ULONG iLast, PVOID pBuf, ULONG cbBuf);
|
||||
APIRET OS2API DosQueryModuleName(HMODULE hmod, ULONG cbName, PCHAR pch);
|
||||
APIRET OS2API DosScanEnv(PSZ pszName, PSZ *ppszValue);
|
||||
APIRET OS2API DosWrite(HFILE hFile, PVOID pBuffer, ULONG cbWrite, PULONG pcbActual);
|
||||
VOID OS2API DosExit(ULONG action, ULONG result);
|
||||
APIRET OS2API DosExitList(ULONG ordercode, PFNEXITLIST pfn);
|
||||
APIRET OS2API DosCreateEventSem(PSZ pszName, PHEV phev, ULONG flAttr, BOOL32 fState);
|
||||
APIRET OS2API DosCreateMutexSem(PSZ pszName, PHMTX phmtx, ULONG flAttr, BOOL32 fState);
|
||||
APIRET OS2API DosSetExceptionHandler(PEXCEPTIONREGISTRATIONRECORD pERegRec);
|
||||
APIRET OS2API DosSetSignalExceptionFocus(BOOL32 flag, PULONG pulTimes);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// end of doscalls.h ...
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
#include "native.h"
|
||||
#include "os2native.h"
|
||||
#include "kbdcalls.h"
|
||||
|
||||
NATIVE_MODULE(kdbcalls);
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef _INCL_KBDCALLS_H_
|
||||
#define _INCL_KBDCALLS_H_
|
||||
|
||||
#include "os2types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// end of kbdcalls.h ...
|
||||
|
||||
+6
-5
@@ -1,12 +1,13 @@
|
||||
#include "native.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#include "os2native.h"
|
||||
#include "msg.h"
|
||||
|
||||
NATIVE_MODULE(msg);
|
||||
|
||||
static uint32 DosPutMessage(uint32 handle, uint32 msglen, const char *msg)
|
||||
APIRET DosPutMessage(HFILE handle, ULONG msglen, PCHAR msg)
|
||||
{
|
||||
// !!! FIXME: this isn't right, but good enough for now.
|
||||
fwrite(msg, msglen, 1, stdout);
|
||||
fflush(stdout);
|
||||
write(handle, msg, msglen);
|
||||
return 0;
|
||||
} // DosPutMessage
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef _INCL_MSG_H_
|
||||
#define _INCL_MSG_H_
|
||||
|
||||
#include "os2types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
APIRET OS2API DosPutMessage(HFILE hfile, ULONG cbMsg, PCHAR pBuf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// end of msg.h ...
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
#include "native.h"
|
||||
#include "os2native.h"
|
||||
#include "nls.h"
|
||||
|
||||
NATIVE_MODULE(nls);
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef _INCL_NLS_H_
|
||||
#define _INCL_NLS_H_
|
||||
|
||||
#include "os2types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// end of nls.h ...
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef _INCL_OS2_H_
|
||||
#define _INCL_OS2_H_
|
||||
|
||||
// !!! FIXME: the official toolkit headers have all sorts of tapdancing with
|
||||
// "#ifdef INCL_DOSPROCESS" and "#define INCL_DOSINCLUDED" and stuff.
|
||||
// !!! FIXME: naturally, these filenames don't match either, but this isn't
|
||||
// !!! FIXME: meant to be a drop-in replacement. At least: not at the moment.
|
||||
|
||||
#include "os2types.h"
|
||||
#include "os2errors.h"
|
||||
#include "doscalls.h"
|
||||
#include "kbdcalls.h"
|
||||
#include "viocalls.h"
|
||||
#include "quecalls.h"
|
||||
#include "msg.h"
|
||||
#include "nls.h"
|
||||
#include "sesmgr.h"
|
||||
|
||||
#endif
|
||||
|
||||
// end of os2.h ...
|
||||
@@ -0,0 +1,692 @@
|
||||
#ifndef _INCL_OS2ERRORS_H_
|
||||
#define _INCL_OS2ERRORS_H_
|
||||
|
||||
enum
|
||||
{
|
||||
NO_ERROR = 0,
|
||||
ERROR_INVALID_FUNCTION = 1,
|
||||
ERROR_FILE_NOT_FOUND = 2,
|
||||
ERROR_PATH_NOT_FOUND = 3,
|
||||
ERROR_TOO_MANY_OPEN_FILES = 4,
|
||||
ERROR_ACCESS_DENIED = 5,
|
||||
ERROR_INVALID_HANDLE = 6,
|
||||
ERROR_ARENA_TRASHED = 7,
|
||||
ERROR_NOT_ENOUGH_MEMORY = 8,
|
||||
ERROR_INVALID_BLOCK = 9,
|
||||
ERROR_BAD_ENVIRONMENT = 10,
|
||||
ERROR_BAD_FORMAT = 11,
|
||||
ERROR_INVALID_ACCESS = 12,
|
||||
ERROR_INVALID_DATA = 13,
|
||||
ERROR_INVALID_DRIVE = 15,
|
||||
ERROR_CURRENT_DIRECTORY = 16,
|
||||
ERROR_NOT_SAME_DEVICE = 17,
|
||||
ERROR_NO_MORE_FILES = 18,
|
||||
ERROR_WRITE_PROTECT = 19,
|
||||
ERROR_BAD_UNIT = 20,
|
||||
ERROR_NOT_READY = 21,
|
||||
ERROR_BAD_COMMAND = 22,
|
||||
ERROR_CRC = 23,
|
||||
ERROR_BAD_LENGTH = 24,
|
||||
ERROR_SEEK = 25,
|
||||
ERROR_NOT_DOS_DISK = 26,
|
||||
ERROR_SECTOR_NOT_FOUND = 27,
|
||||
ERROR_OUT_OF_PAPER = 28,
|
||||
ERROR_WRITE_FAULT = 29,
|
||||
ERROR_READ_FAULT = 30,
|
||||
ERROR_GEN_FAILURE = 31,
|
||||
ERROR_SHARING_VIOLATION = 32,
|
||||
ERROR_LOCK_VIOLATION = 33,
|
||||
ERROR_WRONG_DISK = 34,
|
||||
ERROR_FCB_UNAVAILABLE = 35,
|
||||
ERROR_SHARING_BUFFER_EXCEEDED = 36,
|
||||
ERROR_CODE_PAGE_MISMATCHED = 37,
|
||||
ERROR_HANDLE_EOF = 38,
|
||||
ERROR_HANDLE_DISK_FULL = 39,
|
||||
ERROR_NOT_SUPPORTED = 50,
|
||||
ERROR_REM_NOT_LIST = 51,
|
||||
ERROR_DUP_NAME = 52,
|
||||
ERROR_BAD_NETPATH = 53,
|
||||
ERROR_NETWORK_BUSY = 54,
|
||||
ERROR_DEV_NOT_EXIST = 55,
|
||||
ERROR_TOO_MANY_CMDS = 56,
|
||||
ERROR_ADAP_HDW_ERR = 57,
|
||||
ERROR_BAD_NET_RESP = 58,
|
||||
ERROR_UNEXP_NET_ERR = 59,
|
||||
ERROR_BAD_REM_ADAP = 60,
|
||||
ERROR_PRINTQ_FULL = 61,
|
||||
ERROR_NO_SPOOL_SPACE = 62,
|
||||
ERROR_PRINT_CANCELLED = 63,
|
||||
ERROR_NETNAME_DELETED = 64,
|
||||
ERROR_NETWORK_ACCESS_DENIED = 65,
|
||||
ERROR_BAD_DEV_TYPE = 66,
|
||||
ERROR_BAD_NET_NAME = 67,
|
||||
ERROR_TOO_MANY_NAMES = 68,
|
||||
ERROR_TOO_MANY_SESS = 69,
|
||||
ERROR_SHARING_PAUSED = 70,
|
||||
ERROR_REQ_NOT_ACCEP = 71,
|
||||
ERROR_REDIR_PAUSED = 72,
|
||||
ERROR_SBCS_ATT_WRITE_PROT = 73,
|
||||
ERROR_SBCS_GENERAL_FAILURE = 74,
|
||||
ERROR_XGA_OUT_MEMORY = 75,
|
||||
ERROR_FILE_EXISTS = 80,
|
||||
ERROR_DUP_FCB = 81,
|
||||
ERROR_CANNOT_MAKE = 82,
|
||||
ERROR_FAIL_I24 = 83,
|
||||
ERROR_OUT_OF_STRUCTURES = 84,
|
||||
ERROR_ALREADY_ASSIGNED = 85,
|
||||
ERROR_INVALID_PASSWORD = 86,
|
||||
ERROR_INVALID_PARAMETER = 87,
|
||||
ERROR_NET_WRITE_FAULT = 88,
|
||||
ERROR_NO_PROC_SLOTS = 89,
|
||||
ERROR_NOT_FROZEN = 90,
|
||||
ERROR_SYS_COMP_NOT_LOADED = ERROR_NOT_FROZEN,
|
||||
ERR_TSTOVFL = 91,
|
||||
ERR_TSTDUP = 92,
|
||||
ERROR_NO_ITEMS = 93,
|
||||
ERROR_INTERRUPT = 95,
|
||||
ERROR_DEVICE_IN_USE = 99,
|
||||
ERROR_TOO_MANY_SEMAPHORES = 100,
|
||||
ERROR_EXCL_SEM_ALREADY_OWNED = 101,
|
||||
ERROR_SEM_IS_SET = 102,
|
||||
ERROR_TOO_MANY_SEM_REQUESTS = 103,
|
||||
ERROR_INVALID_AT_INTERRUPT_TIME = 104,
|
||||
ERROR_SEM_OWNER_DIED = 105,
|
||||
ERROR_SEM_USER_LIMIT = 106,
|
||||
ERROR_DISK_CHANGE = 107,
|
||||
ERROR_DRIVE_LOCKED = 108,
|
||||
ERROR_BROKEN_PIPE = 109,
|
||||
ERROR_OPEN_FAILED = 110,
|
||||
ERROR_BUFFER_OVERFLOW = 111,
|
||||
ERROR_DISK_FULL = 112,
|
||||
ERROR_NO_MORE_SEARCH_HANDLES = 113,
|
||||
ERROR_INVALID_TARGET_HANDLE = 114,
|
||||
ERROR_PROTECTION_VIOLATION = 115,
|
||||
ERROR_VIOKBD_REQUEST = 116,
|
||||
ERROR_INVALID_CATEGORY = 117,
|
||||
ERROR_INVALID_VERIFY_SWITCH = 118,
|
||||
ERROR_BAD_DRIVER_LEVEL = 119,
|
||||
ERROR_CALL_NOT_IMPLEMENTED = 120,
|
||||
ERROR_SEM_TIMEOUT = 121,
|
||||
ERROR_INSUFFICIENT_BUFFER = 122,
|
||||
ERROR_INVALID_NAME = 123,
|
||||
ERROR_INVALID_LEVEL = 124,
|
||||
ERROR_NO_VOLUME_LABEL = 125,
|
||||
ERROR_MOD_NOT_FOUND = 126,
|
||||
ERROR_PROC_NOT_FOUND = 127,
|
||||
ERROR_WAIT_NO_CHILDREN = 128,
|
||||
ERROR_CHILD_NOT_COMPLETE = 129,
|
||||
ERROR_DIRECT_ACCESS_HANDLE = 130,
|
||||
ERROR_NEGATIVE_SEEK = 131,
|
||||
ERROR_SEEK_ON_DEVICE = 132,
|
||||
ERROR_IS_JOIN_TARGET = 133,
|
||||
ERROR_IS_JOINED = 134,
|
||||
ERROR_IS_SUBSTED = 135,
|
||||
ERROR_NOT_JOINED = 136,
|
||||
ERROR_NOT_SUBSTED = 137,
|
||||
ERROR_JOIN_TO_JOIN = 138,
|
||||
ERROR_SUBST_TO_SUBST = 139,
|
||||
ERROR_JOIN_TO_SUBST = 140,
|
||||
ERROR_SUBST_TO_JOIN = 141,
|
||||
ERROR_BUSY_DRIVE = 142,
|
||||
ERROR_SAME_DRIVE = 143,
|
||||
ERROR_DIR_NOT_ROOT = 144,
|
||||
ERROR_DIR_NOT_EMPTY = 145,
|
||||
ERROR_IS_SUBST_PATH = 146,
|
||||
ERROR_IS_JOIN_PATH = 147,
|
||||
ERROR_PATH_BUSY = 148,
|
||||
ERROR_IS_SUBST_TARGET = 149,
|
||||
ERROR_SYSTEM_TRACE = 150,
|
||||
ERROR_INVALID_EVENT_COUNT = 151,
|
||||
ERROR_TOO_MANY_MUXWAITERS = 152,
|
||||
ERROR_INVALID_LIST_FORMAT = 153,
|
||||
ERROR_LABEL_TOO_LONG = 154,
|
||||
ERROR_TOO_MANY_TCBS = 155,
|
||||
ERROR_SIGNAL_REFUSED = 156,
|
||||
ERROR_DISCARDED = 157,
|
||||
ERROR_NOT_LOCKED = 158,
|
||||
ERROR_BAD_THREADID_ADDR = 159,
|
||||
ERROR_BAD_ARGUMENTS = 160,
|
||||
ERROR_BAD_PATHNAME = 161,
|
||||
ERROR_SIGNAL_PENDING = 162,
|
||||
ERROR_UNCERTAIN_MEDIA = 163,
|
||||
ERROR_MAX_THRDS_REACHED = 164,
|
||||
ERROR_MONITORS_NOT_SUPPORTED = 165,
|
||||
ERROR_UNC_DRIVER_NOT_INSTALLED = 166,
|
||||
ERROR_LOCK_FAILED = 167,
|
||||
ERROR_SWAPIO_FAILED = 168,
|
||||
ERROR_SWAPIN_FAILED = 169,
|
||||
ERROR_BUSY = 170,
|
||||
ERROR_CANCEL_VIOLATION = 173,
|
||||
ERROR_ATOMIC_LOCK_NOT_SUPPORTED = 174,
|
||||
ERROR_READ_LOCKS_NOT_SUPPORTED = 175,
|
||||
ERROR_INVALID_SEGMENT_NUMBER = 180,
|
||||
ERROR_INVALID_CALLGATE = 181,
|
||||
ERROR_INVALID_ORDINAL = 182,
|
||||
ERROR_ALREADY_EXISTS = 183,
|
||||
ERROR_NO_CHILD_PROCESS = 184,
|
||||
ERROR_CHILD_ALIVE_NOWAIT = 185,
|
||||
ERROR_INVALID_FLAG_NUMBER = 186,
|
||||
ERROR_SEM_NOT_FOUND = 187,
|
||||
ERROR_INVALID_STARTING_CODESEG = 188,
|
||||
ERROR_INVALID_STACKSEG = 189,
|
||||
ERROR_INVALID_MODULETYPE = 190,
|
||||
ERROR_INVALID_EXE_SIGNATURE = 191,
|
||||
ERROR_EXE_MARKED_INVALID = 192,
|
||||
ERROR_BAD_EXE_FORMAT = 193,
|
||||
ERROR_ITERATED_DATA_EXCEEDS_64k = 194,
|
||||
ERROR_INVALID_MINALLOCSIZE = 195,
|
||||
ERROR_DYNLINK_FROM_INVALID_RING = 196,
|
||||
ERROR_IOPL_NOT_ENABLED = 197,
|
||||
ERROR_INVALID_SEGDPL = 198,
|
||||
ERROR_AUTODATASEG_EXCEEDS_64k = 199,
|
||||
ERROR_RING2SEG_MUST_BE_MOVABLE = 200,
|
||||
ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201,
|
||||
ERROR_INFLOOP_IN_RELOC_CHAIN = 202,
|
||||
ERROR_ENVVAR_NOT_FOUND = 203,
|
||||
ERROR_NOT_CURRENT_CTRY = 204,
|
||||
ERROR_NO_SIGNAL_SENT = 205,
|
||||
ERROR_FILENAME_EXCED_RANGE = 206,
|
||||
ERROR_RING2_STACK_IN_USE = 207,
|
||||
ERROR_META_EXPANSION_TOO_LONG = 208,
|
||||
ERROR_INVALID_SIGNAL_NUMBER = 209,
|
||||
ERROR_THREAD_1_INACTIVE = 210,
|
||||
ERROR_INFO_NOT_AVAIL = 211,
|
||||
ERROR_LOCKED = 212,
|
||||
ERROR_BAD_DYNALINK = 213,
|
||||
ERROR_TOO_MANY_MODULES = 214,
|
||||
ERROR_NESTING_NOT_ALLOWED = 215,
|
||||
ERROR_CANNOT_SHRINK = 216,
|
||||
ERROR_ZOMBIE_PROCESS = 217,
|
||||
ERROR_STACK_IN_HIGH_MEMORY = 218,
|
||||
ERROR_INVALID_EXITROUTINE_RING = 219,
|
||||
ERROR_GETBUF_FAILED = 220,
|
||||
ERROR_FLUSHBUF_FAILED = 221,
|
||||
ERROR_TRANSFER_TOO_LONG = 222,
|
||||
ERROR_FORCENOSWAP_FAILED = 223,
|
||||
ERROR_SMG_NO_TARGET_WINDOW = 224,
|
||||
ERROR_NO_CHILDREN = 228,
|
||||
ERROR_INVALID_SCREEN_GROUP = 229,
|
||||
ERROR_BAD_PIPE = 230,
|
||||
ERROR_PIPE_BUSY = 231,
|
||||
ERROR_NO_DATA = 232,
|
||||
ERROR_PIPE_NOT_CONNECTED = 233,
|
||||
ERROR_MORE_DATA = 234,
|
||||
ERROR_VC_DISCONNECTED = 240,
|
||||
ERROR_CIRCULARITY_REQUESTED = 250,
|
||||
ERROR_DIRECTORY_IN_CDS = 251,
|
||||
ERROR_INVALID_FSD_NAME = 252,
|
||||
ERROR_INVALID_PATH = 253,
|
||||
ERROR_INVALID_EA_NAME = 254,
|
||||
ERROR_EA_LIST_INCONSISTENT = 255,
|
||||
ERROR_EA_LIST_TOO_LONG = 256,
|
||||
ERROR_NO_META_MATCH = 257,
|
||||
ERROR_FINDNOTIFY_TIMEOUT = 258,
|
||||
ERROR_NO_MORE_ITEMS = 259,
|
||||
ERROR_SEARCH_STRUC_REUSED = 260,
|
||||
ERROR_CHAR_NOT_FOUND = 261,
|
||||
ERROR_TOO_MUCH_STACK = 262,
|
||||
ERROR_INVALID_ATTR = 263,
|
||||
ERROR_INVALID_STARTING_RING = 264,
|
||||
ERROR_INVALID_DLL_INIT_RING = 265,
|
||||
ERROR_CANNOT_COPY = 266,
|
||||
ERROR_DIRECTORY = 267,
|
||||
ERROR_OPLOCKED_FILE = 268,
|
||||
ERROR_OPLOCK_THREAD_EXISTS = 269,
|
||||
ERROR_VOLUME_CHANGED = 270,
|
||||
ERROR_FINDNOTIFY_HANDLE_IN_USE = 271,
|
||||
ERROR_FINDNOTIFY_HANDLE_CLOSED = 272,
|
||||
ERROR_NOTIFY_OBJECT_REMOVED = 273,
|
||||
ERROR_ALREADY_SHUTDOWN = 274,
|
||||
ERROR_EAS_DIDNT_FIT = 275,
|
||||
ERROR_EA_FILE_CORRUPT = 276,
|
||||
ERROR_EA_TABLE_FULL = 277,
|
||||
ERROR_INVALID_EA_HANDLE = 278,
|
||||
ERROR_NO_CLUSTER = 279,
|
||||
ERROR_CREATE_EA_FILE = 280,
|
||||
ERROR_CANNOT_OPEN_EA_FILE = 281,
|
||||
ERROR_EAS_NOT_SUPPORTED = 282,
|
||||
ERROR_NEED_EAS_FOUND = 283,
|
||||
ERROR_DUPLICATE_HANDLE = 284,
|
||||
ERROR_DUPLICATE_NAME = 285,
|
||||
ERROR_EMPTY_MUXWAIT = 286,
|
||||
ERROR_MUTEX_OWNED = 287,
|
||||
ERROR_NOT_OWNER = 288,
|
||||
ERROR_PARAM_TOO_SMALL = 289,
|
||||
ERROR_TOO_MANY_HANDLES = 290,
|
||||
ERROR_TOO_MANY_OPENS = 291,
|
||||
ERROR_WRONG_TYPE = 292,
|
||||
ERROR_UNUSED_CODE = 293,
|
||||
ERROR_THREAD_NOT_TERMINATED = 294,
|
||||
ERROR_INIT_ROUTINE_FAILED = 295,
|
||||
ERROR_MODULE_IN_USE = 296,
|
||||
ERROR_NOT_ENOUGH_WATCHPOINTS = 297,
|
||||
ERROR_TOO_MANY_POSTS = 298,
|
||||
ERROR_ALREADY_POSTED = 299,
|
||||
ERROR_ALREADY_RESET = 300,
|
||||
ERROR_SEM_BUSY = 301,
|
||||
ERROR_USER_DEFINED_BASE = 0xFF00,
|
||||
ERROR_I24_WRITE_PROTECT = 0,
|
||||
ERROR_I24_BAD_UNIT = 1,
|
||||
ERROR_I24_NOT_READY = 2,
|
||||
ERROR_I24_BAD_COMMAND = 3,
|
||||
ERROR_I24_CRC = 4,
|
||||
ERROR_I24_BAD_LENGTH = 5,
|
||||
ERROR_I24_SEEK = 6,
|
||||
ERROR_I24_NOT_DOS_DISK = 7,
|
||||
ERROR_I24_SECTOR_NOT_FOUND = 8,
|
||||
ERROR_I24_OUT_OF_PAPER = 9,
|
||||
ERROR_I24_WRITE_FAULT = 10,
|
||||
ERROR_I24_READ_FAULT = 11,
|
||||
ERROR_I24_GEN_FAILURE = 12,
|
||||
ERROR_I24_DISK_CHANGE = 13,
|
||||
ERROR_I24_WRONG_DISK = 15,
|
||||
ERROR_I24_UNCERTAIN_MEDIA = 16,
|
||||
ERROR_I24_CHAR_CALL_INTERRUPTED = 17,
|
||||
ERROR_I24_NO_MONITOR_SUPPORT = 18,
|
||||
ERROR_I24_INVALID_PARAMETER = 19,
|
||||
ERROR_I24_DEVICE_IN_USE = 20,
|
||||
ERROR_I24_QUIET_INIT_FAIL = 21,
|
||||
ALLOWED_FAIL = 0x0001,
|
||||
ALLOWED_ABORT = 0x0002,
|
||||
ALLOWED_RETRY = 0x0004,
|
||||
ALLOWED_IGNORE = 0x0008,
|
||||
ALLOWED_ACKNOWLEDGE = 0x0010,
|
||||
ALLOWED_DISPATCH = 0x8000,
|
||||
ALLOWED_REGDUMP = 0x0020,
|
||||
ALLOWED_DETACHED = ALLOWED_DISPATCH,
|
||||
ALLOWED_RESERVED = ~(ALLOWED_FAIL|ALLOWED_ABORT|ALLOWED_RETRY|ALLOWED_IGNORE|ALLOWED_ACKNOWLEDGE),
|
||||
I24_OPERATION = 0x01,
|
||||
I24_AREA = 0x06,
|
||||
I24_CLASS = 0x80,
|
||||
ERRCLASS_OUTRES = 1,
|
||||
ERRCLASS_TEMPSIT = 2,
|
||||
ERRCLASS_AUTH = 3,
|
||||
ERRCLASS_INTRN = 4,
|
||||
ERRCLASS_HRDFAIL = 5,
|
||||
ERRCLASS_SYSFAIL = 6,
|
||||
ERRCLASS_APPERR = 7,
|
||||
ERRCLASS_NOTFND = 8,
|
||||
ERRCLASS_BADFMT = 9,
|
||||
ERRCLASS_LOCKED = 10,
|
||||
ERRCLASS_MEDIA = 11,
|
||||
ERRCLASS_ALREADY = 12,
|
||||
ERRCLASS_UNK = 13,
|
||||
ERRCLASS_CANT = 14,
|
||||
ERRCLASS_TIME = 15,
|
||||
ERRACT_RETRY = 1,
|
||||
ERRACT_DLYRET = 2,
|
||||
ERRACT_USER = 3,
|
||||
ERRACT_ABORT = 4,
|
||||
ERRACT_PANIC = 5,
|
||||
ERRACT_IGNORE = 6,
|
||||
ERRACT_INTRET = 7,
|
||||
ERRLOC_UNK = 1,
|
||||
ERRLOC_DISK = 2,
|
||||
ERRLOC_NET = 3,
|
||||
ERRLOC_SERDEV = 4,
|
||||
ERRLOC_MEM = 5,
|
||||
TC_NORMAL = 0,
|
||||
TC_HARDERR = 1,
|
||||
TC_GP_TRAP = 2,
|
||||
TC_SIGNAL = 3,
|
||||
TC_XCPT = 4,
|
||||
ERROR_INVALID_PROCID = 303,
|
||||
ERROR_INVALID_PDELTA = 304,
|
||||
ERROR_NOT_DESCENDANT = 305,
|
||||
ERROR_NOT_SESSION_MANAGER = 306,
|
||||
ERROR_INVALID_PCLASS = 307,
|
||||
ERROR_INVALID_SCOPE = 308,
|
||||
ERROR_INVALID_THREADID = 309,
|
||||
ERROR_DOSSUB_SHRINK = 310,
|
||||
ERROR_DOSSUB_NOMEM = 311,
|
||||
ERROR_DOSSUB_OVERLAP = 312,
|
||||
ERROR_DOSSUB_BADSIZE = 313,
|
||||
ERROR_DOSSUB_BADFLAG = 314,
|
||||
ERROR_DOSSUB_BADSELECTOR = 315,
|
||||
ERROR_MR_MSG_TOO_LONG = 316,
|
||||
MGS_MR_MSG_TOO_LONG = 316,
|
||||
ERROR_MR_MID_NOT_FOUND = 317,
|
||||
ERROR_MR_UN_ACC_MSGF = 318,
|
||||
ERROR_MR_INV_MSGF_FORMAT = 319,
|
||||
ERROR_MR_INV_IVCOUNT = 320,
|
||||
ERROR_MR_UN_PERFORM = 321,
|
||||
ERROR_TS_WAKEUP = 322,
|
||||
ERROR_TS_SEMHANDLE = 323,
|
||||
ERROR_TS_NOTIMER = 324,
|
||||
ERROR_TS_HANDLE = 326,
|
||||
ERROR_TS_DATETIME = 327,
|
||||
ERROR_SYS_INTERNAL = 328,
|
||||
ERROR_QUE_CURRENT_NAME = 329,
|
||||
ERROR_QUE_PROC_NOT_OWNED = 330,
|
||||
ERROR_QUE_PROC_OWNED = 331,
|
||||
ERROR_QUE_DUPLICATE = 332,
|
||||
ERROR_QUE_ELEMENT_NOT_EXIST = 333,
|
||||
ERROR_QUE_NO_MEMORY = 334,
|
||||
ERROR_QUE_INVALID_NAME = 335,
|
||||
ERROR_QUE_INVALID_PRIORITY = 336,
|
||||
ERROR_QUE_INVALID_HANDLE = 337,
|
||||
ERROR_QUE_LINK_NOT_FOUND = 338,
|
||||
ERROR_QUE_MEMORY_ERROR = 339,
|
||||
ERROR_QUE_PREV_AT_END = 340,
|
||||
ERROR_QUE_PROC_NO_ACCESS = 341,
|
||||
ERROR_QUE_EMPTY = 342,
|
||||
ERROR_QUE_NAME_NOT_EXIST = 343,
|
||||
ERROR_QUE_NOT_INITIALIZED = 344,
|
||||
ERROR_QUE_UNABLE_TO_ACCESS = 345,
|
||||
ERROR_QUE_UNABLE_TO_ADD = 346,
|
||||
ERROR_QUE_UNABLE_TO_INIT = 347,
|
||||
ERROR_VIO_INVALID_MASK = 349,
|
||||
ERROR_VIO_PTR = 350,
|
||||
ERROR_VIO_APTR = 351,
|
||||
ERROR_VIO_RPTR = 352,
|
||||
ERROR_VIO_CPTR = 353,
|
||||
ERROR_VIO_LPTR = 354,
|
||||
ERROR_VIO_MODE = 355,
|
||||
ERROR_VIO_WIDTH = 356,
|
||||
ERROR_VIO_ATTR = 357,
|
||||
ERROR_VIO_ROW = 358,
|
||||
ERROR_VIO_COL = 359,
|
||||
ERROR_VIO_TOPROW = 360,
|
||||
ERROR_VIO_BOTROW = 361,
|
||||
ERROR_VIO_RIGHTCOL = 362,
|
||||
ERROR_VIO_LEFTCOL = 363,
|
||||
ERROR_SCS_CALL = 364,
|
||||
ERROR_SCS_VALUE = 365,
|
||||
ERROR_VIO_WAIT_FLAG = 366,
|
||||
ERROR_VIO_UNLOCK = 367,
|
||||
ERROR_SGS_NOT_SESSION_MGR = 368,
|
||||
ERROR_SMG_INVALID_SGID = 369,
|
||||
ERROR_SMG_INVALID_SESSION_ID = ERROR_SMG_INVALID_SGID,
|
||||
ERROR_SMG_NOSG = 370,
|
||||
ERROR_SMG_NO_SESSIONS = 370,
|
||||
ERROR_SMG_GRP_NOT_FOUND = 371,
|
||||
ERROR_SMG_SESSION_NOT_FOUND = ERROR_SMG_GRP_NOT_FOUND,
|
||||
ERROR_SMG_SET_TITLE = 372,
|
||||
ERROR_KBD_PARAMETER = 373,
|
||||
ERROR_KBD_NO_DEVICE = 374,
|
||||
ERROR_KBD_INVALID_IOWAIT = 375,
|
||||
ERROR_KBD_INVALID_LENGTH = 376,
|
||||
ERROR_KBD_INVALID_ECHO_MASK = 377,
|
||||
ERROR_KBD_INVALID_INPUT_MASK = 378,
|
||||
ERROR_MON_INVALID_PARMS = 379,
|
||||
ERROR_MON_INVALID_DEVNAME = 380,
|
||||
ERROR_MON_INVALID_HANDLE = 381,
|
||||
ERROR_MON_BUFFER_TOO_SMALL = 382,
|
||||
ERROR_MON_BUFFER_EMPTY = 383,
|
||||
ERROR_MON_DATA_TOO_LARGE = 384,
|
||||
ERROR_MOUSE_NO_DEVICE = 385,
|
||||
ERROR_MOUSE_INV_HANDLE = 386,
|
||||
ERROR_MOUSE_INV_PARMS = 387,
|
||||
ERROR_MOUSE_CANT_RESET = 388,
|
||||
ERROR_MOUSE_DISPLAY_PARMS = 389,
|
||||
ERROR_MOUSE_INV_MODULE = 390,
|
||||
ERROR_MOUSE_INV_ENTRY_PT = 391,
|
||||
ERROR_MOUSE_INV_MASK = 392,
|
||||
NO_ERROR_MOUSE_NO_DATA = 393,
|
||||
NO_ERROR_MOUSE_PTR_DRAWN = 394,
|
||||
ERROR_INVALID_FREQUENCY = 395,
|
||||
ERROR_NLS_NO_COUNTRY_FILE = 396,
|
||||
ERROR_NLS_OPEN_FAILED = 397,
|
||||
ERROR_NLS_NO_CTRY_CODE = 398,
|
||||
ERROR_NO_COUNTRY_OR_CODEPAGE = 398,
|
||||
ERROR_NLS_TABLE_TRUNCATED = 399,
|
||||
ERROR_NLS_BAD_TYPE = 400,
|
||||
ERROR_NLS_TYPE_NOT_FOUND = 401,
|
||||
ERROR_VIO_SMG_ONLY = 402,
|
||||
ERROR_VIO_INVALID_ASCIIZ = 403,
|
||||
ERROR_VIO_DEREGISTER = 404,
|
||||
ERROR_VIO_NO_POPUP = 405,
|
||||
ERROR_VIO_EXISTING_POPUP = 406,
|
||||
ERROR_KBD_SMG_ONLY = 407,
|
||||
ERROR_KBD_INVALID_ASCIIZ = 408,
|
||||
ERROR_KBD_INVALID_MASK = 409,
|
||||
ERROR_KBD_REGISTER = 410,
|
||||
ERROR_KBD_DEREGISTER = 411,
|
||||
ERROR_MOUSE_SMG_ONLY = 412,
|
||||
ERROR_MOUSE_INVALID_ASCIIZ = 413,
|
||||
ERROR_MOUSE_INVALID_MASK = 414,
|
||||
ERROR_MOUSE_REGISTER = 415,
|
||||
ERROR_MOUSE_DEREGISTER = 416,
|
||||
ERROR_SMG_BAD_ACTION = 417,
|
||||
ERROR_SMG_INVALID_CALL = 418,
|
||||
ERROR_SCS_SG_NOTFOUND = 419,
|
||||
ERROR_SCS_NOT_SHELL = 420,
|
||||
ERROR_VIO_INVALID_PARMS = 421,
|
||||
ERROR_VIO_FUNCTION_OWNED = 422,
|
||||
ERROR_VIO_RETURN = 423,
|
||||
ERROR_SCS_INVALID_FUNCTION = 424,
|
||||
ERROR_SCS_NOT_SESSION_MGR = 425,
|
||||
ERROR_VIO_REGISTER = 426,
|
||||
ERROR_VIO_NO_MODE_THREAD = 427,
|
||||
ERROR_VIO_NO_SAVE_RESTORE_THD = 428,
|
||||
ERROR_VIO_IN_BG = 429,
|
||||
ERROR_VIO_ILLEGAL_DURING_POPUP = 430,
|
||||
ERROR_SMG_NOT_BASESHELL = 431,
|
||||
ERROR_SMG_BAD_STATUSREQ = 432,
|
||||
ERROR_QUE_INVALID_WAIT = 433,
|
||||
ERROR_VIO_LOCK = 434,
|
||||
ERROR_MOUSE_INVALID_IOWAIT = 435,
|
||||
ERROR_VIO_INVALID_HANDLE = 436,
|
||||
ERROR_VIO_ILLEGAL_DURING_LOCK = 437,
|
||||
ERROR_VIO_INVALID_LENGTH = 438,
|
||||
ERROR_KBD_INVALID_HANDLE = 439,
|
||||
ERROR_KBD_NO_MORE_HANDLE = 440,
|
||||
ERROR_KBD_CANNOT_CREATE_KCB = 441,
|
||||
ERROR_KBD_CODEPAGE_LOAD_INCOMPL = 442,
|
||||
ERROR_KBD_INVALID_CODEPAGE_ID = 443,
|
||||
ERROR_KBD_NO_CODEPAGE_SUPPORT = 444,
|
||||
ERROR_KBD_FOCUS_REQUIRED = 445,
|
||||
ERROR_KBD_FOCUS_ALREADY_ACTIVE = 446,
|
||||
ERROR_KBD_KEYBOARD_BUSY = 447,
|
||||
ERROR_KBD_INVALID_CODEPAGE = 448,
|
||||
ERROR_KBD_UNABLE_TO_FOCUS = 449,
|
||||
ERROR_SMG_SESSION_NON_SELECT = 450,
|
||||
ERROR_SMG_SESSION_NOT_FOREGRND = 451,
|
||||
ERROR_SMG_SESSION_NOT_PARENT = 452,
|
||||
ERROR_SMG_INVALID_START_MODE = 453,
|
||||
ERROR_SMG_INVALID_RELATED_OPT = 454,
|
||||
ERROR_SMG_INVALID_BOND_OPTION = 455,
|
||||
ERROR_SMG_INVALID_SELECT_OPT = 456,
|
||||
ERROR_SMG_START_IN_BACKGROUND = 457,
|
||||
ERROR_SMG_INVALID_STOP_OPTION = 458,
|
||||
ERROR_SMG_BAD_RESERVE = 459,
|
||||
ERROR_SMG_PROCESS_NOT_PARENT = 460,
|
||||
ERROR_SMG_INVALID_DATA_LENGTH = 461,
|
||||
ERROR_SMG_NOT_BOUND = 462,
|
||||
ERROR_SMG_RETRY_SUB_ALLOC = 463,
|
||||
ERROR_KBD_DETACHED = 464,
|
||||
ERROR_VIO_DETACHED = 465,
|
||||
ERROR_MOU_DETACHED = 466,
|
||||
ERROR_VIO_FONT = 467,
|
||||
ERROR_VIO_USER_FONT = 468,
|
||||
ERROR_VIO_BAD_CP = 469,
|
||||
ERROR_VIO_NO_CP = 470,
|
||||
ERROR_VIO_NA_CP = 471,
|
||||
ERROR_INVALID_CODE_PAGE = 472,
|
||||
ERROR_CPLIST_TOO_SMALL = 473,
|
||||
ERROR_CP_NOT_MOVED = 474,
|
||||
ERROR_MODE_SWITCH_INIT = 475,
|
||||
ERROR_CODE_PAGE_NOT_FOUND = 476,
|
||||
ERROR_UNEXPECTED_SLOT_RETURNED = 477,
|
||||
ERROR_SMG_INVALID_TRACE_OPTION = 478,
|
||||
ERROR_VIO_INTERNAL_RESOURCE = 479,
|
||||
ERROR_VIO_SHELL_INIT = 480,
|
||||
ERROR_SMG_NO_HARD_ERRORS = 481,
|
||||
ERROR_CP_SWITCH_INCOMPLETE = 482,
|
||||
ERROR_VIO_TRANSPARENT_POPUP = 483,
|
||||
ERROR_CRITSEC_OVERFLOW = 484,
|
||||
ERROR_CRITSEC_UNDERFLOW = 485,
|
||||
ERROR_VIO_BAD_RESERVE = 486,
|
||||
ERROR_INVALID_ADDRESS = 487,
|
||||
ERROR_ZERO_SELECTORS_REQUESTED = 488,
|
||||
ERROR_NOT_ENOUGH_SELECTORS_AVA = 489,
|
||||
ERROR_INVALID_SELECTOR = 490,
|
||||
ERROR_SMG_INVALID_PROGRAM_TYPE = 491,
|
||||
ERROR_SMG_INVALID_PGM_CONTROL = 492,
|
||||
ERROR_SMG_INVALID_INHERIT_OPT = 493,
|
||||
ERROR_VIO_EXTENDED_SG = 494,
|
||||
ERROR_VIO_NOT_PRES_MGR_SG = 495,
|
||||
ERROR_VIO_SHIELD_OWNED = 496,
|
||||
ERROR_VIO_NO_MORE_HANDLES = 497,
|
||||
ERROR_VIO_SEE_ERROR_LOG = 498,
|
||||
ERROR_VIO_ASSOCIATED_DC = 499,
|
||||
ERROR_KBD_NO_CONSOLE = 500,
|
||||
ERROR_MOUSE_NO_CONSOLE = 501,
|
||||
ERROR_MOUSE_INVALID_HANDLE = 502,
|
||||
ERROR_SMG_INVALID_DEBUG_PARMS = 503,
|
||||
ERROR_KBD_EXTENDED_SG = 504,
|
||||
ERROR_MOU_EXTENDED_SG = 505,
|
||||
ERROR_SMG_INVALID_ICON_FILE = 506,
|
||||
ERROR_TRC_PID_NON_EXISTENT = 507,
|
||||
ERROR_TRC_COUNT_ACTIVE = 508,
|
||||
ERROR_TRC_SUSPENDED_BY_COUNT = 509,
|
||||
ERROR_TRC_COUNT_INACTIVE = 510,
|
||||
ERROR_TRC_COUNT_REACHED = 511,
|
||||
ERROR_NO_MC_TRACE = 512,
|
||||
ERROR_MC_TRACE = 513,
|
||||
ERROR_TRC_COUNT_ZERO = 514,
|
||||
ERROR_SMG_TOO_MANY_DDS = 515,
|
||||
ERROR_SMG_INVALID_NOTIFICATION = 516,
|
||||
ERROR_LF_INVALID_FUNCTION = 517,
|
||||
ERROR_LF_NOT_AVAIL = 518,
|
||||
ERROR_LF_SUSPENDED = 519,
|
||||
ERROR_LF_BUF_TOO_SMALL = 520,
|
||||
ERROR_LF_BUFFER_CORRUPTED = 521,
|
||||
ERROR_LF_BUFFER_FULL = 521,
|
||||
ERROR_LF_INVALID_DAEMON = 522,
|
||||
ERROR_LF_INVALID_RECORD = 522,
|
||||
ERROR_LF_INVALID_TEMPL = 523,
|
||||
ERROR_LF_INVALID_SERVICE = 523,
|
||||
ERROR_LF_GENERAL_FAILURE = 524,
|
||||
ERROR_LF_INVALID_ID = 525,
|
||||
ERROR_LF_INVALID_HANDLE = 526,
|
||||
ERROR_LF_NO_ID_AVAIL = 527,
|
||||
ERROR_LF_TEMPLATE_AREA_FULL = 528,
|
||||
ERROR_LF_ID_IN_USE = 529,
|
||||
ERROR_MOU_NOT_INITIALIZED = 530,
|
||||
ERROR_MOUINITREAL_DONE = 531,
|
||||
ERROR_DOSSUB_CORRUPTED = 532,
|
||||
ERROR_MOUSE_CALLER_NOT_SUBSYS = 533,
|
||||
ERROR_ARITHMETIC_OVERFLOW = 534,
|
||||
ERROR_TMR_NO_DEVICE = 535,
|
||||
ERROR_TMR_INVALID_TIME = 536,
|
||||
ERROR_PVW_INVALID_ENTITY = 537,
|
||||
ERROR_PVW_INVALID_ENTITY_TYPE = 538,
|
||||
ERROR_PVW_INVALID_SPEC = 539,
|
||||
ERROR_PVW_INVALID_RANGE_TYPE = 540,
|
||||
ERROR_PVW_INVALID_COUNTER_BLK = 541,
|
||||
ERROR_PVW_INVALID_TEXT_BLK = 542,
|
||||
ERROR_PRF_NOT_INITIALIZED = 543,
|
||||
ERROR_PRF_ALREADY_INITIALIZED = 544,
|
||||
ERROR_PRF_NOT_STARTED = 545,
|
||||
ERROR_PRF_ALREADY_STARTED = 546,
|
||||
ERROR_PRF_TIMER_OUT_OF_RANGE = 547,
|
||||
ERROR_PRF_TIMER_RESET = 548,
|
||||
ERROR_VDD_LOCK_USEAGE_DENIED = 639,
|
||||
ERROR_TIMEOUT = 640,
|
||||
ERROR_VDM_DOWN = 641,
|
||||
ERROR_VDM_LIMIT = 642,
|
||||
ERROR_VDD_NOT_FOUND = 643,
|
||||
ERROR_INVALID_CALLER = 644,
|
||||
ERROR_PID_MISMATCH = 645,
|
||||
ERROR_INVALID_VDD_HANDLE = 646,
|
||||
ERROR_VLPT_NO_SPOOLER = 647,
|
||||
ERROR_VCOM_DEVICE_BUSY = 648,
|
||||
ERROR_VLPT_DEVICE_BUSY = 649,
|
||||
ERROR_NESTING_TOO_DEEP = 650,
|
||||
ERROR_VDD_MISSING = 651,
|
||||
ERROR_BIDI_INVALID_LENGTH = 671,
|
||||
ERROR_BIDI_INVALID_INCREMENT = 672,
|
||||
ERROR_BIDI_INVALID_COMBINATION = 673,
|
||||
ERROR_BIDI_INVALID_RESERVED = 674,
|
||||
ERROR_BIDI_INVALID_EFFECT = 675,
|
||||
ERROR_BIDI_INVALID_CSDREC = 676,
|
||||
ERROR_BIDI_INVALID_CSDSTATE = 677,
|
||||
ERROR_BIDI_INVALID_LEVEL = 678,
|
||||
ERROR_BIDI_INVALID_TYPE_SUPPORT = 679,
|
||||
ERROR_BIDI_INVALID_ORIENTATION = 680,
|
||||
ERROR_BIDI_INVALID_NUM_SHAPE = 681,
|
||||
ERROR_BIDI_INVALID_CSD = 682,
|
||||
ERROR_BIDI_NO_SUPPORT = 683,
|
||||
NO_ERROR_BIDI_RW_INCOMPLETE = 684,
|
||||
ERROR_IMP_INVALID_PARM = 691,
|
||||
ERROR_IMP_INVALID_LENGTH = 692,
|
||||
MSG_HPFS_DISK_ERROR_WARN = 693,
|
||||
ERROR_MON_BAD_BUFFER = 730,
|
||||
ERROR_MODULE_CORRUPTED = 731,
|
||||
ERROR_SM_OUTOF_SWAPFILE = 1477,
|
||||
ERROR_LF_TIMEOUT = 2055,
|
||||
ERROR_LF_SUSPEND_SUCCESS = 2057,
|
||||
ERROR_LF_RESUME_SUCCESS = 2058,
|
||||
ERROR_LF_REDIRECT_SUCCESS = 2059,
|
||||
ERROR_LF_REDIRECT_FAILURE = 2060,
|
||||
ERROR_SWAPPER_NOT_ACTIVE = 32768,
|
||||
ERROR_INVALID_SWAPID = 32769,
|
||||
ERROR_IOERR_SWAP_FILE = 32770,
|
||||
ERROR_SWAP_TABLE_FULL = 32771,
|
||||
ERROR_SWAP_FILE_FULL = 32772,
|
||||
ERROR_CANT_INIT_SWAPPER = 32773,
|
||||
ERROR_SWAPPER_ALREADY_INIT = 32774,
|
||||
ERROR_PMM_INSUFFICIENT_MEMORY = 32775,
|
||||
ERROR_PMM_INVALID_FLAGS = 32776,
|
||||
ERROR_PMM_INVALID_ADDRESS = 32777,
|
||||
ERROR_PMM_LOCK_FAILED = 32778,
|
||||
ERROR_PMM_UNLOCK_FAILED = 32779,
|
||||
ERROR_PMM_MOVE_INCOMPLETE = 32780,
|
||||
ERROR_UCOM_DRIVE_RENAMED = 32781,
|
||||
ERROR_UCOM_FILENAME_TRUNCATED = 32782,
|
||||
ERROR_UCOM_BUFFER_LENGTH = 32783,
|
||||
ERROR_MON_CHAIN_HANDLE = 32784,
|
||||
ERROR_MON_NOT_REGISTERED = 32785,
|
||||
ERROR_SMG_ALREADY_TOP = 32786,
|
||||
ERROR_PMM_ARENA_MODIFIED = 32787,
|
||||
ERROR_SMG_PRINTER_OPEN = 32788,
|
||||
ERROR_PMM_SET_FLAGS_FAILED = 32789,
|
||||
ERROR_INVALID_DOS_DD = 32790,
|
||||
ERROR_BLOCKED = 32791,
|
||||
ERROR_NOBLOCK = 32792,
|
||||
ERROR_INSTANCE_SHARED = 32793,
|
||||
ERROR_NO_OBJECT = 32794,
|
||||
ERROR_PARTIAL_ATTACH = 32795,
|
||||
ERROR_INCACHE = 32796,
|
||||
ERROR_SWAP_IO_PROBLEMS = 32797,
|
||||
ERROR_CROSSES_OBJECT_BOUNDARY = 32798,
|
||||
ERROR_LONGLOCK = 32799,
|
||||
ERROR_SHORTLOCK = 32800,
|
||||
ERROR_UVIRTLOCK = 32801,
|
||||
ERROR_ALIASLOCK = 32802,
|
||||
ERROR_ALIAS = 32803,
|
||||
ERROR_NO_MORE_HANDLES = 32804,
|
||||
ERROR_SCAN_TERMINATED = 32805,
|
||||
ERROR_TERMINATOR_NOT_FOUND = 32806,
|
||||
ERROR_NOT_DIRECT_CHILD = 32807,
|
||||
ERROR_DELAY_FREE = 32808,
|
||||
ERROR_GUARDPAGE = 32809,
|
||||
ERROR_SWAPERROR = 32900,
|
||||
ERROR_LDRERROR = 32901,
|
||||
ERROR_NOMEMORY = 32902,
|
||||
ERROR_NOACCESS = 32903,
|
||||
ERROR_NO_DLL_TERM = 32904,
|
||||
ERROR_CPSIO_CODE_PAGE_INVALID = 65026,
|
||||
ERROR_CPSIO_NO_SPOOLER = 65027,
|
||||
ERROR_CPSIO_FONT_ID_INVALID = 65028,
|
||||
ERROR_CPSIO_INTERNAL_ERROR = 65033,
|
||||
ERROR_CPSIO_INVALID_PTR_NAME = 65034,
|
||||
ERROR_CPSIO_NOT_ACTIVE = 65037,
|
||||
ERROR_CPSIO_PID_FULL = 65039,
|
||||
ERROR_CPSIO_PID_NOT_FOUND = 65040,
|
||||
ERROR_CPSIO_READ_CTL_SEQ = 65043,
|
||||
ERROR_CPSIO_READ_FNT_DEF = 65045,
|
||||
ERROR_CPSIO_WRITE_ERROR = 65047,
|
||||
ERROR_CPSIO_WRITE_FULL_ERROR = 65048,
|
||||
ERROR_CPSIO_WRITE_HANDLE_BAD = 65049,
|
||||
ERROR_CPSIO_SWIT_LOAD = 65074,
|
||||
ERROR_CPSIO_INV_COMMAND = 65077,
|
||||
ERROR_CPSIO_NO_FONT_SWIT = 65078,
|
||||
ERROR_ENTRY_IS_CALLGATE = 65079,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// end of os2errors.h ...
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef _INCL_NATIVE_H_
|
||||
#define _INCL_NATIVE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "os2types.h"
|
||||
#include "os2errors.h"
|
||||
#include "../lx_loader.h"
|
||||
|
||||
#if 1
|
||||
#define TRACE_NATIVE(...) do { printf("TRACE: "); printf(__VA_ARGS__); printf(";\n"); } while (0)
|
||||
#else
|
||||
#define TRACE_NATIVE(...) do {} while (0)
|
||||
#endif
|
||||
|
||||
// !!! FIXME: this is nasty for several reasons.
|
||||
#define NATIVE_MODULE(modname) \
|
||||
static LxLoaderState *GLoaderState = NULL
|
||||
|
||||
#define NATIVE_REPLACEMENT_TABLE(modname) \
|
||||
LxModule *loadNativeLxModule(LxLoaderState *state) { \
|
||||
GLoaderState = state; \
|
||||
LxModule *retval = (LxModule *) malloc(sizeof (LxModule)); \
|
||||
if (!retval) goto loadnative_failed; \
|
||||
memset(retval, '\0', sizeof (LxModule)); \
|
||||
retval->refcount = 1; \
|
||||
strcpy(retval->name, modname); \
|
||||
|
||||
#define NATIVE_REPLACEMENT(fn, ord) { \
|
||||
void *ptr = realloc(retval->exported_names, (retval->num_names+1) * sizeof (LxExportedName)); \
|
||||
if (!ptr) { goto loadnative_failed; } \
|
||||
retval->exported_names = (LxExportedName *) ptr; \
|
||||
strcpy(retval->exported_names[retval->num_names].name, #fn); \
|
||||
retval->exported_names[retval->num_names].addr = (uint32) ((size_t) fn); \
|
||||
retval->num_names++; \
|
||||
ptr = realloc(retval->exported_ordinals, (retval->num_ordinals+1) * sizeof (LxExportedOrdinal)); \
|
||||
if (!ptr) { goto loadnative_failed; } \
|
||||
retval->exported_ordinals = (LxExportedOrdinal *) ptr; \
|
||||
retval->exported_ordinals[retval->num_ordinals].ordinal = ord; \
|
||||
retval->exported_ordinals[retval->num_ordinals].addr = (uint32) ((size_t) fn); \
|
||||
retval->num_ordinals++; \
|
||||
}
|
||||
|
||||
#define END_NATIVE_REPLACEMENT_TABLE() \
|
||||
return retval; \
|
||||
\
|
||||
loadnative_failed: \
|
||||
if (retval) { \
|
||||
free(retval->exported_ordinals); \
|
||||
free(retval->exported_names); \
|
||||
free(retval); \
|
||||
} \
|
||||
return NULL; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// end of native.h ...
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef _INCL_OS2TYPES_H_
|
||||
#define _INCL_OS2TYPES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef OS2API
|
||||
#define OS2API APIENTRY __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
typedef uint32_t APIRET;
|
||||
typedef uint16_t APIRET16;
|
||||
typedef uint32_t APIRET32;
|
||||
|
||||
#define VOID void
|
||||
typedef uint32_t BOOL32;
|
||||
typedef uint32_t ULONG, *PULONG;
|
||||
typedef char CHAR, *PCHAR;
|
||||
typedef PCHAR PSZ;
|
||||
typedef VOID *PVOID;
|
||||
typedef uint32_t HMODULE, *PHMODULE;
|
||||
typedef uint32_t HFILE, *PHFILE;
|
||||
typedef uint32_t HEV, *PHEV;
|
||||
typedef uint32_t HMTX, *PHMTX;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// end of os2types.h ...
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
#include "native.h"
|
||||
#include "os2native.h"
|
||||
#include "quecalls.h"
|
||||
|
||||
NATIVE_MODULE(quecalls);
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef _INCL_QUECALLS_H_
|
||||
#define _INCL_QUECALLS_H_
|
||||
|
||||
#include "os2types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// end of quecalls.h ...
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
#include "native.h"
|
||||
#include "os2native.h"
|
||||
#include "sesmgr.h"
|
||||
|
||||
NATIVE_MODULE(sesmgr);
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef _INCL_SESMGR_H_
|
||||
#define _INCL_SESMGR_H_
|
||||
|
||||
#include "os2types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// end of sesmgr.h ...
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
#include "native.h"
|
||||
#include "os2native.h"
|
||||
#include "viocalls.h"
|
||||
|
||||
NATIVE_MODULE(viocalls);
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef _INCL_VIOCALLS_H_
|
||||
#define _INCL_VIOCALLS_H_
|
||||
|
||||
#include "os2types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// end of viocalls.h ...
|
||||
|
||||
Reference in new issue
Block a user