Why not provide an strace/ltrace trace of that SEGV?
ltrace fails with this $ltrace /usr/local/bin/wine ntoskrnl ltrace: dict.c:117: dict_apply_to_all: Assertion `d' failed. Aborted strace output is attached (It's bziped because it was over 200k uncompressed).
Well, I ran winegcc manually with the -v option, and found that normally programs build something with spec in the name anyway, so I changed the extension of my spec to .sspec and got the attached ntoskrnl.sspec.c file, unfortunately the build fails withI'm really stuck because of this and can't get on with safedisc support.
Doh! Hopefully my suggestion will provide more clues.
make: Circular ntoskrnl.sspec.c <- ntoskrnl.sspec dependency dropped.
make: Nothing to be done for `all'.
so without changing the makefile I renamed the file to .spec again and got this
[EMAIL PROTECTED] ntoskrnl]$ make
make: Circular ntoskrnl.sspec.c <- ntoskrnl.sspec dependency dropped.
gcc -g -O2 ntoskrnl.sspec.c -o ntoskrnl.sspec
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/../../../crt1.o(.text+0x18): In function `_start':
../sysdeps/i386/elf/start.S:98: undefined reference to `main'
/home/ivan/tmp/ccZ0Wy9e.o(.text+0x10210): In function `__wine_dll_main':
/home/ivan/Development/Wine/CVS/wine/build/programs/ntoskrnl/ntoskrnl.sspec.c:326: undefined reference to `__wine_main_environ'
/home/ivan/tmp/ccZ0Wy9e.o(.text+0x10216):/home/ivan/Development/Wine/CVS/wine/build/programs/ntoskrnl/ntoskrnl.sspec.c:326: undefined reference to `__wine_main_argv'
/home/ivan/tmp/ccZ0Wy9e.o(.text+0x1021c):/home/ivan/Development/Wine/CVS/wine/build/programs/ntoskrnl/ntoskrnl.sspec.c:326: undefined reference to `__wine_main_argc'
/home/ivan/tmp/ccZ0Wy9e.o(.text+0x1025b): In function `__wine_spec_init':
/home/ivan/Development/Wine/CVS/wine/build/programs/ntoskrnl/ntoskrnl.sspec.c:415: undefined reference to `__wine_dll_register'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x2c): In function `__wine_spec_exports_funcs':
: undefined reference to `IoCreateDevice'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x30): In function `__wine_spec_exports_funcs':
: undefined reference to `IoCreateSymbolicLink'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x34): In function `__wine_spec_exports_funcs':
: undefined reference to `IoDeleteDevice'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x38): In function `__wine_spec_exports_funcs':
: undefined reference to `IoDeleteSymbolicLink'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x3c): In function `__wine_spec_exports_funcs':
: undefined reference to `IofCompleteRequest'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x40): In function `__wine_spec_exports_funcs':
: undefined reference to `KeTickCount'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x44): In function `__wine_spec_exports_funcs':
: undefined reference to `NtBuildNumber'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x48): In function `__wine_spec_exports_funcs':
: undefined reference to `PsGetVersion'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x114): In function `__wine_spec_forwards':
: undefined reference to `IoCreateDevice'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x124): In function `__wine_spec_forwards':
: undefined reference to `IoCreateSymbolicLink'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x134): In function `__wine_spec_forwards':
: undefined reference to `IoDeleteDevice'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x144): In function `__wine_spec_forwards':
: undefined reference to `IoDeleteSymbolicLink'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x154): In function `__wine_spec_forwards':
: undefined reference to `IofCompleteRequest'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x184): In function `__wine_spec_forwards':
: undefined reference to `PsGetVersion'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x10d): In function `__wine_spec_forwards':
: undefined reference to `IoCreateDevice'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x11d): In function `__wine_spec_forwards':
: undefined reference to `IoCreateSymbolicLink'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x12d): In function `__wine_spec_forwards':
: undefined reference to `IoDeleteDevice'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x13d): In function `__wine_spec_forwards':
: undefined reference to `IoDeleteSymbolicLink'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x14d): In function `__wine_spec_forwards':
: undefined reference to `IofCompleteRequest'
/home/ivan/tmp/ccZ0Wy9e.o(.data+0x17d): In function `__wine_spec_forwards':
: undefined reference to `PsGetVersion'
collect2: ld returned 1 exit status
make: *** [ntoskrnl.sspec] Error 1
[EMAIL PROTECTED] ntoskrnl]$
the program has a WinMain() and not a main(), all the exported functions are in the source, so I'm not sure about the reason for these errors. What I now think is that programs probably have some default spec that's built on the fly for them, and this is interfering with my spec. This is a real shame because ntoskrnl can actually run safedisc ATM, but it crashes when Secdrv.sys can't call the ntoskrnl functions it imports.
The file I did build with a .spec file and that segfaults is at
http://spazioinwind.libero.it/nonsolomicrosoft/public/spec/ntoskrnl.exe.so
Ivan.
/* File generated automatically from ../../../new/programs/ntoskrnl/ntoskrnl.sspec; do not edit! */ /* This file can be copied, modified and distributed without restriction. */
extern char __wine_spec_pe_header[]; #ifndef __GNUC__ static void __asm__dummy_header(void) { #endif asm(".text\n\t" ".align 4096\n" "__wine_spec_pe_header:\t.skip 65536\n\t" ".data\n\t" ".align 4\n" "__wine_spec_data_start:\t.long 1"); #ifndef __GNUC__ } #endif extern char _end[]; extern int __wine_spec_data_start[], __wine_spec_exports[]; #define __stdcall __attribute__((__stdcall__)) #ifndef __GNUC__ static void __asm__dummy(void) { #endif /* !defined(__GNUC__) */ asm(".data\n" "\t.align 4\n" "__wine_spec_exports:\n" "\t.long 0\n" "\t.long 0\n" "\t.long 0\n" "\t.long __wine_spec_exp_names\n" "\t.long 1\n" "\t.long 12\n" "\t.long 12\n" "\t.long __wine_spec_exports_funcs\n" "\t.long __wine_spec_exp_name_ptrs\n" "\t.long __wine_spec_exp_ordinals\n" "__wine_spec_exports_funcs:\n" "\t.long IoCreateDevice\n" "\t.long IoCreateSymbolicLink\n" "\t.long IoDeleteDevice\n" "\t.long IoDeleteSymbolicLink\n" "\t.long IofCompleteRequest\n" "\t.long KeTickCount\n" "\t.long NtBuildNumber\n" "\t.long PsGetVersion\n" "\t.long __wine_spec_forwards+0\n" "\t.long __wine_spec_forwards+28\n" "\t.long __wine_spec_forwards+48\n" "\t.long __wine_spec_forwards+75\n" "__wine_spec_exp_name_ptrs:\n" "\t.long __wine_spec_exp_names+15\n" "\t.long __wine_spec_exp_names+30\n" "\t.long __wine_spec_exp_names+51\n" "\t.long __wine_spec_exp_names+66\n" "\t.long __wine_spec_exp_names+87\n" "\t.long __wine_spec_exp_names+106\n" "\t.long __wine_spec_exp_names+118\n" "\t.long __wine_spec_exp_names+132\n" "\t.long __wine_spec_exp_names+145\n" "\t.long __wine_spec_exp_names+167\n" "\t.long __wine_spec_exp_names+181\n" "\t.long __wine_spec_exp_names+202\n" "\t.text\n" "__wine_spec_exp_names:\n" "\t.string \"ntoskrnl.sspec\"\n" "\t.string \"IoCreateDevice\"\n" "\t.string \"IoCreateSymbolicLink\"\n" "\t.string \"IoDeleteDevice\"\n" "\t.string \"IoDeleteSymbolicLink\"\n" "\t.string \"IofCompleteRequest\"\n" "\t.string \"KeTickCount\"\n" "\t.string \"NtBuildNumber\"\n" "\t.string \"PsGetVersion\"\n" "\t.string \"RtlEqualUnicodeString\"\n" "\t.string \"RtlGetVersion\"\n" "\t.string \"RtlInitUnicodeString\"\n" "\t.string \"RtlQueryRegistryValues\"\n" "\t.data\n" "__wine_spec_exp_ordinals:\n" "\t.short 0\n" "\t.short 1\n" "\t.short 2\n" "\t.short 3\n" "\t.short 4\n" "\t.short 5\n" "\t.short 6\n" "\t.short 7\n" "\t.short 8\n" "\t.short 9\n" "\t.short 10\n" "\t.short 11\n" "__wine_spec_forwards:\n" "\t.string \"ntdll.RtlEqualUnicodeString\"\n" "\t.string \"ntdll.RtlGetVersion\"\n" "\t.string \"ntdll.RtlInitUnicodeString\"\n" "\t.string \"ntdll.RtlQueryRegistryValues\"\n" "\t.align 4\n" "\tjmp IoCreateDevice\n" "\tret $28\n" "\t.long IoCreateDevice,0x00000000\n" "\tjmp IoCreateSymbolicLink\n" "\tret $4\n" "\t.long IoCreateSymbolicLink,0x00000000\n" "\tjmp IoDeleteDevice\n" "\tret $4\n" "\t.long IoDeleteDevice,0x00000000\n" "\tjmp IoDeleteSymbolicLink\n" "\tret $4\n" "\t.long IoDeleteSymbolicLink,0x00000000\n" "\tjmp IofCompleteRequest\n" "\tret\n" "\t.short 8\n" "\t.long IofCompleteRequest,0x00000000\n" "\t.long 0,0,0,0\n" "\t.long 0,0,0,0\n" "\tjmp PsGetVersion\n" "\tret $16\n" "\t.long PsGetVersion,0x00000000\n" "\t.long 0,0,0,0\n" "\t.long 0,0,0,0\n" "\t.long 0,0,0,0\n" "\t.long 0,0,0,0\n" "\t.text\n" "\t.align 4\n" ); #ifndef __GNUC__ } #endif /* !defined(__GNUC__) */ static struct { struct { void *OriginalFirstThunk; unsigned int TimeDateStamp; unsigned int ForwarderChain; const char *Name; void *FirstThunk; } imp[3]; const char *data[29]; } imports = { { { 0, 0, 0, "kernel32.dll", &imports.data[0] }, { 0, 0, 0, "ntdll.dll", &imports.data[8] }, { 0, 0, 0, 0, 0 }, }, { /* kernel32.dll */ "\266\000CloseHandle", "\277\000ConnectNamedPipe", "\345\000CreateNamedPipeW", "\356\000CreateThread", "\015\001DisconnectNamedPipe", "\376\001GetLastError", "\052\002GetProcessHeap", 0, /* ntdll.dll */ "\116\000NtClose", "\126\000NtCreateFile", "\140\000NtCreateSection", "\165\000NtFlushBuffersFile", "\211\000NtMapViewOfSection", "\221\000NtOpenKey", "\301\000NtQueryValueKey", "\307\000NtReadFile", "\011\001NtUnmapViewOfSection", "\021\001NtWriteFile", "\060\001RtlAllocateHeap", "\067\001RtlAppendUnicodeToString", "\101\001RtlCheckRegistryKey", "\111\001RtlCompareUnicodeString", "\145\001RtlCreateUnicodeString", "\276\001RtlFreeHeap", "\330\001RtlGetVersion", "\334\001RtlImageNtHeader", "\344\001RtlInitUnicodeString", "\071\002RtlReAllocateHeap", 0, } }; #ifndef __GNUC__ static void __asm__dummy_import(void) { #endif asm(".text\n\t.align 8\n" "__wine_spec_import_thunks:\n" "\t.type CloseHandle,@function\n" "\t.globl CloseHandle\n" "CloseHandle:\n\tjmp *(imports+60)\n\tmovl %esi,%esi\n" "\t.size CloseHandle, . - CloseHandle\n" "\t.type ConnectNamedPipe,@function\n" "\t.globl ConnectNamedPipe\n" "ConnectNamedPipe:\n\tjmp *(imports+64)\n\tmovl %esi,%esi\n" "\t.size ConnectNamedPipe, . - ConnectNamedPipe\n" "\t.type CreateNamedPipeW,@function\n" "\t.globl CreateNamedPipeW\n" "CreateNamedPipeW:\n\tjmp *(imports+68)\n\tmovl %esi,%esi\n" "\t.size CreateNamedPipeW, . - CreateNamedPipeW\n" "\t.type CreateThread,@function\n" "\t.globl CreateThread\n" "CreateThread:\n\tjmp *(imports+72)\n\tmovl %esi,%esi\n" "\t.size CreateThread, . - CreateThread\n" "\t.type DisconnectNamedPipe,@function\n" "\t.globl DisconnectNamedPipe\n" "DisconnectNamedPipe:\n\tjmp *(imports+76)\n\tmovl %esi,%esi\n" "\t.size DisconnectNamedPipe, . - DisconnectNamedPipe\n" "\t.type GetLastError,@function\n" "\t.globl GetLastError\n" "GetLastError:\n\tjmp *(imports+80)\n\tmovl %esi,%esi\n" "\t.size GetLastError, . - GetLastError\n" "\t.type GetProcessHeap,@function\n" "\t.globl GetProcessHeap\n" "GetProcessHeap:\n\tjmp *(imports+84)\n\tmovl %esi,%esi\n" "\t.size GetProcessHeap, . - GetProcessHeap\n" "\t.type NtClose,@function\n" "\t.globl NtClose\n" "NtClose:\n\tjmp *(imports+92)\n\tmovl %esi,%esi\n" "\t.size NtClose, . - NtClose\n" "\t.type NtCreateFile,@function\n" "\t.globl NtCreateFile\n" "NtCreateFile:\n\tjmp *(imports+96)\n\tmovl %esi,%esi\n" "\t.size NtCreateFile, . - NtCreateFile\n" "\t.type NtCreateSection,@function\n" "\t.globl NtCreateSection\n" "NtCreateSection:\n\tjmp *(imports+100)\n\tmovl %esi,%esi\n" "\t.size NtCreateSection, . - NtCreateSection\n" "\t.type NtFlushBuffersFile,@function\n" "\t.globl NtFlushBuffersFile\n" "NtFlushBuffersFile:\n\tjmp *(imports+104)\n\tmovl %esi,%esi\n" "\t.size NtFlushBuffersFile, . - NtFlushBuffersFile\n" "\t.type NtMapViewOfSection,@function\n" "\t.globl NtMapViewOfSection\n" "NtMapViewOfSection:\n\tjmp *(imports+108)\n\tmovl %esi,%esi\n" "\t.size NtMapViewOfSection, . - NtMapViewOfSection\n" "\t.type NtOpenKey,@function\n" "\t.globl NtOpenKey\n" "NtOpenKey:\n\tjmp *(imports+112)\n\tmovl %esi,%esi\n" "\t.size NtOpenKey, . - NtOpenKey\n" "\t.type NtQueryValueKey,@function\n" "\t.globl NtQueryValueKey\n" "NtQueryValueKey:\n\tjmp *(imports+116)\n\tmovl %esi,%esi\n" "\t.size NtQueryValueKey, . - NtQueryValueKey\n" "\t.type NtReadFile,@function\n" "\t.globl NtReadFile\n" "NtReadFile:\n\tjmp *(imports+120)\n\tmovl %esi,%esi\n" "\t.size NtReadFile, . - NtReadFile\n" "\t.type NtUnmapViewOfSection,@function\n" "\t.globl NtUnmapViewOfSection\n" "NtUnmapViewOfSection:\n\tjmp *(imports+124)\n\tmovl %esi,%esi\n" "\t.size NtUnmapViewOfSection, . - NtUnmapViewOfSection\n" "\t.type NtWriteFile,@function\n" "\t.globl NtWriteFile\n" "NtWriteFile:\n\tjmp *(imports+128)\n\tmovl %esi,%esi\n" "\t.size NtWriteFile, . - NtWriteFile\n" "\t.type RtlAllocateHeap,@function\n" "\t.globl RtlAllocateHeap\n" "RtlAllocateHeap:\n\tjmp *(imports+132)\n\tmovl %esi,%esi\n" "\t.size RtlAllocateHeap, . - RtlAllocateHeap\n" "\t.type RtlAppendUnicodeToString,@function\n" "\t.globl RtlAppendUnicodeToString\n" "RtlAppendUnicodeToString:\n\tjmp *(imports+136)\n\tmovl %esi,%esi\n" "\t.size RtlAppendUnicodeToString, . - RtlAppendUnicodeToString\n" "\t.type RtlCheckRegistryKey,@function\n" "\t.globl RtlCheckRegistryKey\n" "RtlCheckRegistryKey:\n\tjmp *(imports+140)\n\tmovl %esi,%esi\n" "\t.size RtlCheckRegistryKey, . - RtlCheckRegistryKey\n" "\t.type RtlCompareUnicodeString,@function\n" "\t.globl RtlCompareUnicodeString\n" "RtlCompareUnicodeString:\n\tjmp *(imports+144)\n\tmovl %esi,%esi\n" "\t.size RtlCompareUnicodeString, . - RtlCompareUnicodeString\n" "\t.type RtlCreateUnicodeString,@function\n" "\t.globl RtlCreateUnicodeString\n" "RtlCreateUnicodeString:\n\tjmp *(imports+148)\n\tmovl %esi,%esi\n" "\t.size RtlCreateUnicodeString, . - RtlCreateUnicodeString\n" "\t.type RtlFreeHeap,@function\n" "\t.globl RtlFreeHeap\n" "RtlFreeHeap:\n\tjmp *(imports+152)\n\tmovl %esi,%esi\n" "\t.size RtlFreeHeap, . - RtlFreeHeap\n" "\t.type RtlGetVersion,@function\n" "\t.globl RtlGetVersion\n" "RtlGetVersion:\n\tjmp *(imports+156)\n\tmovl %esi,%esi\n" "\t.size RtlGetVersion, . - RtlGetVersion\n" "\t.type RtlImageNtHeader,@function\n" "\t.globl RtlImageNtHeader\n" "RtlImageNtHeader:\n\tjmp *(imports+160)\n\tmovl %esi,%esi\n" "\t.size RtlImageNtHeader, . - RtlImageNtHeader\n" "\t.type RtlInitUnicodeString,@function\n" "\t.globl RtlInitUnicodeString\n" "RtlInitUnicodeString:\n\tjmp *(imports+164)\n\tmovl %esi,%esi\n" "\t.size RtlInitUnicodeString, . - RtlInitUnicodeString\n" "\t.type RtlReAllocateHeap,@function\n" "\t.globl RtlReAllocateHeap\n" "RtlReAllocateHeap:\n\tjmp *(imports+168)\n\tmovl %esi,%esi\n" "\t.size RtlReAllocateHeap, . - RtlReAllocateHeap\n" "\t.size __wine_spec_import_thunks, . - __wine_spec_import_thunks\n" ".text"); #ifndef __GNUC__ } #endif static int __wine_spec_init_state; extern int __wine_main_argc; extern char **__wine_main_argv; extern char **__wine_main_environ; extern unsigned short **__wine_main_wargv; extern void _init(int, char**, char**); extern void _fini(); #ifdef __GNUC__ # ifdef __APPLE__ extern int __stdcall DllMain(void*, unsigned int, void*) __attribute__((weak_import)); static int __stdcall (*__wine_spec_weak_DllMain)(void*, unsigned int, void*) = DllMain; #define DllMain __wine_spec_weak_DllMain # else extern int __stdcall DllMain(void*, unsigned int, void*) __attribute__((weak)); # endif #else extern int __stdcall DllMain(void*, unsigned int, void*); static void __asm__dummy_DllMain(void) { asm(".weak DllMain"); } #endif static int __stdcall __wine_dll_main( void *inst, unsigned int reason, void *reserved ) { int ret; if (reason == 1 && __wine_spec_init_state == 1) _init( __wine_main_argc, __wine_main_argv, __wine_main_environ ); ret = DllMain ? DllMain( inst, reason, reserved ) : 1; if (reason == 0 && __wine_spec_init_state == 1) _fini(); return ret; } static const struct image_nt_headers { int Signature; struct file_header { short Machine; short NumberOfSections; int TimeDateStamp; void *PointerToSymbolTable; int NumberOfSymbols; short SizeOfOptionalHeader; short Characteristics; } FileHeader; struct opt_header { short Magic; char MajorLinkerVersion, MinorLinkerVersion; int SizeOfCode; int SizeOfInitializedData; int SizeOfUninitializedData; void *AddressOfEntryPoint; void *BaseOfCode; void *BaseOfData; void *ImageBase; int SectionAlignment; int FileAlignment; short MajorOperatingSystemVersion; short MinorOperatingSystemVersion; short MajorImageVersion; short MinorImageVersion; short MajorSubsystemVersion; short MinorSubsystemVersion; int Win32VersionValue; void *SizeOfImage; int SizeOfHeaders; int CheckSum; short Subsystem; short DllCharacteristics; int SizeOfStackReserve; int SizeOfStackCommit; int SizeOfHeapReserve; int SizeOfHeapCommit; int LoaderFlags; int NumberOfRvaAndSizes; struct { const void *VirtualAddress; int Size; } DataDirectory[16]; } OptionalHeader; } nt_header = { 0x4550, { 0x014c, 0, 0, 0, 0, sizeof(nt_header.OptionalHeader), 0x2000 }, { 0x010b, 0, 0, 0, 0, 0, __wine_dll_main, 0, __wine_spec_data_start, __wine_spec_pe_header, 4096, 4096, 1, 0, 0, 0, 4, 0, 0, _end, 4096, 0, 0x0000, 0, 1048576, 4096, 1048576, 4096, 0, 16, { { __wine_spec_exports, 264 }, { &imports, sizeof(imports) }, { 0, 0 }, } } }; void __wine_spec_init(void) { extern void __wine_dll_register( const struct image_nt_headers *, const char * ); __wine_spec_init_state = 1; __wine_dll_register( &nt_header, "ntoskrnl.sspec" ); } #ifndef __GNUC__ static void __asm__dummy_dll_init(void) { #endif asm("\t.section\t\".init\" ,\"ax\"\n" "\tcall __wine_spec_init_ctor\n" "\t.section\t\".text\"\n"); #ifndef __GNUC__ } #endif void __wine_spec_init_ctor(void) { if (__wine_spec_init_state) return; __wine_spec_init(); __wine_spec_init_state = 2; }
ntoskrnl.strace.bz2
Description: application/bzip