Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,22 @@ jobs:
run: |
C:\WinDDK\7600.16385.1\bin\setenv.bat C:\WinDDK\7600.16385.1 fre x64 WIN7 && D: && cd ${{ github.workspace }}\srcdir && build /g /w
shell: cmd
- name: Upload artifact x86
- name: Upload artifact i386
uses: actions/upload-artifact@v4
with:
name: nativeshell
name: nativeshell-i386
path: |
${{ github.workspace }}\srcdir\objfre_wxp_x86\i386\native.exe
${{ github.workspace }}\srcdir\install\*
${{ github.workspace }}\srcdir\README.md
retention-days: 1
- name: Upload artifact x64
- name: Upload artifact amd64
uses: actions/upload-artifact@v4
with:
name: nativeshell-x64-alpha
path: ${{ github.workspace }}\srcdir\objfre_win7_amd64\amd64\native.exe
name: nativeshell-amd64
path: |
${{ github.workspace }}\srcdir\objfre_win7_amd64\amd64\native.exe
${{ github.workspace }}\srcdir\install\*
${{ github.workspace }}\srcdir\README.md
retention-days: 1

43 changes: 30 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: nativeshell
- name: Display structure of downloaded files
run: ls -R
- name: Prepare release artifact
run: |
zip -r --junk-paths nativeshell.zip ./*
- name: Create release
uses: actions/create-release@v1
id: create_release
Expand All @@ -31,17 +22,43 @@ jobs:
prerelease: false
release_name: Release ${{ github.ref }}
tag_name: ${{ github.ref }}
body: NT Native Executable and install files
body: NT native executable and install files
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload release artifact
- name: Download i386 binary
uses: actions/download-artifact@v4
working-directory: ${{ github.workspace }}/i386
with:
name: nativeshell-i386
- name: Prepare release i386 binary
working-directory: ${{ github.workspace }}/i386
run: |
zip -r --junk-paths nativeshell.zip ./*
- name: Release i386 binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/nativeshell.zip
asset_path: ${{ github.workspace }}/i386/nativeshell.zip
asset_name: nativeshell-${GITHUB_REF##*/}.i386.zip
asset_content_type: application/zip

- name: Download amd64 binary
uses: actions/download-artifact@v4
working-directory: ${{ github.workspace }}/amd64
with:
name: nativeshell-amd64
- name: Prepare release amd64 binary
working-directory: ${{ github.workspace }}/amd64
run: |
zip -r --junk-paths nativeshell.zip ./*
- name: Release amd64 binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/amd64/nativeshell.zip
asset_name: nativeshell-${GITHUB_REF##*/}.amd64.zip
asset_content_type: application/zip

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
objfre_wxp_x86
objfre_win7_amd64
*.err
*.wrn
*.wrn
*.cmd
1 change: 0 additions & 1 deletion b.cmd

This file was deleted.

1 change: 0 additions & 1 deletion file.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ RtlCliSetCurrentDirectory(PCHAR Directory)
GetFullPath(Directory, buf, TRUE);
RtlInitUnicodeString(&us, buf);
RtlSetCurrentDirectory_U(&us);
RtlFreeUnicodeString(&us);

return STATUS_SUCCESS;
}
Expand Down
7 changes: 6 additions & 1 deletion hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,15 @@ RtlCliListHardwareTree(VOID)
// Get the root node's child
//
Status = RtlCliGetChildOrSibling(ROOT_NAME, Buffer, PNP_GET_CHILD_DEVICE);

if (!NT_SUCCESS(Status)) {
RtlCliDisplayString("NtPlugPlayControl get root node failed.\n");
}
//
// Now get the entire tree
//
Status = RtlCliListSubNodes(ROOT_NAME, NULL, Buffer);
if (!NT_SUCCESS(Status)) {
RtlCliDisplayString("NtPlugPlayControl get child nodes failed.\n");
}
return Status;
}
19 changes: 6 additions & 13 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ HANDLE hKey;

#define __APP_VER__ "0.13.2"
#if defined(_M_AMD64) || defined(_AMD64_)
#define __NCLI_VER__ __APP_VER__ "-alpha (x64)"
#define __NCLI_VER__ __APP_VER__ "-alpha x64"
#else
#define __NCLI_VER__ __APP_VER__ " (x86)"
#define __NCLI_VER__ __APP_VER__ " x86"
#endif

WCHAR *helpstr[] =
Expand Down Expand Up @@ -168,8 +168,6 @@ RtlClipProcessMessage(PCHAR Command)
//
RtlInitUnicodeString(&CurrentDirectoryString, CurrentDirectory);
RtlCliPrintString(&CurrentDirectoryString);

RtlFreeUnicodeString(&CurrentDirectoryString);
}
else if (!_strnicmp(Command, "dir", 3))
{
Expand Down Expand Up @@ -343,21 +341,19 @@ RtlClipProcessMessage(PCHAR Command)
RtlAnsiStringToUnicodeString(&us, &as, TRUE);

NtClose(hKeyboard);
//RtlCliDisplayString("Keyboard is closed\n");

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

RtlFreeAnsiString(&as);
RtlFreeUnicodeString(&us);

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

RtlCliOpenInputDevice(&hKeyboard, KeyboardType);
//RtlCliDisplayString("Keyboard restored\n");
} else
{
RtlCliDisplayString("%s not recognized\n", Command);
RtlCliDisplayString("%s not recognized\n"
"Add .exe if you want to lauch executable file."
"\nType \"help\" for the list of commands.\n", Command);
}
}
}
Expand Down Expand Up @@ -434,10 +430,7 @@ main(INT argc,
//
// Show banner
//
RtlCliDisplayString("Native Shell [Version " __NCLI_VER__ "] (" __DATE__ " " __TIME__ ")\n");
RtlCliDisplayString("(C) Copyright 2010-2025 amdf\n");
RtlCliDisplayString("(C) Copyright 2006 TinyKRNL Project\n\n");
RtlCliDisplayString("Type \"help\".\n\n");
RtlCliDisplayString("Native Shell v" __NCLI_VER__ " (" __DATE__ " " __TIME__ ")\n\n");

//
// Setup keyboard input
Expand Down
32 changes: 21 additions & 11 deletions ndk/mmtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ typedef struct _SECTION_IMAGE_INFORMATION
{
PVOID TransferAddress;
ULONG ZeroBits;
ULONG MaximumStackSize;
ULONG CommittedStackSize;
SIZE_T MaximumStackSize;
SIZE_T CommittedStackSize;
ULONG SubSystemType;
union
{
Expand All @@ -314,22 +314,32 @@ typedef struct _SECTION_IMAGE_INFORMATION
};
ULONG SubSystemVersion;
};
ULONG GpValue;
union
{
struct
{
USHORT MajorOperatingSystemVersion;
USHORT MinorOperatingSystemVersion;
};
ULONG OperatingSystemVersion;
};
USHORT ImageCharacteristics;
USHORT DllChracteristics;
USHORT DllCharacteristics;
USHORT Machine;
UCHAR ImageContainsCode;
BOOLEAN ImageContainsCode;
union
{
UCHAR ImageFlags;
struct
{
UCHAR ComPlusNativeReady:1;
UCHAR ComPlusILOnly:1;
UCHAR ImageDynamicallyRelocated:1;
UCHAR ImageMappedFlat:1;
UCHAR Reserved:4;
UCHAR ComPlusNativeReady : 1;
UCHAR ComPlusILOnly : 1;
UCHAR ImageDynamicallyRelocated : 1;
UCHAR ImageMappedFlat : 1;
UCHAR BaseBelow4gb : 1;
UCHAR ComPlusPrefer32bit : 1;
UCHAR Reserved : 2;
};
UCHAR ImageFlags;
};
ULONG LoaderFlags;
ULONG ImageFileSize;
Expand Down
5 changes: 0 additions & 5 deletions ntfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,9 @@ BOOLEAN NtFileDeleteFile(PCWSTR filename)

if (!NT_SUCCESS(status))
{
RtlFreeUnicodeString(&us);
return FALSE;
}

RtlFreeUnicodeString(&us);
return TRUE;
}

Expand Down Expand Up @@ -353,18 +351,15 @@ BOOLEAN NtFileCreateDirectory(PCWSTR dirname)
if (NT_SUCCESS(status))
{
NtClose(hFile);
RtlFreeUnicodeString(&us);
return TRUE;
}

/* if it already exists then return success */
if (status == STATUS_OBJECT_NAME_COLLISION)
{
RtlFreeUnicodeString(&us);
return TRUE;
}

RtlFreeUnicodeString(&us);
return FALSE;
}

Expand Down
2 changes: 1 addition & 1 deletion precomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ NTSTATUS RegReadValue(HANDLE hKey, PWCHAR key_name, OUT PULONG type, OUT PVOID d

// Misc

void FillUnicodeStringWithAnsi(OUT PUNICODE_STRING us, IN PCHAR as);
// void FillUnicodeStringWithAnsi(OUT PUNICODE_STRING us, IN PCHAR as);

//===========================================================
//
Expand Down
20 changes: 14 additions & 6 deletions process.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,26 @@ NTSTATUS CreateNativeProcess(IN PCWSTR file_name, IN PCWSTR cmd_line, OUT PHANDL
status = RtlCreateUserProcess(&imgpath, OBJ_CASE_INSENSITIVE, processparameters,
NULL, NULL, NULL, FALSE, NULL, NULL, &processinformation);

if (processinformation.ImageInformation.SubSystemType != IMAGE_SUBSYSTEM_NATIVE)
{
RtlCliDisplayString("\nThe %S application cannot be run in native mode.\n", file_name);
return STATUS_UNSUCCESSFUL;
}

if (!NT_SUCCESS(status))
{
RtlCliDisplayString("RtlCreateUserProcess failed\n");
return STATUS_UNSUCCESSFUL;
}

if (processinformation.ImageInformation.SubSystemType != IMAGE_SUBSYSTEM_NATIVE)
{
RtlCliDisplayString("\nThe %S application cannot be run in native mode.\n"
"Subsystem: %d\n"
"Subsystem version: %d\n"
"Machine: %d\n",
file_name,
processinformation.ImageInformation.SubSystemType,
processinformation.ImageInformation.SubSystemVersion,
processinformation.ImageInformation.Machine
);
return STATUS_UNSUCCESSFUL;
}

status = NtResumeThread(processinformation.ThreadHandle, NULL);

if (!NT_SUCCESS(status))
Expand Down
28 changes: 12 additions & 16 deletions shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ BOOL GetFullPath(IN PCSTR filename, OUT PWSTR out, IN BOOL add_slash)
}

RtlFreeUnicodeString(&us);
RtlFreeAnsiString(&as);
} else
{
RtlInitAnsiString(&as, filename);
Expand All @@ -57,7 +56,6 @@ BOOL GetFullPath(IN PCSTR filename, OUT PWSTR out, IN BOOL add_slash)
}

RtlFreeUnicodeString(&us);
RtlFreeAnsiString(&as);
}
return TRUE;
}
Expand Down Expand Up @@ -183,7 +181,6 @@ BOOL FolderExists(PCWSTR foldername)

RtlInitUnicodeString(&u_filename, foldername);
RtlDosPathNameToNtPathName_U(u_filename.Buffer, &nt_filename, NULL, NULL);
RtlFreeUnicodeString(&u_filename);

InitializeObjectAttributes(&oa, &nt_filename, OBJ_CASE_INSENSITIVE, 0, 0);
st = NtQueryAttributesFile(&oa, &fbi);
Expand Down Expand Up @@ -211,7 +208,6 @@ BOOL FileExists(PCWSTR filename)

RtlInitUnicodeString(&u_filename, filename);
RtlDosPathNameToNtPathName_U(u_filename.Buffer, &nt_filename, NULL, NULL);
RtlFreeUnicodeString(&u_filename);

InitializeObjectAttributes(&oa, &nt_filename, OBJ_CASE_INSENSITIVE, 0, 0);
st = NtQueryAttributesFile(&oa, &fbi);
Expand Down Expand Up @@ -327,18 +323,18 @@ UINT GetStringLength(WCHAR* pszInput)
}

// Note: This function allocates memory for "us" variable.
void FillUnicodeStringWithAnsi(OUT PUNICODE_STRING us, IN PCHAR as)
{
ANSI_STRING ansi_string;
// void FillUnicodeStringWithAnsi(OUT PUNICODE_STRING us, IN PCHAR as)
// {
// ANSI_STRING ansi_string;

RtlInitAnsiString(&ansi_string, as);
// RtlInitAnsiString(&ansi_string, as);

if (!NT_SUCCESS(RtlAnsiStringToUnicodeString(us, &ansi_string, TRUE)))
{
RtlCliDisplayString("RtlAnsiStringToUnicodeString() failed\n");
return;
}
// if (!NT_SUCCESS(RtlAnsiStringToUnicodeString(us, &ansi_string, TRUE)))
// {
// RtlCliDisplayString("RtlAnsiStringToUnicodeString() failed\n");
// return;
// }

RtlFreeAnsiString(&ansi_string);
return;
}
// RtlFreeAnsiString(&ansi_string);
// return;
// }
Loading