This repository was archived by the owner on Jul 5, 2024. It is now read-only.
forked from Squirrel/Squirrel.Windows
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New setup architecture; more cross platform friendly and no need to l…
…oad everything into memory
- Loading branch information
Showing
45 changed files
with
886 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "bundle_marker.h" | ||
#include <windows.h> | ||
#include <string> | ||
|
||
using namespace std; | ||
|
||
void bundle_marker_t::header_offset(int64_t* pOffset, int64_t* pLength) | ||
{ | ||
// Contains the bundle_placeholder default value at compile time. | ||
// the first 8 bytes are replaced by squirrel with the offset | ||
// where the package is located. | ||
static volatile uint8_t placeholder[] = | ||
{ | ||
// 8 bytes represent the package offset | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
// 8 bytes represent the package length | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
// 64 bytes represent the bundle signature: SHA-256 for "squirrel bundle" | ||
0x94, 0xf0, 0xb1, 0x7b, 0x68, 0x93, 0xe0, 0x29, | ||
0x37, 0xeb, 0x34, 0xef, 0x53, 0xaa, 0xe7, 0xd4, | ||
0x2b, 0x54, 0xf5, 0x70, 0x7e, 0xf5, 0xd6, 0xf5, | ||
0x78, 0x54, 0x98, 0x3e, 0x5e, 0x94, 0xed, 0x7d | ||
}; | ||
|
||
volatile bundle_marker_t* marker = reinterpret_cast<volatile bundle_marker_t*>(placeholder); | ||
*pOffset = marker->locator.bundle_header_offset; | ||
*pLength = marker->locator.bundle_header_length; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef __BUNDLE_MARKER_H__ | ||
#define __BUNDLE_MARKER_H__ | ||
|
||
#include <cstdint> | ||
|
||
#pragma pack(push, 1) | ||
union bundle_marker_t | ||
{ | ||
public: | ||
uint8_t placeholder[48]; | ||
struct | ||
{ | ||
int64_t bundle_header_offset; | ||
int64_t bundle_header_length; | ||
uint8_t signature[32]; | ||
} locator; | ||
|
||
static void header_offset(int64_t* pOffset, int64_t* pLength); | ||
static bool is_bundle() | ||
{ | ||
int64_t offset, length; | ||
header_offset(&offset, &length); | ||
return offset != 0; | ||
} | ||
}; | ||
#pragma pack(pop) | ||
|
||
#endif // __BUNDLE_MARKER_H__ |
Oops, something went wrong.