mirror of
https://github.com/roswell/roswell.git
synced 2026-09-10 07:16:17 -04:00
style.
This commit is contained in:
parent
5963f6c313
commit
f6b603efe3
|
|
@ -2,73 +2,57 @@
|
|||
#ifdef HAVE_WINDOWS_H
|
||||
#include "cmd-install.h"
|
||||
#include "util.h"
|
||||
#include <windows.h>
|
||||
|
||||
char* sbcl_bin_extention(struct install_options* param) {
|
||||
return ".msi";
|
||||
}
|
||||
|
||||
char* msi_exec_path_from_register(void) {
|
||||
DWORD keyType=0;
|
||||
DWORD length=0;
|
||||
const DWORD flags=RRF_RT_REG_SZ; /* Only read strings (REG_SZ) */
|
||||
LONG result=RegGetValueA(HKEY_LOCAL_MACHINE,
|
||||
"SYSTEM\\CurrentControlSet\\Services\\msiserver",
|
||||
"ImagePath",
|
||||
flags,
|
||||
&keyType,
|
||||
NULL, /* pvData == nullptr ? Request buffer size */
|
||||
&length);
|
||||
|
||||
char* msi_exec_path_from_register(void)
|
||||
{
|
||||
DWORD keyType = 0;
|
||||
DWORD length = 0;
|
||||
const DWORD flags = RRF_RT_REG_SZ; // Only read strings (REG_SZ)
|
||||
LONG result = RegGetValueA(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
"SYSTEM\\CurrentControlSet\\Services\\msiserver",
|
||||
"ImagePath",
|
||||
flags,
|
||||
&keyType,
|
||||
NULL, // pvData == nullptr ? Request buffer size
|
||||
&length);
|
||||
|
||||
if (result != ERROR_SUCCESS)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if(result != ERROR_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
char* textBuffer=(char*)alloc(length);
|
||||
|
||||
|
||||
result= RegGetValueA(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
"SYSTEM\\CurrentControlSet\\Services\\msiserver",
|
||||
"ImagePath",
|
||||
flags,
|
||||
NULL,
|
||||
textBuffer, // Write string in this destination buffer
|
||||
&length);
|
||||
|
||||
if (result != ERROR_SUCCESS)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Skip trailing blanks take the full path of the executable then cut at the first blank afterwards
|
||||
char* start=textBuffer;
|
||||
|
||||
while(*start==' ' && *start!=0)
|
||||
start++;
|
||||
if(*start==0)
|
||||
return NULL;
|
||||
|
||||
char* end=start;
|
||||
|
||||
while(*end!=0)
|
||||
{
|
||||
if(*end==' ')
|
||||
{
|
||||
*end=0;
|
||||
break;
|
||||
}
|
||||
end++;
|
||||
}
|
||||
|
||||
return start;
|
||||
result= RegGetValueA(HKEY_LOCAL_MACHINE,
|
||||
"SYSTEM\\CurrentControlSet\\Services\\msiserver",
|
||||
"ImagePath",
|
||||
flags,
|
||||
NULL,
|
||||
textBuffer, /* Write string in this destination buffer */
|
||||
&length);
|
||||
|
||||
if(result!=ERROR_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
/*Skip trailing blanks take the full path of the executable then cut at the first blank afterwards*/
|
||||
char* start=textBuffer;
|
||||
|
||||
while(*start==' ' && *start!=0)
|
||||
start++;
|
||||
|
||||
if(*start==0)
|
||||
return NULL;
|
||||
|
||||
for(char* end=start;*end!='\0';end++) {
|
||||
if(*end==' ') {
|
||||
*end='\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
|
||||
int sbcl_bin_expand(struct install_options* param) {
|
||||
char* impl=param->impl;
|
||||
char* version=q(param->version);
|
||||
|
|
@ -83,14 +67,12 @@ int sbcl_bin_expand(struct install_options* param) {
|
|||
dist_path=cat(home,"src",SLASH,impl,"-",version,"-",arch,SLASH,NULL);
|
||||
|
||||
char* msiexec_path=msi_exec_path_from_register();
|
||||
if(msiexec_path==NULL || !file_exist_p(msiexec_path))
|
||||
{
|
||||
msiexec_path="msiexec.exe";
|
||||
if(!file_exist_p(msiexec_path))
|
||||
{
|
||||
printf("Msiexec.exe not found in the system path\n");
|
||||
return 0;
|
||||
}
|
||||
if(msiexec_path==NULL || !file_exist_p(msiexec_path)) {
|
||||
msiexec_path="msiexec.exe";
|
||||
if(!file_exist_p(msiexec_path)) {
|
||||
printf("Msiexec.exe not found in the system path\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Extracting the msi archive. %s to %s\n",archive,dist_path);
|
||||
|
|
@ -102,7 +84,7 @@ int sbcl_bin_expand(struct install_options* param) {
|
|||
dist_path[strlen(dist_path)-1]='\0';
|
||||
|
||||
char* cmd=cat(msiexec_path,
|
||||
" /a \"",
|
||||
" /a \"",
|
||||
archive,
|
||||
"\" targetdir=\"",
|
||||
dist_path,
|
||||
|
|
|
|||
Loading…
Reference in a new issue