Skip to content

Commit

Permalink
1.2.rev157
Browse files Browse the repository at this point in the history
* Continuing on issues for #18 on WINNT
* SystemAppUserModelId on shortcuts now works, i found out that if it
already exists you cannot update it, it will throw access denied. so
that id can only be set if it the file doesnt exist
  • Loading branch information
Noitidart committed Mar 28, 2015
1 parent 654e1f7 commit 9b4e390
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions modules/ostypes_win.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1364,10 +1364,10 @@ var winInit = function() {
var hr_GetValue = pps.GetValue(vtblPpsPtr, pkey, ppropvar.address());
this.checkHRESULT(hr_GetValue, 'IPropertyStore_GetValue');

console.info('ppropvar:', ppropvar.toString(), uneval(ppropvar));
//console.info('ppropvar:', ppropvar.toString(), uneval(ppropvar));

if (ret_js) {
console.info('ppropvar.pwszVal:', ppropvar.pwszVal.toString(), uneval(ppropvar.pwszVal));
//console.info('ppropvar.pwszVal:', ppropvar.pwszVal.toString(), uneval(ppropvar.pwszVal));
if (ppropvar.pwszVal.isNull()) {
console.log('ppropvar.pwszVal is NULL so blank string was found');
var jsstr = '';
Expand All @@ -1376,7 +1376,7 @@ var winInit = function() {
}

var rez_PropVariantClear = self.API('PropVariantClear')(ppropvar.address());
console.info('rez_PropVariantClear:', rez_PropVariantClear.toString(), uneval(rez_PropVariantClear));
//console.info('rez_PropVariantClear:', rez_PropVariantClear.toString(), uneval(rez_PropVariantClear));

return jsstr;
} else {
Expand Down
15 changes: 9 additions & 6 deletions modules/workers/ProfilistWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ function createShortcut(path_createInDir, str_createWithName, path_linkTo, optio
str_createWtihArgs: '-P -no-remote', // no args are set if not provided
str_createWithDesc: 'this is description i want shown on my shortcut', // no descriptin is set if not provided
path_createWithWorkDir: null // i have no idea what a working dir is, but if not provided its not set
}
*/
// creates shortcut file (.lnk)
Expand Down Expand Up @@ -203,8 +202,8 @@ function createShortcut(path_createInDir, str_createWithName, path_linkTo, optio

if ('str_createWithAppUserModelId' in options) {
ostypes.HELPER.InitPropStoreConsts();
var propertyStorePtr = ostypes.IPropertyStore.ptr();
var hr_shellLinkQI2 = shellLink.QueryInterface(shellLinkPtr, IID_IPropertyStore.address(), propertyStorePtr.address());
var propertyStorePtr = ostypes.TYPE.IPropertyStore.ptr();
var hr_shellLinkQI2 = shellLink.QueryInterface(shellLinkPtr, ostypes.CONST.IID_IPropertyStore.address(), propertyStorePtr.address());
console.info('hr_shellLinkQI2:', hr_shellLinkQI2.toString(), uneval(hr_shellLinkQI2));
ostypes.HELPER.checkHRESULT(hr_shellLinkQI2, 'QueryInterface (IShellLink->IPropertyStore)');
propertyStore = propertyStorePtr.contents.lpVtbl.contents;
Expand Down Expand Up @@ -265,9 +264,13 @@ function createShortcut(path_createInDir, str_createWithName, path_linkTo, optio
}

if ('str_createWithAppUserModelId' in options) {
var hr_systemAppUserModelID = ostypes.HELPER.IPropertyStore_SetValue(propertyStorePtr, propertyStore, ostypes.CONST.PKEY_AppUserModel_ID.address(), options.str_createWithAppUserModelId);
ostypes.HELPER.checkHRESULT(hr_systemAppUserModelID, 'hr_systemAppUserModelID');

if (promise_checkExists) {
console.error('cannot update System.AppUserModel.ID, you specified it should though, so throwing warning as it will not update it'); // trying to update while it exists returns HRESULT of -2147287035 which is STG_E_ACCESSDENIED
} else {
var hr_systemAppUserModelID = ostypes.HELPER.IPropertyStore_SetValue(propertyStorePtr, propertyStore, ostypes.CONST.PKEY_AppUserModel_ID.address(), options.str_createWithAppUserModelId);
ostypes.HELPER.checkHRESULT(hr_systemAppUserModelID, 'hr_systemAppUserModelID');
}

var jsstr_IPSGetValue = ostypes.HELPER.IPropertyStore_GetValue(propertyStorePtr, propertyStore, ostypes.CONST.PKEY_AppUserModel_ID.address(), null);
console.info('jsstr_IPSGetValue:', jsstr_IPSGetValue.toString(), uneval(jsstr_IPSGetValue));
}
Expand Down

0 comments on commit 9b4e390

Please sign in to comment.