mirror of
https://github.com/slorelee/wimbuilder2.git
synced 2025-05-06 18:25:51 +08:00
port Wim_builder code
This commit is contained in:
parent
6e8f9e2f93
commit
0cea21f5b5
49
WimBuilder.cmd
Normal file
49
WimBuilder.cmd
Normal file
@ -0,0 +1,49 @@
|
||||
@echo off
|
||||
cd /d "%~dp0"
|
||||
title WimBuilder(%cd%)
|
||||
|
||||
rem run with Administrators right
|
||||
bin\IsAdmin.exe
|
||||
if not ERRORLEVEL 1 (
|
||||
if not "x%~1"=="xrunas" (
|
||||
set ElevateMe=1
|
||||
bin\ElevateMe.vbs "%~0" "runas" %*
|
||||
)
|
||||
goto :EOF
|
||||
)
|
||||
if "x%~1"=="xrunas" (SHIFT)
|
||||
|
||||
|
||||
rem init i18n file
|
||||
set "I18N_SCRIPT=%~dp0i18n\i18n_.wsf"
|
||||
for /f "delims=" %%i in ('cscript.exe //nologo "%I18N_SCRIPT%" init') do set LocaleID=%%i
|
||||
if "x%LocaleID%"=="x" set LocaleID=0
|
||||
set I18N_LCID=%LocaleID%
|
||||
if not exist i18n\%LocaleID%.vbs (
|
||||
set I18N_LCID=0
|
||||
goto :MAIN_ENTRY
|
||||
)
|
||||
|
||||
set "I18N_SCRIPT=%~dp0i18n\i18n.wsf"
|
||||
if not exist i18n\0.vbs goto :UPDATE_I18NRES
|
||||
fc /b i18n\%LocaleID%.vbs i18n\0.vbs>nul
|
||||
if not ERRORLEVEL 1 goto :MAIN_ENTRY
|
||||
|
||||
:UPDATE_I18NRES
|
||||
copy /y i18n\%LocaleID%.vbs i18n\0.vbs
|
||||
|
||||
:MAIN_ENTRY
|
||||
set "root=%~dp0"
|
||||
set "Factory=%root%_Factory_"
|
||||
|
||||
rem ======set bin PATH======
|
||||
set "PATH=%root%bin;%PATH%"
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
|
||||
set "PATH=%root%bin\x64;%PATH%"
|
||||
) else (
|
||||
set "PATH=%root%bin\x86;%PATH%"
|
||||
)
|
||||
set "PATH=%root%lib\macros;%PATH%"
|
||||
rem ========================
|
||||
|
||||
start WimBuilder_UI.hta %*
|
@ -4,9 +4,15 @@ var $height = 800;
|
||||
var $i18n = {};
|
||||
var $lang = 'en-US';
|
||||
|
||||
var $wb_workspace = 'D:\WB_workspace';
|
||||
var $wb_src = 'D:\WB_workspace\mnt\install.wim';
|
||||
var $wb_base = 'D:\WB_workspace\mnt\winre.wim';
|
||||
var $wb_straight_mode = '1';
|
||||
var $wb_workspace = 'D:\\WB_workspace';
|
||||
var $wb_src = 'D:\\WB_workspace\\mnt\\install.wim';
|
||||
var $wb_base = 'D:\\WB_workspace\\mnt\\winre.wim';
|
||||
|
||||
var $wb_src_idx = '-';
|
||||
var $wb_base_idx = '1';
|
||||
var $wb_src_index = '-';
|
||||
var $wb_base_index = '1';
|
||||
|
||||
//skip update files' rights operation
|
||||
var $wb_skip_ufr = '1';
|
||||
//skip update registry's rights operation
|
||||
var $wb_skip_urr = '1';
|
||||
|
@ -1,6 +1,19 @@
|
||||
function sleep(n) {
|
||||
var start = new Date().getTime();
|
||||
while (true) if (new Date().getTime() - start > n) break;
|
||||
function structure_env() {
|
||||
var env = wsh.Environment("PROCESS");
|
||||
env('WB_STRAIGHT_MODE') = $wb_straight_mode;
|
||||
|
||||
env('WB_WORKSPACE') = $wb_workspace;
|
||||
env('WB_SRC') = $wb_src;
|
||||
env('WB_BASE') = $wb_base;
|
||||
env('WB_SRC_INDEX') = $wb_src_index;
|
||||
env('WB_BASE_INDEX') = $wb_base_index;
|
||||
|
||||
|
||||
env('WB_PROJECT') = selected_project;
|
||||
env('WB_SKIP_UFR') = $wb_skip_ufr;
|
||||
env('WB_SKIP_URR') = $wb_skip_urr;
|
||||
|
||||
//env('WB_OPT_SHELL') = $WB_OPT['shell'];
|
||||
}
|
||||
|
||||
//WshHide 0;WshNormalFocus 1;WshMinimizedNoFocus 6
|
||||
@ -10,7 +23,8 @@ function run_build() {
|
||||
return;
|
||||
}
|
||||
$('#build_stdout').empty();
|
||||
wsh.run('Projects\\' + selected_project + '\\init.bat',1,true);
|
||||
structure_env();
|
||||
wsh.run('cmd /k bin\\_process.bat', 1, true);
|
||||
}
|
||||
|
||||
function exec_build() {
|
||||
@ -19,12 +33,18 @@ function exec_build() {
|
||||
return;
|
||||
}
|
||||
$('#build_stdout').empty();
|
||||
var oExec = wsh.exec('Projects\\' + selected_project + '\\init.bat');
|
||||
structure_env();
|
||||
var oExec = wsh.exec('bin\\_process.bat');
|
||||
var stdout = null;
|
||||
var b = null;
|
||||
update_output(oExec);
|
||||
}
|
||||
|
||||
function sleep(n) {
|
||||
var start = new Date().getTime();
|
||||
while (true) if (new Date().getTime() - start > n) break;
|
||||
}
|
||||
|
||||
function update_output(oExec) {
|
||||
stdout = oExec.StdOut.ReadLine();
|
||||
if (stdout.length > 0) {
|
||||
|
@ -5,8 +5,8 @@ function start_page_init() {
|
||||
$('#wb_workspace').val($wb_workspace);
|
||||
$('#wb_src').val($wb_src);
|
||||
$('#wb_base').val($wb_base);
|
||||
$('#wb_src_idx_opt').val($wb_src_idx);
|
||||
$('#wb_base_idx_opt').val($wb_base_idx);
|
||||
$('#wb_src_idx_opt').val($wb_src_index);
|
||||
$('#wb_base_idx_opt').val($wb_base_index);
|
||||
user_trigger = true;
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ $('#wb_src_wim_btn').click(function(){
|
||||
$('#wb_src_folder_btn').click(function(){
|
||||
$('#wb_src').val(BrowseFolder($i18n['Select the extracted install.wim folder:']))
|
||||
$wb_src = $('#wb_src').val();
|
||||
$wb_src_idx = -1;
|
||||
$wb_src_index = -1;
|
||||
$('#wb_src_idx_opt').val(-1);
|
||||
});
|
||||
|
||||
@ -46,9 +46,9 @@ $("#wb_base").change(function(){
|
||||
});
|
||||
|
||||
$('#wb_src_idx_opt').click(function(){
|
||||
$wb_src_idx = $(this).val();
|
||||
$wb_src_index = $(this).val();
|
||||
});
|
||||
|
||||
$('#wb_base_idx_opt').click(function(){
|
||||
$wb_base_idx = $(this).val();
|
||||
$wb_base_index = $(this).val();
|
||||
});
|
||||
|
185
bin/CmdColor.cpp
Normal file
185
bin/CmdColor.cpp
Normal file
@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Colorizes standard output on Windows
|
||||
* https://github.com/jeremejevs/cmdcolor
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
using std::string;
|
||||
using std::ostringstream;
|
||||
|
||||
HANDLE con;
|
||||
CONSOLE_SCREEN_BUFFER_INFO definfo;
|
||||
ostringstream tmpins;
|
||||
const int ntow[] = { 0, 4, 2, 6, 1, 5, 3, 7 };
|
||||
|
||||
void rawget(char &c) {
|
||||
if (!cin.get(c).good()) {
|
||||
throw -1;
|
||||
}
|
||||
}
|
||||
|
||||
void append(char c) {
|
||||
tmpins << c;
|
||||
}
|
||||
|
||||
void get(char &c) {
|
||||
rawget(c);
|
||||
append(c);
|
||||
}
|
||||
|
||||
void reset() {
|
||||
tmpins.str(string());
|
||||
tmpins.clear();
|
||||
}
|
||||
|
||||
void dump() {
|
||||
cout << tmpins.str();
|
||||
reset();
|
||||
}
|
||||
|
||||
int parse(bool *fore) {
|
||||
char c, d;
|
||||
get(c);
|
||||
c -= '0';
|
||||
if (c == 0) {
|
||||
throw -3;
|
||||
}
|
||||
|
||||
get(d);
|
||||
d -= '0';
|
||||
if (c == 1) {
|
||||
if (d != 0) {
|
||||
throw -2;
|
||||
}
|
||||
get(d);
|
||||
d -= '0';
|
||||
}
|
||||
|
||||
if (d < 0 || d > 7) {
|
||||
throw -2;
|
||||
}
|
||||
|
||||
int res = ntow[d];
|
||||
switch (c) {
|
||||
case 3: {
|
||||
*fore = true;
|
||||
return res;
|
||||
}
|
||||
case 4: {
|
||||
*fore = false;
|
||||
return res << 4;
|
||||
}
|
||||
case 9: {
|
||||
*fore = true;
|
||||
return res + 8;
|
||||
}
|
||||
case 1: {
|
||||
*fore = false;
|
||||
return (res + 8) << 4;
|
||||
}
|
||||
default: {
|
||||
throw -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bye(int sig=0) {
|
||||
if (con != NULL) {
|
||||
SetConsoleTextAttribute(con, definfo.wAttributes);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main() {
|
||||
signal(SIGABRT, &bye);
|
||||
signal(SIGINT, &bye);
|
||||
signal(SIGTERM, &bye);
|
||||
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
||||
con = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
GetConsoleScreenBufferInfo(con, &definfo);
|
||||
try {
|
||||
char c;
|
||||
while (true) {
|
||||
try {
|
||||
rawget(c);
|
||||
if (c != '\\' && c != 27) {
|
||||
cout << c;
|
||||
continue;
|
||||
}
|
||||
|
||||
append(c);
|
||||
if (c == '\\') {
|
||||
get(c);
|
||||
if (c != '0') {
|
||||
throw -2;
|
||||
}
|
||||
get(c);
|
||||
if (c != '3') {
|
||||
throw -2;
|
||||
}
|
||||
get(c);
|
||||
if (c != '3') {
|
||||
throw -2;
|
||||
}
|
||||
c = 27;
|
||||
}
|
||||
else if (c != 27) {
|
||||
throw -2;
|
||||
}
|
||||
|
||||
get(c);
|
||||
if (c != '[') {
|
||||
throw -2;
|
||||
}
|
||||
|
||||
int res = 0;
|
||||
bool fore;
|
||||
do {
|
||||
try {
|
||||
res = parse(&fore) + (res & (fore ? 0xF0 : 0x0F));
|
||||
}
|
||||
catch (int e) {
|
||||
if (-3 == e) {
|
||||
res = definfo.wAttributes;
|
||||
}
|
||||
else {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
get(c);
|
||||
} while (c == ';');
|
||||
|
||||
if (c != 'm') {
|
||||
throw -2;
|
||||
}
|
||||
|
||||
SetConsoleTextAttribute(con, res);
|
||||
reset();
|
||||
}
|
||||
catch (int e) {
|
||||
if (-2 == e) {
|
||||
dump();
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (int e) {
|
||||
}
|
||||
|
||||
bye();
|
||||
return 0;
|
||||
}
|
BIN
bin/CmdColor.exe
Normal file
BIN
bin/CmdColor.exe
Normal file
Binary file not shown.
86
bin/Dism10.txt
Normal file
86
bin/Dism10.txt
Normal file
@ -0,0 +1,86 @@
|
||||
.\Dism10
|
||||
| api-ms-win-downlevel-advapi32-l1-1-1.dll
|
||||
| api-ms-win-downlevel-advapi32-l4-1-0.dll
|
||||
| api-ms-win-downlevel-kernel32-l1-1-0.dll
|
||||
| api-ms-win-downlevel-kernel32-l2-1-0.dll
|
||||
| api-ms-win-downlevel-ole32-l1-1-1.dll
|
||||
| api-ms-win-downlevel-user32-l1-1-1.dll
|
||||
| Dism.exe
|
||||
| DismApi.dll
|
||||
| SSShim.dll
|
||||
|
|
||||
\---Dism
|
||||
| AppxProvider.dll
|
||||
| AssocProvider.dll
|
||||
| CbsProvider.dll
|
||||
| CompatProvider.dll
|
||||
| DismCore.dll
|
||||
| DismCorePS.dll
|
||||
| DismHost.exe
|
||||
| DismProv.dll
|
||||
| DmiProvider.dll
|
||||
| FfuProvider.dll
|
||||
| FolderProvider.dll
|
||||
| GenericProvider.dll
|
||||
| IBSProvider.dll
|
||||
| ImagingProvider.dll
|
||||
| IntlProvider.dll
|
||||
| LogProvider.dll
|
||||
| MsiProvider.dll
|
||||
| OfflineSetupProvider.dll
|
||||
| OSProvider.dll
|
||||
| ProvProvider.dll
|
||||
| SmiProvider.dll
|
||||
| TransmogProvider.dll
|
||||
| UnattendProvider.dll
|
||||
| VhdProvider.dll
|
||||
| WimProvider.dll
|
||||
|
|
||||
+---en-US
|
||||
| AppxProvider.dll.mui
|
||||
| AssocProvider.dll.mui
|
||||
| CbsProvider.dll.mui
|
||||
| CompatProvider.dll.mui
|
||||
| DismCore.dll.mui
|
||||
| DismProv.dll.mui
|
||||
| DmiProvider.dll.mui
|
||||
| FfuProvider.dll.mui
|
||||
| FolderProvider.dll.mui
|
||||
| GenericProvider.dll.mui
|
||||
| IBSProvider.dll.mui
|
||||
| ImagingProvider.dll.mui
|
||||
| IntlProvider.dll.mui
|
||||
| LogProvider.dll.mui
|
||||
| MsiProvider.dll.mui
|
||||
| OfflineSetupProvider.dll.mui
|
||||
| OSProvider.dll.mui
|
||||
| ProvProvider.dll.mui
|
||||
| SmiProvider.dll.mui
|
||||
| TransmogProvider.dll.mui
|
||||
| UnattendProvider.dll.mui
|
||||
| VhdProvider.dll.mui
|
||||
| WimProvider.dll.mui
|
||||
|
|
||||
\---zh-CN
|
||||
AppxProvider.dll.mui
|
||||
AssocProvider.dll.mui
|
||||
CbsProvider.dll.mui
|
||||
CompatProvider.dll.mui
|
||||
DismCore.dll.mui
|
||||
DismProv.dll.mui
|
||||
DmiProvider.dll.mui
|
||||
FfuProvider.dll.mui
|
||||
FolderProvider.dll.mui
|
||||
GenericProvider.dll.mui
|
||||
ImagingProvider.dll.mui
|
||||
IntlProvider.dll.mui
|
||||
LogProvider.dll.mui
|
||||
MsiProvider.dll.mui
|
||||
OfflineSetupProvider.dll.mui
|
||||
OSProvider.dll.mui
|
||||
ProvProvider.dll.mui
|
||||
SmiProvider.dll.mui
|
||||
TransmogProvider.dll.mui
|
||||
UnattendProvider.dll.mui
|
||||
VhdProvider.dll.mui
|
||||
WimProvider.dll.mui
|
5
bin/DismX.cmd
Normal file
5
bin/DismX.cmd
Normal file
@ -0,0 +1,5 @@
|
||||
if exist "%~dp0Dism10_x86\Dism.exe" (
|
||||
"%~dp0Dism10_x86\Dism.exe" %*
|
||||
) else (
|
||||
Dism.exe %*
|
||||
)
|
6
bin/ElevateMe.vbs
Normal file
6
bin/ElevateMe.vbs
Normal file
@ -0,0 +1,6 @@
|
||||
Set objShellApp = CreateObject("Shell.Application")
|
||||
If Wscript.Arguments.Count > 0 Then
|
||||
p = ""
|
||||
If Wscript.Arguments.Count > 1 Then p = Wscript.Arguments(1)
|
||||
objShellApp.ShellExecute Wscript.Arguments(0), p, "", "runas", 1
|
||||
End If
|
112
bin/IsAdmin.c
Normal file
112
bin/IsAdmin.c
Normal file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* How To Determine Whether a Thread Is Running in User Context of Local Administrator Account
|
||||
* https://support.microsoft.com/en-us/kb/118626
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
//#include <stdio.h>
|
||||
#include <lmcons.h>
|
||||
|
||||
BOOL IsCurrentUserLocalAdministrator(void);
|
||||
|
||||
void main(int argc, char **argv)
|
||||
{
|
||||
if (IsCurrentUserLocalAdministrator())
|
||||
//printf("You are an administrator\n");
|
||||
return 1;
|
||||
else
|
||||
//printf("You are not an administrator\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL IsCurrentUserLocalAdministrator(void)
|
||||
{
|
||||
BOOL fReturn = FALSE;
|
||||
DWORD dwStatus;
|
||||
DWORD dwAccessMask;
|
||||
DWORD dwAccessDesired;
|
||||
DWORD dwACLSize;
|
||||
DWORD dwStructureSize = sizeof(PRIVILEGE_SET);
|
||||
PACL pACL = NULL;
|
||||
PSID psidAdmin = NULL;
|
||||
|
||||
HANDLE hToken = NULL;
|
||||
HANDLE hImpersonationToken = NULL;
|
||||
|
||||
PRIVILEGE_SET ps;
|
||||
GENERIC_MAPPING GenericMapping;
|
||||
|
||||
PSECURITY_DESCRIPTOR psdAdmin = NULL;
|
||||
SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY;
|
||||
|
||||
const DWORD ACCESS_READ = 1;
|
||||
const DWORD ACCESS_WRITE = 2;
|
||||
|
||||
__try {
|
||||
if (!OpenThreadToken(GetCurrentThread(), TOKEN_DUPLICATE | TOKEN_QUERY,
|
||||
TRUE, &hToken)) {
|
||||
if (GetLastError() != ERROR_NO_TOKEN)
|
||||
__leave;
|
||||
if (!OpenProcessToken(GetCurrentProcess(),
|
||||
TOKEN_DUPLICATE | TOKEN_QUERY, &hToken))
|
||||
__leave;
|
||||
}
|
||||
if (!DuplicateToken(hToken, SecurityImpersonation,
|
||||
&hImpersonationToken))
|
||||
__leave;
|
||||
|
||||
if (!AllocateAndInitializeSid(&SystemSidAuthority, 2,
|
||||
SECURITY_BUILTIN_DOMAIN_RID,
|
||||
DOMAIN_ALIAS_RID_ADMINS,
|
||||
0, 0, 0, 0, 0, 0, &psidAdmin))
|
||||
__leave;
|
||||
|
||||
psdAdmin = LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
|
||||
if (psdAdmin == NULL)
|
||||
__leave;
|
||||
|
||||
if (!InitializeSecurityDescriptor(psdAdmin,
|
||||
SECURITY_DESCRIPTOR_REVISION))
|
||||
__leave;
|
||||
// Compute size needed for the ACL.
|
||||
dwACLSize = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) +
|
||||
GetLengthSid(psidAdmin) - sizeof(DWORD);
|
||||
pACL = (PACL)LocalAlloc(LPTR, dwACLSize);
|
||||
if (pACL == NULL)
|
||||
__leave;
|
||||
if (!InitializeAcl(pACL, dwACLSize, ACL_REVISION2))
|
||||
__leave;
|
||||
dwAccessMask = ACCESS_READ | ACCESS_WRITE;
|
||||
if (!AddAccessAllowedAce(pACL, ACL_REVISION2, dwAccessMask,
|
||||
psidAdmin))
|
||||
__leave;
|
||||
|
||||
if (!SetSecurityDescriptorDacl(psdAdmin, TRUE, pACL, FALSE))
|
||||
__leave;
|
||||
SetSecurityDescriptorGroup(psdAdmin, psidAdmin, FALSE);
|
||||
SetSecurityDescriptorOwner(psdAdmin, psidAdmin, FALSE);
|
||||
if (!IsValidSecurityDescriptor(psdAdmin))
|
||||
__leave;
|
||||
dwAccessDesired = ACCESS_READ;
|
||||
GenericMapping.GenericRead = ACCESS_READ;
|
||||
GenericMapping.GenericWrite = ACCESS_WRITE;
|
||||
GenericMapping.GenericExecute = 0;
|
||||
GenericMapping.GenericAll = ACCESS_READ | ACCESS_WRITE;
|
||||
|
||||
if (!AccessCheck(psdAdmin, hImpersonationToken, dwAccessDesired,
|
||||
&GenericMapping, &ps, &dwStructureSize, &dwStatus,
|
||||
&fReturn)) {
|
||||
fReturn = FALSE;
|
||||
__leave;
|
||||
}
|
||||
} __finally {
|
||||
// Clean up.
|
||||
if (pACL) LocalFree(pACL);
|
||||
if (psdAdmin) LocalFree(psdAdmin);
|
||||
if (psidAdmin) FreeSid(psidAdmin);
|
||||
if (hImpersonationToken) CloseHandle(hImpersonationToken);
|
||||
if (hToken) CloseHandle(hToken);
|
||||
}
|
||||
|
||||
return fReturn;
|
||||
}
|
BIN
bin/IsAdmin.exe
Normal file
BIN
bin/IsAdmin.exe
Normal file
Binary file not shown.
84
bin/PERegPorter.bat
Normal file
84
bin/PERegPorter.bat
Normal file
@ -0,0 +1,84 @@
|
||||
set GetLastError=1
|
||||
|
||||
rem %%1 = "SRC" or "PE"
|
||||
if "x%1"=="x" goto :EOF
|
||||
if not /i "x%1"=="xSRC" goto :EOF
|
||||
if not /i "x%1"=="xPE" goto :EOF
|
||||
|
||||
if /i "x%2"=="xLOAD" goto :REG_PORTER
|
||||
if /i "x%2"=="xUNLOAD" (
|
||||
set "COMMENT_STR=) ^& rem ("
|
||||
goto :REG_PORTER
|
||||
)
|
||||
|
||||
goto :EOF
|
||||
|
||||
:REG_PORTER
|
||||
set GetLastError=0
|
||||
set FILEPATH=X:\Windows\System32\config
|
||||
set FILEPATH_NTUSER=X:\Users\Default
|
||||
|
||||
if/i "x%1"=="xSRC" (
|
||||
set FILEPATH=%WB_SRC_DIR%\Windows\System32\config
|
||||
set FILEPATH_NTUSER=%WB_SRC_DIR%\Users\Default
|
||||
)
|
||||
|
||||
rem check existence before UNLOAD
|
||||
rem Query -* HKEY_USERS\.DEFAULT\Environment
|
||||
rem Query -* HKEY_LOCAL_MACHINE\SAM\SAM
|
||||
rem Query -* HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices
|
||||
rem Query -* HKEY_CURRENT_USER\Environment
|
||||
|
||||
|
||||
if/i "x%2"=="xUNLOAD" (
|
||||
reg query HKLM\%1_DEFAULT\Environment /ve 2>nul 1>&2
|
||||
if ERRORLEVEL 1 goto :DEAL_SAM
|
||||
)
|
||||
(REG %2 HKLM\%1_DEFAULT %COMMENT_STR% %FILEPATH%\DEFAULT)
|
||||
if ERRORLEVEL 1 set GetLastError=1
|
||||
|
||||
:DEAL_SAM
|
||||
if/i "x%2"=="xUNLOAD" (
|
||||
reg query HKLM\%1_SAM\SAM /ve 2>nul 1>&2
|
||||
if ERRORLEVEL 1 goto :DEAL_SECURITY
|
||||
)
|
||||
if "x%WB_REG_USE_SAM%"=="x1" (
|
||||
REG %2 HKLM\%1_SAM %COMMENT_STR% %FILEPATH%\SAM)
|
||||
if ERRORLEVEL 1 set GetLastError=1
|
||||
)
|
||||
|
||||
:DEAL_SECURITY
|
||||
if "x%WB_REG_USE_SECURITY%"=="x1" (
|
||||
(REG %2 HKLM\%1_SECURITY %COMMENT_STR% %FILEPATH%\SECURITY)
|
||||
if ERRORLEVEL 1 set GetLastError=1
|
||||
)
|
||||
|
||||
:DEAL_SOFTWARE
|
||||
if/i "x%2"=="xUNLOAD" (
|
||||
reg query HKLM\%1_SOFTWARE\Microsoft /ve 2>nul 1>&2
|
||||
if ERRORLEVEL 1 goto :DEAL_SYSTEM
|
||||
)
|
||||
(REG %2 HKLM\%1_SOFTWARE %COMMENT_STR% %FILEPATH%\SOFTWARE)
|
||||
if ERRORLEVEL 1 set GetLastError=1
|
||||
|
||||
:DEAL_SYSTEM
|
||||
if/i "x%2"=="xUNLOAD" (
|
||||
reg query HKLM\%1_SYSTEM\MountedDevices /ve 2>nul 1>&2
|
||||
if ERRORLEVEL 1 goto :DEAL_NTUSER
|
||||
)
|
||||
(REG %2 HKLM\%1_SYSTEM %COMMENT_STR% %FILEPATH%\SYSTEM)
|
||||
if ERRORLEVEL 1 set GetLastError=1
|
||||
|
||||
:DEAL_NTUSER
|
||||
if/i "x%2"=="xUNLOAD" (
|
||||
reg query HKLM\%1_NTUSER.DAT\Environment /ve 2>nul 1>&2
|
||||
if ERRORLEVEL 1 goto :DEAL_END
|
||||
)
|
||||
(REG %2 HKLM\%1_NTUSER.DAT %COMMENT_STR% %FILEPATH_NTUSER%\NTUSER.DAT)
|
||||
if ERRORLEVEL 1 set GetLastError=1
|
||||
|
||||
:DEAL_END
|
||||
set FILEPATH=
|
||||
set FILEPATH_NTUSER=
|
||||
set COMMENT_STR=
|
||||
|
64
bin/PERegProcessor.vbs
Normal file
64
bin/PERegProcessor.vbs
Normal file
@ -0,0 +1,64 @@
|
||||
Const OpenAsASCII = 0
|
||||
Const OpenAsUnicode = -1
|
||||
|
||||
Const FailIfExist = 0
|
||||
Const OverwriteIfExist = -1
|
||||
|
||||
Const ForReading = 1
|
||||
Const ForWriting = 2
|
||||
Const ForAppending = 8
|
||||
|
||||
Dim argCount:argCount = Wscript.Arguments.Count
|
||||
|
||||
If argCount = 0 Then
|
||||
Wscript.Quit(1)
|
||||
End If
|
||||
|
||||
Dim inFile, outFile, inStream, outStream, inLine, FileSys, WshShell
|
||||
inFile = Wscript.Arguments(0)
|
||||
outFile = Wscript.Arguments(0) & "_"
|
||||
|
||||
Set WshShell = Wscript.CreateObject("Wscript.Shell")
|
||||
Set FileSys = CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
Set inStream = FileSys.OpenTextFile(inFile, ForReading, FailIfNotExist, OpenAsUnicode)
|
||||
Set outStream = FileSys.CreateTextFile(outFile, OverwriteIfExist, OpenAsUnicode)
|
||||
|
||||
Do
|
||||
inLine = inStream.ReadLine
|
||||
If Left(inLine, 1) = "[" Then inLine = RegKeyTrans(inLine)
|
||||
outStream.WriteLine inLine
|
||||
Loop Until inStream.AtEndOfStream
|
||||
|
||||
inStream.Close
|
||||
outStream.Close
|
||||
|
||||
|
||||
Function RegKeyTrans(str)
|
||||
Dim transFlag
|
||||
RegKeyTrans = str
|
||||
If str = "" Then Exit Function
|
||||
RegKeyTrans = RegKeyRePlacer(transFlag, str, "[HKEY_CLASSES_ROOT\", "[HKEY_LOCAL_MACHINE\PE_SOFTWARE\Classes\")
|
||||
If transFlag = 1 Then Exit Function
|
||||
RegKeyTrans = RegKeyRePlacer(transFlag, str, "[HKEY_CURRENT_USER\", "[HKEY_LOCAL_MACHINE\PE_NTUSER.DAT\")
|
||||
If transFlag = 1 Then Exit Function
|
||||
RegKeyTrans = RegKeyRePlacer(transFlag, str, "[HKEY_LOCAL_MACHINE\SAM\", "[HKEY_LOCAL_MACHINE\PE_SAM\")
|
||||
If transFlag = 1 Then Exit Function
|
||||
RegKeyTrans = RegKeyRePlacer(transFlag, str, "[HKEY_LOCAL_MACHINE\SECURITY\", "[HKEY_LOCAL_MACHINE\PE_SECURITY\")
|
||||
If transFlag = 1 Then Exit Function
|
||||
RegKeyTrans = RegKeyRePlacer(transFlag, str, "[HKEY_LOCAL_MACHINE\SOFTWARE\", "[HKEY_LOCAL_MACHINE\PE_SOFTWARE\")
|
||||
If transFlag = 1 Then Exit Function
|
||||
RegKeyTrans = RegKeyRePlacer(transFlag, str, "[HKEY_LOCAL_MACHINE\SYSTEM\", "[HKEY_LOCAL_MACHINE\PE_SYSTEM\")
|
||||
If transFlag = 1 Then Exit Function
|
||||
RegKeyTrans = RegKeyRePlacer(transFlag, str, "[HKEY_USERS\.DEFAULT\", "[HKEY_LOCAL_MACHINE\PE_DEFAULT\")
|
||||
If transFlag = 1 Then Exit Function
|
||||
End Function
|
||||
|
||||
Function RegKeyRePlacer(transFlag, str, okey, nkey)
|
||||
RegKeyRePlacer = str
|
||||
transFlag = 0
|
||||
If InStr(1, str, okey) = 1 Then
|
||||
RegKeyRePlacer = Replace(str, okey, nkey, 1, 1)
|
||||
transFlag = 1
|
||||
End If
|
||||
End Function
|
BIN
bin/SetACL.exe
Normal file
BIN
bin/SetACL.exe
Normal file
Binary file not shown.
4
bin/TimeStamp.vbs
Normal file
4
bin/TimeStamp.vbs
Normal file
@ -0,0 +1,4 @@
|
||||
N = Now
|
||||
timestamp = Year(N) & Right("0" & Month(N), 2) & Right("0" & Day(N), 2)
|
||||
timestamp = timestamp & Right("0" & Hour(N), 2) & Right("0" & Minute(N), 2) & Right("0" & Second(N), 2)
|
||||
WSH.echo timestamp
|
33
bin/WB_LOG.cmd
Normal file
33
bin/WB_LOG.cmd
Normal file
@ -0,0 +1,33 @@
|
||||
if "x%I18N_SCRIPT%"=="x" goto :EOF
|
||||
call :i18n.t LOG %*
|
||||
echo %i18n.str%
|
||||
if "x%LOGFILE%"=="x" goto :EOF
|
||||
>>%LOGFILE% (echo %i18n.log%)
|
||||
|
||||
goto :EOF
|
||||
|
||||
rem =========================================================
|
||||
:i18n.t
|
||||
if not "x%DEBUG_MODE%"=="x" echo %*
|
||||
set i18n.str=
|
||||
set i18n.log=
|
||||
if "%I18N_LCID%"=="0" (
|
||||
if /i "x%~1"=="xECHO" (
|
||||
if "x%~3"=="x" (
|
||||
set i18n.str=%~2
|
||||
goto :EOF
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
set tmp_i=1
|
||||
for /f "delims=" %%s in ('cscript.exe //nologo "%I18N_SCRIPT%" %*') do (
|
||||
set i18n.str!tmp_i!=%%s
|
||||
set /a tmp_i+=1
|
||||
)
|
||||
set tmp_i=
|
||||
set i18n.str=%i18n.str1%
|
||||
set i18n.log=%i18n.str2%
|
||||
goto :EOF
|
||||
|
||||
|
16
bin/WIM_Exporter.bat
Normal file
16
bin/WIM_Exporter.bat
Normal file
@ -0,0 +1,16 @@
|
||||
if "x%~1"=="x" goto :EOF
|
||||
set GetLastError=1
|
||||
if exist "%~dpn1_build%~x1" del /q "%~dpn1_build%~x1"
|
||||
call PB_LOG "[%BUILD_PROJECT%] --- EXPORT [%~1:%PB_BASE_INDEX%] -%%gt:%% [%~dpn1_build%~x1]"
|
||||
|
||||
rem use imagex for building on Windows 7
|
||||
ver|findstr " 6.1." >nul
|
||||
if not ERRORLEVEL 1 (
|
||||
imagex.exe /Export "%~1" %PB_BASE_INDEX% "%~dpn1_build%~x1" /boot
|
||||
) else (
|
||||
call DismX /Export-Image /SourceImageFile:"%~1" /SourceIndex:%PB_BASE_INDEX% /DestinationImageFile:"%~dpn1_build%~x1" /Bootable
|
||||
)
|
||||
if "%errorlevel%"=="0" (
|
||||
del /q "%~1"
|
||||
set GetLastError=0
|
||||
)
|
9
bin/WIM_Mounter.cmd
Normal file
9
bin/WIM_Mounter.cmd
Normal file
@ -0,0 +1,9 @@
|
||||
if "x%3"=="x" goto :EOF
|
||||
if not "x%~4"=="x" set %~4=
|
||||
|
||||
call WB_LOG "[%BUILD_PROJECT%] --- MOUNT [%~1:%2] -%%gt:%% [%~3]"
|
||||
if not exist "%~3" mkdir "%~3"
|
||||
call DismX /mount-wim /wimfile:"%~1" /index:%2 /mountdir:"%~3"
|
||||
|
||||
if "x%~4"=="x" goto :EOF
|
||||
if "%errorlevel%"=="0" set %~4=1
|
10
bin/WIM_UnMounter.bat
Normal file
10
bin/WIM_UnMounter.bat
Normal file
@ -0,0 +1,10 @@
|
||||
call PB_LOG "[%BUILD_PROJECT%] --- UNMOUNT [%~1] %~2"
|
||||
if /i "%~2"=="/commit" (
|
||||
rem if not exist "%~dp1tmp" mkdir "%~dp1tmp"
|
||||
rem DismX /Cleanup-Image /Image="%~1" /StartComponentCleanup /ResetBase /ScratchDir:"%~dp1tmp"
|
||||
rem if ERRORLEVEL 1 goto :EOF
|
||||
)
|
||||
DismX /unmount-wim /MountDir:"%~1" %~2
|
||||
|
||||
if "x%~3"=="x" goto :EOF
|
||||
if "%errorlevel%"=="0" set %~3=
|
211
bin/_Process.bat
Normal file
211
bin/_Process.bat
Normal file
@ -0,0 +1,211 @@
|
||||
@echo off
|
||||
SETLOCAL ENABLEDELAYEDEXPANSION
|
||||
title WimBuilder(%cd%)
|
||||
|
||||
rem ======generate logfile name======
|
||||
rem ">" mark will cause *ECHO* error, change to "*"
|
||||
rem i.e. Mount [WIM] -> [PATH] ---> Mount [WIM] -* [PATH]
|
||||
rem set gt:=^^^>
|
||||
set gt:=*
|
||||
for /f "delims=" %%t in ('cscript.exe //nologo bin\TimeStamp.vbs') do set LOGSUFFIX=%%t
|
||||
set "LOGFILE=%Factory%\log\%LOGSUFFIX%.log"
|
||||
|
||||
|
||||
rem ======define var======
|
||||
if "x%WB_PROJECT%"=="x" call :NO_ENV_CONF WB_PROJECT
|
||||
set "LOGFILE=%Factory%\log\%WB_PROJECT%\%LOGSUFFIX%.log"
|
||||
call :MKPATH "%LOGFILE%"
|
||||
rem type nul>%LOGFILE%
|
||||
|
||||
|
||||
if "x%WB_BASE%"=="x" call :NO_ENV_CONF WB_BASE
|
||||
|
||||
set "_WB_MNT_DIR=%Factory%\target\%WB_PROJECT%\mounted"
|
||||
call :GETNAME "%WB_BASE%"
|
||||
set "_WB_PE_WIM=%Factory%\target\%WB_PROJECT%\%RET_GETNAME%"
|
||||
|
||||
call :MKPATH "%Factory%\target\%WB_PROJECT%\"
|
||||
|
||||
|
||||
rem ";" can't be pass to CALL LABEL, so use a ":" for it
|
||||
call :CLOG 97:104m "[%WB_PROJECT%] --- build information"
|
||||
set WB_
|
||||
echo.
|
||||
|
||||
call :cecho PHRASE "PHRASE:Get WIM image INFO"
|
||||
for /f "tokens=1,2 delims=:(" %%i in ('DismX /Get-WimInfo /WimFile:"%WB_BASE%" /Index:%WB_BASE_INDEX% /English') do (
|
||||
if "%%i"=="Architecture " set WB_PE_ARCH=%%j
|
||||
if "%%i"=="Version " set WB_PE_VER=%%j
|
||||
if "%%i"=="ServicePack Build " set WB_PE_BUIID=%%j
|
||||
if "x!LANG_FLAG!"=="x1" (
|
||||
set WB_PE_LANG=%%i
|
||||
set LANG_FLAG=
|
||||
)
|
||||
if "%%i"=="Languages " set LANG_FLAG=1
|
||||
)
|
||||
|
||||
if "x%WB_PE_LANG%"=="x" (
|
||||
call :cecho ERROR "Get WIM image's information failed."
|
||||
goto :EOF
|
||||
)
|
||||
|
||||
set "WB_PE_ARCH=%WB_PE_ARCH: =%"
|
||||
set "WB_PE_VER=%WB_PE_VER: =%"
|
||||
set "WB_PE_BUIID=%WB_PE_BUIID: =%"
|
||||
rem here is TAB, not SPACE
|
||||
set "WB_PE_LANG=%WB_PE_LANG: =%"
|
||||
set "WB_PE_LANG=%WB_PE_LANG: =%"
|
||||
|
||||
set WB_PE_
|
||||
echo.
|
||||
call :cecho PHRASE "PHRASE:Mount WIM image"
|
||||
|
||||
rem check X: driver
|
||||
if exist X:\ (
|
||||
call :cecho WARN "X: is already use."
|
||||
call :setp yTry "Try SUBST X: /D?[y/n]:"
|
||||
)
|
||||
if "%yTry%"=="y" SUBST X: /D
|
||||
if "%yTry%"=="Y" SUBST X: /D
|
||||
if exist X:\ (
|
||||
call :cecho ERROR "X: is already in use, goto CLEANUP."
|
||||
call :CLEANUP
|
||||
)
|
||||
|
||||
rem PHRASE:mount WIM
|
||||
if "x%WB_BASE_INDEX%"=="x" set WB_BASE_INDEX=1
|
||||
if "x%WB_SRC_INDEX%"=="x" set WB_SRC_INDEX=1
|
||||
|
||||
:BASE_MOUNT
|
||||
call :MKPATH "%_WB_PE%"
|
||||
call copy /y "%WB_BASE%" "%_WB_PE_WIM%"
|
||||
|
||||
call WIM_Mounter "%_WB_PE_WIM%" %WB_BASE_INDEX% "%_WB_MNT_DIR%" base_wim_mounted
|
||||
if not "%base_wim_mounted%"=="1" (
|
||||
call :cecho ERROR "mount base wim file failed."
|
||||
call :CLEANUP
|
||||
)
|
||||
|
||||
rem NOTICE:explorer.exe don't show X:\ when running with Administrators right
|
||||
SUBST X: "%_WB_MNT_DIR%"
|
||||
echo.
|
||||
if "x%WB_SKIP_UFR%"=="x1" goto :PROJECT_BUILDING
|
||||
rem update files ACL Right
|
||||
call :cecho PHRASE "PHRASE:updating files' ACL rights"
|
||||
if "x%WB_STRAIGHT_MODE%"=="x" pause
|
||||
call :techo "Updating...(Please, be patient)"
|
||||
call TrustedInstallerRight "%_WB_MNT_DIR%" 1>nul
|
||||
if not "%GetLastError%"=="0" call :CLEANUP
|
||||
call :techo "Update files with Administrators' FULL ACL rights successfully."
|
||||
echo.
|
||||
|
||||
:PROJECT_BUILDING
|
||||
pushd "%WB_WORKSPACE%\Projects\%WB_PROJECT%"
|
||||
main.bat
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
rem =========================================================
|
||||
|
||||
:MKPATH
|
||||
if not exist "%~dp1" mkdir "%~dp1"
|
||||
goto :EOF
|
||||
|
||||
:GETPATH
|
||||
:GETNAME
|
||||
set "RET_GETPATH=%~dp1"
|
||||
set "RET_GETNAME=%~nx1"
|
||||
goto :EOF
|
||||
|
||||
rem =========================================================
|
||||
:i18n.t
|
||||
if not "x%DEBUG_MODE%"=="x" echo %*
|
||||
set i18n.str=
|
||||
set i18n.log=
|
||||
if "%I18N_LCID%"=="0" (
|
||||
if /i "x%~1"=="xECHO" (
|
||||
if "x%~3"=="x" (
|
||||
set "i18n.str=%~2"
|
||||
goto :EOF
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
set tmp_i=1
|
||||
for /f "delims=" %%s in ('cscript.exe //nologo "%I18N_SCRIPT%" %*') do (
|
||||
set "i18n.str!tmp_i!=%%s"
|
||||
set /a tmp_i+=1
|
||||
)
|
||||
set tmp_i=
|
||||
set "i18n.str=%i18n.str1%"
|
||||
set "i18n.log=%i18n.str2%"
|
||||
goto :EOF
|
||||
|
||||
:techo
|
||||
call :i18n.t ECHO %*
|
||||
echo %i18n.str%
|
||||
goto :EOF
|
||||
|
||||
:setp
|
||||
call :i18n.t SETP_%*
|
||||
set /p %1=%i18n.str%
|
||||
set p1=
|
||||
goto :EOF
|
||||
|
||||
:cecho
|
||||
call :i18n.t CLR_%*
|
||||
echo %i18n.str% | cmdcolor.exe
|
||||
goto :EOF
|
||||
|
||||
:LOG
|
||||
call :i18n.t LOG %*
|
||||
echo %i18n.str%
|
||||
>>%LOGFILE% (echo %i18n.log%)
|
||||
goto :EOF
|
||||
|
||||
:CLOG
|
||||
call :i18n.t CLR_LOG_%*
|
||||
echo %i18n.str% | cmdcolor.exe
|
||||
>>%LOGFILE% (echo %i18n.log%)
|
||||
goto :EOF
|
||||
|
||||
rem =========================================================
|
||||
:WB_ERROR
|
||||
call :CLOG ERROR %*
|
||||
call :CLEANUP
|
||||
|
||||
:NO_ENV_CONF
|
||||
call :CLOG ERROR "Please specify the @s in config file" %1
|
||||
call :CLEANUP
|
||||
|
||||
:CLEANUP
|
||||
if "x%WB_REG_LOADED%"=="x1" call PERegPorter.bat UNLOAD 1>nul
|
||||
|
||||
if not "x%src_wim_mounted%"=="x" (
|
||||
call WIM_UnMounter.bat "%WB_MNT_DIR%\SOURCES" /discard src_wim_mounted
|
||||
)
|
||||
set UNMNT_OPT=/discard
|
||||
if "x%1"=="x0" (
|
||||
rem cleanup REGISTRY log files
|
||||
del /f /q /a X:\Windows\System32\config\*.LOG* 1>nul 2>nul
|
||||
del /f /q /a X:\Windows\System32\config\*{*}* 1>nul 2>nul
|
||||
del /f /q /a X:\Windows\System32\SMI\Store\Machine\*.LOG* 1>nul 2>nul
|
||||
del /f /q /a X:\Windows\System32\SMI\Store\Machine\*{*}* 1>nul 2>nul
|
||||
set UNMNT_OPT=/commit
|
||||
)
|
||||
if not "x%base_wim_mounted%"=="x" (
|
||||
call WIM_UnMounter.bat "%WB_MNT_DIR%\%WB_PROJECT%" %UNMNT_OPT% base_wim_mounted
|
||||
)
|
||||
|
||||
if exist X:\ SUBST X: /D
|
||||
|
||||
if "x%1"=="x0" (
|
||||
goto :EOF
|
||||
)
|
||||
pause
|
||||
exit 1
|
BIN
bin/imagex.exe
Normal file
BIN
bin/imagex.exe
Normal file
Binary file not shown.
BIN
bin/oscdimg.exe
Normal file
BIN
bin/oscdimg.exe
Normal file
Binary file not shown.
BIN
bin/x64/libwim-15.dll
Normal file
BIN
bin/x64/libwim-15.dll
Normal file
Binary file not shown.
2
bin/x64/wimexport.cmd
Normal file
2
bin/x64/wimexport.cmd
Normal file
@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
"%~dp0\wimlib-imagex" export %*
|
2
bin/x64/wimextract.cmd
Normal file
2
bin/x64/wimextract.cmd
Normal file
@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
"%~dp0\wimlib-imagex" extract %*
|
BIN
bin/x64/wimlib-imagex.exe
Normal file
BIN
bin/x64/wimlib-imagex.exe
Normal file
Binary file not shown.
BIN
bin/x86/libwim-15.dll
Normal file
BIN
bin/x86/libwim-15.dll
Normal file
Binary file not shown.
2
bin/x86/wimexport.cmd
Normal file
2
bin/x86/wimexport.cmd
Normal file
@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
"%~dp0\wimlib-imagex" export %*
|
BIN
bin/x86/wimlib-imagex.exe
Normal file
BIN
bin/x86/wimlib-imagex.exe
Normal file
Binary file not shown.
10
config.js
10
config.js
@ -2,9 +2,9 @@ $width = 1200;
|
||||
$height = 800;
|
||||
var $lang = 'zh-CN';
|
||||
|
||||
var $wb_workspace = 'D:\\WB_workspace';
|
||||
var $wb_src = 'D:\\WB_workspace\\mnt\\install.wim';
|
||||
var $wb_base = 'D:\\WB_workspace\\mnt\\boot.wim';
|
||||
var $wb_workspace = '.';
|
||||
var $wb_src = 'H:\\sources\\install.wim';
|
||||
var $wb_base = 'H:\\sources\\boot.wim';
|
||||
|
||||
var $wb_src_idx = 1;
|
||||
var $wb_base_idx = 2;
|
||||
var $wb_src_index = 1;
|
||||
var $wb_base_index = 2;
|
||||
|
46
i18n/0.vbs
Normal file
46
i18n/0.vbs
Normal file
@ -0,0 +1,46 @@
|
||||
t.s "Projects:", _
|
||||
"工程"
|
||||
t.s "Please select the project[1/2/.../n]:", _
|
||||
"请选择构建工程:[1/2/.../n]:"
|
||||
t.s " --- build information", _
|
||||
" --- 构建信息"
|
||||
t.s "PHRASE:Get WIM image INFO", _
|
||||
"工序:获取WIM文件信息"
|
||||
t.s "Get WIM image's information failed.", _
|
||||
"获取WIM文件信息失败。"
|
||||
t.s "PHRASE:Mount WIM image", _
|
||||
"工序:挂载 WIM 映像"
|
||||
t.s "Please make the mount dir ", _
|
||||
"请创建挂载目录 "
|
||||
t.s "mount source wim file failed.", _
|
||||
"挂载源WIM文件失败。"
|
||||
t.s "mount base wim file failed.", _
|
||||
"挂载WIM文件失败。"
|
||||
t.s "PHRASE:updating files' ACL rights", _
|
||||
"工序:更新文件访问权限"
|
||||
t.s "Updating...(Please, be patient)", _
|
||||
"更新中...(请耐心等待)"
|
||||
t.s "Update files with Administrators' FULL ACL rights successfully.", _
|
||||
"获取管理者完全访问权限成功。"
|
||||
t.s "PHRASE:Going PE Building process(DEL, ADD, REG)", _
|
||||
"工序:进行PE构建处理(增删文件,处理注册表)"
|
||||
t.s "PHRASE:Commit modification and build the WIM", _
|
||||
"工序:提交对WIM文件的修改,进行工程构建"
|
||||
t.s "Export build WIM failed.", _
|
||||
"导出构建WIM失败"
|
||||
t.s "PHRASE:build bootable ISO file", _
|
||||
"工序:创建可引导ISO镜像"
|
||||
t.s "PROCESS:delete files", _
|
||||
"PROCESS:删除文件"
|
||||
t.s "PROCESS:add files", _
|
||||
"PROCESS:添加文件"
|
||||
t.s "PROCESS:update registry", _
|
||||
"PROCESS:更新注册表"
|
||||
t.s "X: is already use.", _
|
||||
"X:驱动器已被使用,"
|
||||
t.s "Try SUBST X: /D?[y/n]:", _
|
||||
"是否尝试使用SUBST X: /D命令卸载?[y/n]"
|
||||
t.s "X: is already in use, goto CLEANUP.", _
|
||||
"X:驱动器已被使用,即将进行清理工作"
|
||||
t.s "Please specify the @s in config file", _
|
||||
"请在配置文件中定义@s参数"
|
46
i18n/2052.vbs
Normal file
46
i18n/2052.vbs
Normal file
@ -0,0 +1,46 @@
|
||||
t.s "Projects:", _
|
||||
"工程"
|
||||
t.s "Please select the project[1/2/.../n]:", _
|
||||
"请选择构建工程:[1/2/.../n]:"
|
||||
t.s " --- build information", _
|
||||
" --- 构建信息"
|
||||
t.s "PHRASE:Get WIM image INFO", _
|
||||
"工序:获取WIM文件信息"
|
||||
t.s "Get WIM image's information failed.", _
|
||||
"获取WIM文件信息失败。"
|
||||
t.s "PHRASE:Mount WIM image", _
|
||||
"工序:挂载 WIM 映像"
|
||||
t.s "Please make the mount dir ", _
|
||||
"请创建挂载目录 "
|
||||
t.s "mount source wim file failed.", _
|
||||
"挂载源WIM文件失败。"
|
||||
t.s "mount base wim file failed.", _
|
||||
"挂载WIM文件失败。"
|
||||
t.s "PHRASE:updating files' ACL rights", _
|
||||
"工序:更新文件访问权限"
|
||||
t.s "Updating...(Please, be patient)", _
|
||||
"更新中...(请耐心等待)"
|
||||
t.s "Update files with Administrators' FULL ACL rights successfully.", _
|
||||
"获取管理者完全访问权限成功。"
|
||||
t.s "PHRASE:Going PE Building process(DEL, ADD, REG)", _
|
||||
"工序:进行PE构建处理(增删文件,处理注册表)"
|
||||
t.s "PHRASE:Commit modification and build the WIM", _
|
||||
"工序:提交对WIM文件的修改,进行工程构建"
|
||||
t.s "Export build WIM failed.", _
|
||||
"导出构建WIM失败"
|
||||
t.s "PHRASE:build bootable ISO file", _
|
||||
"工序:创建可引导ISO镜像"
|
||||
t.s "PROCESS:delete files", _
|
||||
"PROCESS:删除文件"
|
||||
t.s "PROCESS:add files", _
|
||||
"PROCESS:添加文件"
|
||||
t.s "PROCESS:update registry", _
|
||||
"PROCESS:更新注册表"
|
||||
t.s "X: is already use.", _
|
||||
"X:驱动器已被使用,"
|
||||
t.s "Try SUBST X: /D?[y/n]:", _
|
||||
"是否尝试使用SUBST X: /D命令卸载?[y/n]"
|
||||
t.s "X: is already in use, goto CLEANUP.", _
|
||||
"X:驱动器已被使用,即将进行清理工作"
|
||||
t.s "Please specify the @s in config file", _
|
||||
"请在配置文件中定义@s参数"
|
18
i18n/colormapping.vbs
Normal file
18
i18n/colormapping.vbs
Normal file
@ -0,0 +1,18 @@
|
||||
Set objColorStrDic = CreateObject("scripting.dictionary")
|
||||
|
||||
CLR_Add "CUSTOM", ""
|
||||
CLR_Add "PHRASE", "96m"
|
||||
CLR_Add "WARN", "93m"
|
||||
CLR_Add "ERROR", "97;101m"
|
||||
|
||||
Sub CLR_Add(macro, colorcode)
|
||||
objColorStrDic.Add macro, colorcode
|
||||
End Sub
|
||||
|
||||
Function CLR_Trans(macro)
|
||||
If objColorStrDic.Exists(macro) Then
|
||||
CLR_Trans = "\033[" & objColorStrDic.Item(macro)
|
||||
Exit Function
|
||||
End If
|
||||
CLR_Trans = "\033[" & Replace(macro, ":", ";")
|
||||
End Function
|
78
i18n/i18n.vbs
Normal file
78
i18n/i18n.vbs
Normal file
@ -0,0 +1,78 @@
|
||||
If WSH.Arguments.Count = 0 Then WSH.Quit(0)
|
||||
If WSH.Arguments.Count = 1 Then
|
||||
WSH.Echo GetLocale()
|
||||
WSH.Quit(0)
|
||||
End If
|
||||
|
||||
Set objI18nStrDic = CreateObject("scripting.dictionary")
|
||||
Set objI18nRegExpDic = CreateObject("scripting.dictionary")
|
||||
Class I18n
|
||||
Private Sub Class_Initialize
|
||||
End Sub
|
||||
Private Sub Class_Terminate
|
||||
End Sub
|
||||
Public Sub s(str, trans)
|
||||
objI18nStrDic.Add str, trans
|
||||
End Sub
|
||||
Public Sub r(regexp, trans)
|
||||
objI18nRegExpDic.Add regexp, trans
|
||||
End Sub
|
||||
|
||||
Public Function trans(str)
|
||||
trans = str
|
||||
'direct match
|
||||
If objI18nStrDic.Exists(str) Then
|
||||
trans = objI18nStrDic.Item(str)
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
'part match
|
||||
Dim objKeys, i, p
|
||||
objKeys = objI18nStrDic.Keys
|
||||
For i = 0 To objI18nStrDic.Count - 1
|
||||
p = InStr(1, str, objKeys(i))
|
||||
If p > 0 Then
|
||||
trans = Replace(str, objKeys(i), objI18nStrDic.Item(objKeys(i)))
|
||||
Exit Function
|
||||
End If
|
||||
Next
|
||||
|
||||
'TODO:RegExp match
|
||||
End Function
|
||||
End Class
|
||||
Set t = New I18n
|
||||
|
||||
Sub Trans()
|
||||
Dim modestr, mode, colorstr, transstr, f, i, pos
|
||||
f = 1
|
||||
modestr = WSH.Arguments(0)
|
||||
mode = "ECHO"
|
||||
colorstr = ""
|
||||
If InStr(1, modestr, "LOG") > 0 Then mode = "LOG"
|
||||
If InStr(1, modestr, "CLR") = 1 Then
|
||||
colorstr = WSH.Arguments(0)
|
||||
'f = f + 1
|
||||
pos = InstrRev(colorstr, "_")
|
||||
colorstr = CLR_Trans(Mid(colorstr, pos + 1))
|
||||
End If
|
||||
transstr = t.trans(WSH.Arguments(f))
|
||||
For i = f + 1 To WSH.Arguments.Count - 1
|
||||
transstr = Replace(transstr, "@s", WSH.Arguments(i), 1, 1)
|
||||
Next
|
||||
Select Case mode
|
||||
Case "ECHO"
|
||||
WSH.Echo colorstr & transstr
|
||||
Case "LOG"
|
||||
WSH.Echo colorstr & transstr
|
||||
WSH.Echo log_prefix() & Left("INFO" & Space(10), 10) & transstr
|
||||
Case Else
|
||||
WSH.Echo transstr
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Function log_prefix()
|
||||
dim N
|
||||
N = Now()
|
||||
log_prefix = Year(N) & "-" & Right("0" & Month(N), 2) & "-" & Right("0" & Day(N), 2) & " "
|
||||
log_prefix = log_prefix & Right("0" & Hour(N), 2) & ":" & Right("0" & Minute(N), 2) & ":" & Right("0" & Second(N), 2) & ","
|
||||
End Function
|
8
i18n/i18n.wsf
Normal file
8
i18n/i18n.wsf
Normal file
@ -0,0 +1,8 @@
|
||||
<job id="i18n">
|
||||
<script language="VBScript" src="i18n.vbs" />
|
||||
<script language="VBScript" src="colormapping.vbs" />
|
||||
<script language="VBScript" src="0.vbs" />
|
||||
<script language="VBScript">
|
||||
Trans()
|
||||
</script>
|
||||
</job>
|
7
i18n/i18n_.wsf
Normal file
7
i18n/i18n_.wsf
Normal file
@ -0,0 +1,7 @@
|
||||
<job id="i18n">
|
||||
<script language="VBScript" src="i18n.vbs" />
|
||||
<script language="VBScript" src="colormapping.vbs" />
|
||||
<script language="VBScript">
|
||||
Trans()
|
||||
</script>
|
||||
</job>
|
Loading…
x
Reference in New Issue
Block a user