解读 DetermineServicingStackVersion
2017-03-15 22:01
357 查看
解读 DetermineServicingStackVersion
这里也没有涉及到 hFile
的值修改。
//----- (10086424)--------------------------------------------------------
int __fastcall DetermineServicingStackVersion(LPCWSTR lpwstrFilename,
const WCHAR *a2)
{
v2 =lpwstrFilename;
v7 =0;
v8 =0;
v9 =0;
v10 =0;
v11 =0;
v12 =0i64;
v3 =FindServicingStackDirectoryVersion(a2,
(_DWORD *)&v12+
1, &v12);
v4 =v3;
if (v3 >=
0)
goto LABEL_10;
CBSWdsLog(0x4000000, v3,
1, "Failed to find servicing stack directory in onlinestore.");
if (hFile
)
CBSWdsLog(0x4000000,
0, 0,
"Offline servicing,using stack version from: %S", v2);
v6 =FileVersion(v2,
(_DWORD*)&v12
+1,
(int)&v12);
v4 =v6;
if (v6 >=
0)
{
LABEL_10:
vServicingStackVersion = v12;
CBSWdsLog(
0x4000000,
0,
0,
"LoadedServicing Stack v%d.%d.%d.%d with Core: %S",
HIDWORD(v12)
>>16,
WORD2(v12),
(unsignedint)v12
>>16,
(unsigned__int16)v12,
v2);
}
else
{
CBSWdsLog(0x4000000, v6,
1, "Failed to get servicing stack version from file:%S", v2);
}
CCbsStoreObject::~CCbsStoreObject((CCbsStoreObject*)&v7);
return v4;
}
// 1019AA88: using guessed type unsigned __int64vServicingStackVersion;
//----- (10087D1F) --------------------------------------------------------
int __thiscall CoreResourcesLoad(constunsigned __int16
*this)
{
v1 =hFile;
v2 =0;
v12 =this;
v3 =0;
lpLibFileName =
0;
memset(Dst,0, 0x208u);
CBS_EnterCriticalSection(&vCoreResourcesLock);
if (vhCoreResourcesDll
)
{
v3 =-2146498558;
CBSWdsLog(0x4000000,
-2146498558,
1, "CoreResources have been already beeninitialized.");
goto LABEL_11;
}
if (GetWindowsDirectoryW(Dst, 0x104u)
)
{
if (!v1
)
{
v3 =SczAllocFromSz((int
*)&lpLibFileName, Dst);
if (v3 <
0)
{
v2 =lpLibFileName;
v11 =lpLibFileName;
v10 ="Failed to allocate core resources path fromwindows directory: %S";
}
else
{
v3 =SczEnsureBackslashTerminated((const void**)&lpLibFileName);
if ( v3 >=
0 )
{
v3 =SczAllocConcat2Sz((const void
**)&lpLibFileName, L"servicing\\",L"CbsMsg.dll");
if ( v3 <0
)
{
CBSWdsLog(0x4000000, v3,
1, "Failed to allocatefull path to core resources DLL.");
goto LABEL_24;
}
v2 =lpLibFileName;
v4 =LoadLibraryExW(lpLibFileName,
0, 2u);
vhCoreResourcesDll = v4;
LABEL_8:
if ( v4
)
goto LABEL_9;
if ( v2
)
{
operator delete((void
*)(v2
-
2));
lpLibFileName =
0;
}
v3 =SczAllocConcat2Sz((const void
**)&lpLibFileName, v12, L"CbsMsg.dll");
if ( v3 >=0
)
{
v2 = lpLibFileName;
vhCoreResourcesDll = LoadLibraryExW(lpLibFileName,0, 2u);
if ( vhCoreResourcesDll
)
goto LABEL_9;
v3 =
0;
v8 = GetLastError();
if ( v8 >0
)
v8 =
(unsigned__int16)v8
|0x80070000;
v11 = v2;
v10 =
"Failed toload cbsmsg DLL: %S (possibly expected)";
v9 = v8;
LABEL_33:
CBSWdsLog(0x4000000, v9,
1, v10, v11);
LABEL_9:
if ( v2
)
operator delete((void
*)(v2
-
2));
goto LABEL_11;
}
CBSWdsLog(0x4000000, v3,
1, "Failed to allocatefull path to DrUpdate DLL.");
LABEL_24:
v2 =lpLibFileName;
goto LABEL_9;
}
v2 =lpLibFileName;
v11 =lpLibFileName;
v10 ="Failed to ensure core resources path ended witha backslash: %S";
}
v9 =v3;
goto LABEL_33;
}
v4 =vhCoreResourcesDll;
goto LABEL_8;
}
v6 =GetLastError();
v3 =v6;
v7 =v6 <
0;
if (v6 >
0)
{
v3 =(unsigned __int16)v6
|
0x80070000;
v7 =v3 <
0;
}
if (!v7
)
v3 =-2147467259;
CBSWdsLog(0x4000000, v3,
1, "Failed to get windows directory for CoreResourcespath.");
LABEL_11:
CBS_LeaveCriticalSection(&vCoreResourcesLock);
return v3;
}
//----- (100864B9)--------------------------------------------------------
signed int __fastcall FindServicingStackDirectoryVersion(const WCHAR
*a1,_DWORD *a2, _DWORD
*a3)
{
phkResult =0;
v3 =0;
v15 =a2;
v17 =0;
v4 =0;
v19 =0i64;
lpString1 =a1;
lpSrc =0;
lpString2 =0;
v5 =RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ComponentBased Servicing\\Version",
0,
0x20019u,
&phkResult);
v6 =v5 <
0;
if (v5 >
0)
v6 =(((unsigned __int16)v5
|
0x80070000) &
0x80000000)
!= 0;
if (v6
)
{
LABEL_28:
v10 =-2147023728;
CBSWdsLog(0x4000000,
-2147023728,
1, "Failed to find a matching version for servicing stack:%S", lpString1);
}
else
{
for (i =
0;; i = v18
+1
)
{
v18 =i;
memset(&Dst,
0,0x208u);
v9 =CbsRegEnumStringValue(i, phkResult,
(HKEY)&Dst, v8,
(unsigned__int16
*)&lpSrc,v13, v14);
v10 =v9;
if (v9 ==
-2147024637
)
break;
if (v9 <
0)
{
CBSWdsLog(0x4000000, v9,
1, "Failed to enumerate all servicing stackversions.");
v4 =lpSrc;
goto LABEL_18;
}
v4 =lpSrc;
v10 =FileExpandPath(lpSrc,
(LPWSTR *)&lpString2);
if (v10 <
0)
{
v3 =lpString2;
CBSWdsLog(0x4000000, v10,
1, "Failed to expand path from onine store: %S",lpString2);
goto LABEL_18;
}
v11 =SczEnsureBackslashTerminated((const void**)&lpString2);
v3 =lpString2;
v10 =v11;
if (v11 <
0)
{
CBSWdsLog(0x4000000, v11,
1, "Failed to ensure path to online store is backslashterminated: %S", lpString2);
goto LABEL_18;
}
if (CompareStringW(0x7Fu, 1u, lpString1,
-1, lpString2,-1)
==
2 )
{
v20 =0i64;
if ( FileVersionFromString((wchar_t*)&Dst,
(_DWORD*)&v20
+1,
&v20)
>=
0 &&v20
> v19
)
{
v17 =1;
v19 =v20;
}
}
if (v4
)
{
operator delete((void
*)(v4 -
2));
lpSrc =0;
}
}
v10 =0;
v4 =lpSrc;
if (!v17
)
goto LABEL_28;
*v15= HIDWORD(v19);
*a3= v19;
}
LABEL_18:
if (v3
)
operator delete((void
*)(v3
-
2));
if (v4
)
operator delete((void
*)(v4
-
2));
if (phkResult
)
RegCloseKey(phkResult);
return v10;
}
这里也没有涉及到 hFile
的值修改。
//----- (10086424)--------------------------------------------------------
int __fastcall DetermineServicingStackVersion(LPCWSTR lpwstrFilename,
const WCHAR *a2)
{
v2 =lpwstrFilename;
v7 =0;
v8 =0;
v9 =0;
v10 =0;
v11 =0;
v12 =0i64;
v3 =FindServicingStackDirectoryVersion(a2,
(_DWORD *)&v12+
1, &v12);
v4 =v3;
if (v3 >=
0)
goto LABEL_10;
CBSWdsLog(0x4000000, v3,
1, "Failed to find servicing stack directory in onlinestore.");
if (hFile
)
CBSWdsLog(0x4000000,
0, 0,
"Offline servicing,using stack version from: %S", v2);
v6 =FileVersion(v2,
(_DWORD*)&v12
+1,
(int)&v12);
v4 =v6;
if (v6 >=
0)
{
LABEL_10:
vServicingStackVersion = v12;
CBSWdsLog(
0x4000000,
0,
0,
"LoadedServicing Stack v%d.%d.%d.%d with Core: %S",
HIDWORD(v12)
>>16,
WORD2(v12),
(unsignedint)v12
>>16,
(unsigned__int16)v12,
v2);
}
else
{
CBSWdsLog(0x4000000, v6,
1, "Failed to get servicing stack version from file:%S", v2);
}
CCbsStoreObject::~CCbsStoreObject((CCbsStoreObject*)&v7);
return v4;
}
// 1019AA88: using guessed type unsigned __int64vServicingStackVersion;
//----- (10087D1F) --------------------------------------------------------
int __thiscall CoreResourcesLoad(constunsigned __int16
*this)
{
v1 =hFile;
v2 =0;
v12 =this;
v3 =0;
lpLibFileName =
0;
memset(Dst,0, 0x208u);
CBS_EnterCriticalSection(&vCoreResourcesLock);
if (vhCoreResourcesDll
)
{
v3 =-2146498558;
CBSWdsLog(0x4000000,
-2146498558,
1, "CoreResources have been already beeninitialized.");
goto LABEL_11;
}
if (GetWindowsDirectoryW(Dst, 0x104u)
)
{
if (!v1
)
{
v3 =SczAllocFromSz((int
*)&lpLibFileName, Dst);
if (v3 <
0)
{
v2 =lpLibFileName;
v11 =lpLibFileName;
v10 ="Failed to allocate core resources path fromwindows directory: %S";
}
else
{
v3 =SczEnsureBackslashTerminated((const void**)&lpLibFileName);
if ( v3 >=
0 )
{
v3 =SczAllocConcat2Sz((const void
**)&lpLibFileName, L"servicing\\",L"CbsMsg.dll");
if ( v3 <0
)
{
CBSWdsLog(0x4000000, v3,
1, "Failed to allocatefull path to core resources DLL.");
goto LABEL_24;
}
v2 =lpLibFileName;
v4 =LoadLibraryExW(lpLibFileName,
0, 2u);
vhCoreResourcesDll = v4;
LABEL_8:
if ( v4
)
goto LABEL_9;
if ( v2
)
{
operator delete((void
*)(v2
-
2));
lpLibFileName =
0;
}
v3 =SczAllocConcat2Sz((const void
**)&lpLibFileName, v12, L"CbsMsg.dll");
if ( v3 >=0
)
{
v2 = lpLibFileName;
vhCoreResourcesDll = LoadLibraryExW(lpLibFileName,0, 2u);
if ( vhCoreResourcesDll
)
goto LABEL_9;
v3 =
0;
v8 = GetLastError();
if ( v8 >0
)
v8 =
(unsigned__int16)v8
|0x80070000;
v11 = v2;
v10 =
"Failed toload cbsmsg DLL: %S (possibly expected)";
v9 = v8;
LABEL_33:
CBSWdsLog(0x4000000, v9,
1, v10, v11);
LABEL_9:
if ( v2
)
operator delete((void
*)(v2
-
2));
goto LABEL_11;
}
CBSWdsLog(0x4000000, v3,
1, "Failed to allocatefull path to DrUpdate DLL.");
LABEL_24:
v2 =lpLibFileName;
goto LABEL_9;
}
v2 =lpLibFileName;
v11 =lpLibFileName;
v10 ="Failed to ensure core resources path ended witha backslash: %S";
}
v9 =v3;
goto LABEL_33;
}
v4 =vhCoreResourcesDll;
goto LABEL_8;
}
v6 =GetLastError();
v3 =v6;
v7 =v6 <
0;
if (v6 >
0)
{
v3 =(unsigned __int16)v6
|
0x80070000;
v7 =v3 <
0;
}
if (!v7
)
v3 =-2147467259;
CBSWdsLog(0x4000000, v3,
1, "Failed to get windows directory for CoreResourcespath.");
LABEL_11:
CBS_LeaveCriticalSection(&vCoreResourcesLock);
return v3;
}
//----- (100864B9)--------------------------------------------------------
signed int __fastcall FindServicingStackDirectoryVersion(const WCHAR
*a1,_DWORD *a2, _DWORD
*a3)
{
phkResult =0;
v3 =0;
v15 =a2;
v17 =0;
v4 =0;
v19 =0i64;
lpString1 =a1;
lpSrc =0;
lpString2 =0;
v5 =RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ComponentBased Servicing\\Version",
0,
0x20019u,
&phkResult);
v6 =v5 <
0;
if (v5 >
0)
v6 =(((unsigned __int16)v5
|
0x80070000) &
0x80000000)
!= 0;
if (v6
)
{
LABEL_28:
v10 =-2147023728;
CBSWdsLog(0x4000000,
-2147023728,
1, "Failed to find a matching version for servicing stack:%S", lpString1);
}
else
{
for (i =
0;; i = v18
+1
)
{
v18 =i;
memset(&Dst,
0,0x208u);
v9 =CbsRegEnumStringValue(i, phkResult,
(HKEY)&Dst, v8,
(unsigned__int16
*)&lpSrc,v13, v14);
v10 =v9;
if (v9 ==
-2147024637
)
break;
if (v9 <
0)
{
CBSWdsLog(0x4000000, v9,
1, "Failed to enumerate all servicing stackversions.");
v4 =lpSrc;
goto LABEL_18;
}
v4 =lpSrc;
v10 =FileExpandPath(lpSrc,
(LPWSTR *)&lpString2);
if (v10 <
0)
{
v3 =lpString2;
CBSWdsLog(0x4000000, v10,
1, "Failed to expand path from onine store: %S",lpString2);
goto LABEL_18;
}
v11 =SczEnsureBackslashTerminated((const void**)&lpString2);
v3 =lpString2;
v10 =v11;
if (v11 <
0)
{
CBSWdsLog(0x4000000, v11,
1, "Failed to ensure path to online store is backslashterminated: %S", lpString2);
goto LABEL_18;
}
if (CompareStringW(0x7Fu, 1u, lpString1,
-1, lpString2,-1)
==
2 )
{
v20 =0i64;
if ( FileVersionFromString((wchar_t*)&Dst,
(_DWORD*)&v20
+1,
&v20)
>=
0 &&v20
> v19
)
{
v17 =1;
v19 =v20;
}
}
if (v4
)
{
operator delete((void
*)(v4 -
2));
lpSrc =0;
}
}
v10 =0;
v4 =lpSrc;
if (!v17
)
goto LABEL_28;
*v15= HIDWORD(v19);
*a3= v19;
}
LABEL_18:
if (v3
)
operator delete((void
*)(v3
-
2));
if (v4
)
operator delete((void
*)(v4
-
2));
if (phkResult
)
RegCloseKey(phkResult);
return v10;
}
相关文章推荐
- 解读 FindServicingStackDirectoryVersion
- x264_stack_align( x264_slice_write, h )解读
- could not launch process: Could not determine version number: could not find symbol value for runtim
- How To Determine CentOS or Red Hat Version - rackAID
- 144. Binary Tree Preorder Traversal Stack version
- 解读 GetDllVersionString
- Customized version of Stack C++(自定义版本)
- 新建Android studio项目后出现Error:Could not determine Java version using executable
- CentOS6.0安装xen-tools失败:Fatal error: Failed to determine Linux distribution and version
- How to determine which version of .net framework are installed
- fw 3.6 - stack sort- java version - 2013年12月16日23:23:32
- Android Studio Could not determine java version from '9.0.1'.
- ZigBee学习之——ZStack API解读
- CentOS6.0安装xen-tools失败:Fatal error: Failed to determine Linux distribution and version
- ActivityStackSupervisor.java关键信息解读
- java集合07--Stack源码解读
- 线性表数据结构解读(三)栈结构Stack
- android studio 报错Error:Could not determine java version from '9.0.4'.等一系列疑难杂症
- salt stack deploy openstack G version