Skip to content

Commit 9f52e1b

Browse files
authored
x64 compat (#6)
* ignore * small header * remove crashes * fix launch process x64 * hint * debug hw tree * workflow
1 parent 79bfe77 commit 9f52e1b

13 files changed

Lines changed: 113 additions & 90 deletions

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,22 @@ jobs:
4343
run: |
4444
C:\WinDDK\7600.16385.1\bin\setenv.bat C:\WinDDK\7600.16385.1 fre x64 WIN7 && D: && cd ${{ github.workspace }}\srcdir && build /g /w
4545
shell: cmd
46-
- name: Upload artifact x86
46+
- name: Upload artifact i386
4747
uses: actions/upload-artifact@v4
4848
with:
49-
name: nativeshell
49+
name: nativeshell-i386
5050
path: |
5151
${{ github.workspace }}\srcdir\objfre_wxp_x86\i386\native.exe
5252
${{ github.workspace }}\srcdir\install\*
5353
${{ github.workspace }}\srcdir\README.md
5454
retention-days: 1
55-
- name: Upload artifact x64
55+
- name: Upload artifact amd64
5656
uses: actions/upload-artifact@v4
5757
with:
58-
name: nativeshell-x64-alpha
59-
path: ${{ github.workspace }}\srcdir\objfre_win7_amd64\amd64\native.exe
58+
name: nativeshell-amd64
59+
path: |
60+
${{ github.workspace }}\srcdir\objfre_win7_amd64\amd64\native.exe
61+
${{ github.workspace }}\srcdir\install\*
62+
${{ github.workspace }}\srcdir\README.md
6063
retention-days: 1
6164

.github/workflows/release.yml

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ jobs:
1414
name: Release
1515
runs-on: ubuntu-latest
1616
steps:
17-
- name: Download artifact
18-
uses: actions/download-artifact@v4
19-
with:
20-
name: nativeshell
21-
- name: Display structure of downloaded files
22-
run: ls -R
23-
- name: Prepare release artifact
24-
run: |
25-
zip -r --junk-paths nativeshell.zip ./*
2617
- name: Create release
2718
uses: actions/create-release@v1
2819
id: create_release
@@ -31,17 +22,43 @@ jobs:
3122
prerelease: false
3223
release_name: Release ${{ github.ref }}
3324
tag_name: ${{ github.ref }}
34-
body: NT Native Executable and install files
25+
body: NT native executable and install files
3526
env:
3627
GITHUB_TOKEN: ${{ github.token }}
37-
- name: Upload release artifact
28+
- name: Download i386 binary
29+
uses: actions/download-artifact@v4
30+
working-directory: ${{ github.workspace }}/i386
31+
with:
32+
name: nativeshell-i386
33+
- name: Prepare release i386 binary
34+
working-directory: ${{ github.workspace }}/i386
35+
run: |
36+
zip -r --junk-paths nativeshell.zip ./*
37+
- name: Release i386 binary
3838
uses: actions/upload-release-asset@v1
3939
env:
4040
GITHUB_TOKEN: ${{ github.token }}
4141
with:
4242
upload_url: ${{ steps.create_release.outputs.upload_url }}
43-
asset_path: ${{ github.workspace }}/nativeshell.zip
43+
asset_path: ${{ github.workspace }}/i386/nativeshell.zip
4444
asset_name: nativeshell-${GITHUB_REF##*/}.i386.zip
4545
asset_content_type: application/zip
46-
46+
- name: Download amd64 binary
47+
uses: actions/download-artifact@v4
48+
working-directory: ${{ github.workspace }}/amd64
49+
with:
50+
name: nativeshell-amd64
51+
- name: Prepare release amd64 binary
52+
working-directory: ${{ github.workspace }}/amd64
53+
run: |
54+
zip -r --junk-paths nativeshell.zip ./*
55+
- name: Release amd64 binary
56+
uses: actions/upload-release-asset@v1
57+
env:
58+
GITHUB_TOKEN: ${{ github.token }}
59+
with:
60+
upload_url: ${{ steps.create_release.outputs.upload_url }}
61+
asset_path: ${{ github.workspace }}/amd64/nativeshell.zip
62+
asset_name: nativeshell-${GITHUB_REF##*/}.amd64.zip
63+
asset_content_type: application/zip
4764

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
objfre_wxp_x86
44
objfre_win7_amd64
55
*.err
6-
*.wrn
6+
*.wrn
7+
*.cmd

b.cmd

Lines changed: 0 additions & 1 deletion
This file was deleted.

file.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ RtlCliSetCurrentDirectory(PCHAR Directory)
9090
GetFullPath(Directory, buf, TRUE);
9191
RtlInitUnicodeString(&us, buf);
9292
RtlSetCurrentDirectory_U(&us);
93-
RtlFreeUnicodeString(&us);
9493

9594
return STATUS_SUCCESS;
9695
}

hardware.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,15 @@ RtlCliListHardwareTree(VOID)
247247
// Get the root node's child
248248
//
249249
Status = RtlCliGetChildOrSibling(ROOT_NAME, Buffer, PNP_GET_CHILD_DEVICE);
250-
250+
if (!NT_SUCCESS(Status)) {
251+
RtlCliDisplayString("NtPlugPlayControl get root node failed.\n");
252+
}
251253
//
252254
// Now get the entire tree
253255
//
254256
Status = RtlCliListSubNodes(ROOT_NAME, NULL, Buffer);
257+
if (!NT_SUCCESS(Status)) {
258+
RtlCliDisplayString("NtPlugPlayControl get child nodes failed.\n");
259+
}
255260
return Status;
256261
}

main.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ HANDLE hKey;
3636

3737
#define __APP_VER__ "0.13.2"
3838
#if defined(_M_AMD64) || defined(_AMD64_)
39-
#define __NCLI_VER__ __APP_VER__ "-alpha (x64)"
39+
#define __NCLI_VER__ __APP_VER__ "-alpha x64"
4040
#else
41-
#define __NCLI_VER__ __APP_VER__ " (x86)"
41+
#define __NCLI_VER__ __APP_VER__ " x86"
4242
#endif
4343

4444
WCHAR *helpstr[] =
@@ -168,8 +168,6 @@ RtlClipProcessMessage(PCHAR Command)
168168
//
169169
RtlInitUnicodeString(&CurrentDirectoryString, CurrentDirectory);
170170
RtlCliPrintString(&CurrentDirectoryString);
171-
172-
RtlFreeUnicodeString(&CurrentDirectoryString);
173171
}
174172
else if (!_strnicmp(Command, "dir", 3))
175173
{
@@ -343,21 +341,19 @@ RtlClipProcessMessage(PCHAR Command)
343341
RtlAnsiStringToUnicodeString(&us, &as, TRUE);
344342

345343
NtClose(hKeyboard);
346-
//RtlCliDisplayString("Keyboard is closed\n");
347344

348345
CreateNativeProcess(filename, us.Buffer, &hProcess);
349346

350-
RtlFreeAnsiString(&as);
351347
RtlFreeUnicodeString(&us);
352348

353-
//RtlCliDisplayString("Waiting for process terminations\n");
354349
NtWaitForSingleObject(hProcess, FALSE, NULL);
355350

356351
RtlCliOpenInputDevice(&hKeyboard, KeyboardType);
357-
//RtlCliDisplayString("Keyboard restored\n");
358352
} else
359353
{
360-
RtlCliDisplayString("%s not recognized\n", Command);
354+
RtlCliDisplayString("%s not recognized\n"
355+
"Add .exe if you want to lauch executable file."
356+
"\nType \"help\" for the list of commands.\n", Command);
361357
}
362358
}
363359
}
@@ -434,10 +430,7 @@ main(INT argc,
434430
//
435431
// Show banner
436432
//
437-
RtlCliDisplayString("Native Shell [Version " __NCLI_VER__ "] (" __DATE__ " " __TIME__ ")\n");
438-
RtlCliDisplayString("(C) Copyright 2010-2025 amdf\n");
439-
RtlCliDisplayString("(C) Copyright 2006 TinyKRNL Project\n\n");
440-
RtlCliDisplayString("Type \"help\".\n\n");
433+
RtlCliDisplayString("Native Shell v" __NCLI_VER__ " (" __DATE__ " " __TIME__ ")\n\n");
441434

442435
//
443436
// Setup keyboard input

ndk/mmtypes.h

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ typedef struct _SECTION_IMAGE_INFORMATION
302302
{
303303
PVOID TransferAddress;
304304
ULONG ZeroBits;
305-
ULONG MaximumStackSize;
306-
ULONG CommittedStackSize;
305+
SIZE_T MaximumStackSize;
306+
SIZE_T CommittedStackSize;
307307
ULONG SubSystemType;
308308
union
309309
{
@@ -314,22 +314,32 @@ typedef struct _SECTION_IMAGE_INFORMATION
314314
};
315315
ULONG SubSystemVersion;
316316
};
317-
ULONG GpValue;
317+
union
318+
{
319+
struct
320+
{
321+
USHORT MajorOperatingSystemVersion;
322+
USHORT MinorOperatingSystemVersion;
323+
};
324+
ULONG OperatingSystemVersion;
325+
};
318326
USHORT ImageCharacteristics;
319-
USHORT DllChracteristics;
327+
USHORT DllCharacteristics;
320328
USHORT Machine;
321-
UCHAR ImageContainsCode;
329+
BOOLEAN ImageContainsCode;
322330
union
323331
{
332+
UCHAR ImageFlags;
324333
struct
325334
{
326-
UCHAR ComPlusNativeReady:1;
327-
UCHAR ComPlusILOnly:1;
328-
UCHAR ImageDynamicallyRelocated:1;
329-
UCHAR ImageMappedFlat:1;
330-
UCHAR Reserved:4;
335+
UCHAR ComPlusNativeReady : 1;
336+
UCHAR ComPlusILOnly : 1;
337+
UCHAR ImageDynamicallyRelocated : 1;
338+
UCHAR ImageMappedFlat : 1;
339+
UCHAR BaseBelow4gb : 1;
340+
UCHAR ComPlusPrefer32bit : 1;
341+
UCHAR Reserved : 2;
331342
};
332-
UCHAR ImageFlags;
333343
};
334344
ULONG LoaderFlags;
335345
ULONG ImageFileSize;

ntfile.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,9 @@ BOOLEAN NtFileDeleteFile(PCWSTR filename)
314314

315315
if (!NT_SUCCESS(status))
316316
{
317-
RtlFreeUnicodeString(&us);
318317
return FALSE;
319318
}
320319

321-
RtlFreeUnicodeString(&us);
322320
return TRUE;
323321
}
324322

@@ -353,18 +351,15 @@ BOOLEAN NtFileCreateDirectory(PCWSTR dirname)
353351
if (NT_SUCCESS(status))
354352
{
355353
NtClose(hFile);
356-
RtlFreeUnicodeString(&us);
357354
return TRUE;
358355
}
359356

360357
/* if it already exists then return success */
361358
if (status == STATUS_OBJECT_NAME_COLLISION)
362359
{
363-
RtlFreeUnicodeString(&us);
364360
return TRUE;
365361
}
366362

367-
RtlFreeUnicodeString(&us);
368363
return FALSE;
369364
}
370365

precomp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ NTSTATUS RegReadValue(HANDLE hKey, PWCHAR key_name, OUT PULONG type, OUT PVOID d
192192

193193
// Misc
194194

195-
void FillUnicodeStringWithAnsi(OUT PUNICODE_STRING us, IN PCHAR as);
195+
// void FillUnicodeStringWithAnsi(OUT PUNICODE_STRING us, IN PCHAR as);
196196

197197
//===========================================================
198198
//

0 commit comments

Comments
 (0)