Converted to lock blocks

This commit is contained in:
Yoshi Askharoun
2021-12-23 22:40:40 -06:00
parent 0502215213
commit 4e49c93747
26 changed files with 234 additions and 459 deletions
+8
View File
@@ -41,6 +41,14 @@ internal unsafe class CComPtrNtv<TPtr> : IDisposable where TPtr : unmanaged
} }
} }
public ref TPtr* GetPinnableReference()
{
fixed (TPtr** ptr = &p)
{
return ref *ptr;
}
}
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)
{ {
if (!disposedValue) if (!disposedValue)
@@ -45,34 +45,24 @@ namespace Microsoft.Zune.Configuration
{ {
add add
{ {
try lock (m_lock)
{ {
Monitor.Enter(m_lock);
if (null == m_configurationChangeEventHandler) if (null == m_configurationChangeEventHandler)
{ {
Subscribe(OnNativeConfigChangedCallback); Subscribe(OnNativeConfigChangedCallback);
} }
m_configurationChangeEventHandler = (ConfigurationChangeEventHandler)Delegate.Combine(m_configurationChangeEventHandler, value); m_configurationChangeEventHandler = (ConfigurationChangeEventHandler)Delegate.Combine(m_configurationChangeEventHandler, value);
} }
finally
{
Monitor.Exit(m_lock);
}
} }
remove remove
{ {
try lock (m_lock)
{ {
Monitor.Enter(m_lock);
if (null == (m_configurationChangeEventHandler = (ConfigurationChangeEventHandler)Delegate.Remove(m_configurationChangeEventHandler, value))) if (null == (m_configurationChangeEventHandler = (ConfigurationChangeEventHandler)Delegate.Remove(m_configurationChangeEventHandler, value)))
{ {
Unsubscribe(); Unsubscribe();
} }
} }
finally
{
Monitor.Exit(m_lock);
}
} }
} }
@@ -22,9 +22,8 @@ namespace Microsoft.Zune.Playlist
{ {
if (sm_instance == null) if (sm_instance == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_instance == null) if (sm_instance == null)
{ {
PlaylistManager playlistManager = new PlaylistManager(); PlaylistManager playlistManager = new PlaylistManager();
@@ -32,10 +31,6 @@ namespace Microsoft.Zune.Playlist
sm_instance = playlistManager; sm_instance = playlistManager;
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_instance; return sm_instance;
} }
@@ -61,13 +56,13 @@ namespace Microsoft.Zune.Playlist
public unsafe HRESULT CreatePlaylist(string title, string author, [In] ValueType serviceMediaId, CreatePlaylistOption options, out int playlistId) public unsafe HRESULT CreatePlaylist(string title, string author, [In] ValueType serviceMediaId, CreatePlaylistOption options, out int playlistId)
{ {
playlistId = -1; playlistId = -1;
bool flag = (options & CreatePlaylistOption.PrivatePlaylist) > CreatePlaylistOption.None; bool isPrivate = (options & CreatePlaylistOption.PrivatePlaylist) > CreatePlaylistOption.None;
bool flag2 = (options & CreatePlaylistOption.AutoPlaylist) > CreatePlaylistOption.None; bool isAuto = (options & CreatePlaylistOption.AutoPlaylist) > CreatePlaylistOption.None;
bool flag3 = (options & CreatePlaylistOption.SyncRule) > CreatePlaylistOption.None; bool syncRule = (options & CreatePlaylistOption.SyncRule) > CreatePlaylistOption.None;
bool flag4 = (options & CreatePlaylistOption.OverwriteOnConflict) > CreatePlaylistOption.None; bool overwrite = (options & CreatePlaylistOption.OverwriteOnConflict) > CreatePlaylistOption.None;
bool flag5 = (options & CreatePlaylistOption.RenameOnConflict) > CreatePlaylistOption.None; bool rename = (options & CreatePlaylistOption.RenameOnConflict) > CreatePlaylistOption.None;
int hr; int hr;
if ((flag && (flag2 || flag3)) || (flag4 && flag5)) if ((isPrivate && (isAuto || syncRule)) || (overwrite && rename))
{ {
hr = -2147024809; hr = -2147024809;
} }
@@ -77,22 +72,22 @@ namespace Microsoft.Zune.Playlist
} }
else else
{ {
fixed (char* titlePtr = title.ToCharArray()) fixed (char* titlePtr = title)
{ {
ushort* ptr2 = (ushort*)titlePtr; ushort* ptr2 = (ushort*)titlePtr;
try try
{ {
fixed (char* authorPtr = author.ToCharArray()) fixed (char* authorPtr = author)
{ {
ushort* ptr3 = (ushort*)authorPtr; ushort* ptr3 = (ushort*)authorPtr;
try try
{ {
EPlaylistCreateConflictAction ePlaylistCreateConflictAction = 0; EPlaylistCreateConflictAction ePlaylistCreateConflictAction = 0;
if (flag5) if (rename)
{ {
ePlaylistCreateConflictAction = EPlaylistCreateConflictAction.RenameOnConflict; ePlaylistCreateConflictAction = EPlaylistCreateConflictAction.RenameOnConflict;
} }
else if (flag || flag4) else if (isPrivate || overwrite)
{ {
ePlaylistCreateConflictAction = EPlaylistCreateConflictAction.OverwriteOnConflict; ePlaylistCreateConflictAction = EPlaylistCreateConflictAction.OverwriteOnConflict;
} }
@@ -101,22 +96,22 @@ namespace Microsoft.Zune.Playlist
{ {
gUID = (Guid)serviceMediaId; gUID = (Guid)serviceMediaId;
} }
bool flag6 = !(flag3 || flag); bool flag6 = !(syncRule || isPrivate);
EPlaylistType ePlaylistType; EPlaylistType ePlaylistType;
if (flag) if (isPrivate)
{ {
ePlaylistType = (EPlaylistType)4; ePlaylistType = (EPlaylistType)4;
} }
else else
{ {
EPlaylistType ePlaylistType2; EPlaylistType ePlaylistType2;
if (flag3) if (syncRule)
{ {
ePlaylistType2 = (EPlaylistType)3; ePlaylistType2 = (EPlaylistType)3;
} }
else else
{ {
EPlaylistType ePlaylistType3 = (flag2 ? ((EPlaylistType)1) : 0); EPlaylistType ePlaylistType3 = (isAuto ? ((EPlaylistType)1) : 0);
ePlaylistType2 = ePlaylistType3; ePlaylistType2 = ePlaylistType3;
} }
ePlaylistType = ePlaylistType2; ePlaylistType = ePlaylistType2;
@@ -278,7 +273,7 @@ namespace Microsoft.Zune.Playlist
} }
else else
{ {
fixed (char* newTitlePtr = newTitle.ToCharArray()) fixed (char* newTitlePtr = newTitle)
{ {
ushort* ptr = (ushort*)newTitlePtr; ushort* ptr = (ushort*)newTitlePtr;
try try
@@ -344,14 +339,12 @@ namespace Microsoft.Zune.Playlist
string result = candidateTitle; string result = candidateTitle;
if (m_pPlaylistManager != null) if (m_pPlaylistManager != null)
{ {
fixed (char* candidateTitlePtr = candidateTitle.ToCharArray()) fixed (char* candidateTitlePtr = candidateTitle)
{ {
ushort* ptr = (ushort*)candidateTitlePtr; ushort* ptr = (ushort*)candidateTitlePtr;
try try
{ {
PROPVARIANT cComPropVariant; PROPVARIANT cComPropVariant = new();
// IL initblk instruction
Unsafe.InitBlock(&cComPropVariant, 0, 24);
try try
{ {
long num = *(long*)m_pPlaylistManager + 136; long num = *(long*)m_pPlaylistManager + 136;
@@ -52,9 +52,8 @@ namespace Microsoft.Zune.QuickMix
{ {
if (sm_instance == null) if (sm_instance == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_instance == null) if (sm_instance == null)
{ {
QuickMix quickMix = new QuickMix(); QuickMix quickMix = new QuickMix();
@@ -66,10 +65,6 @@ namespace Microsoft.Zune.QuickMix
} }
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_instance; return sm_instance;
} }
@@ -21,7 +21,7 @@ namespace Microsoft.Zune.Service
catch catch
{ {
//try-fault //try-fault
((IDisposable)m_spAccountManagement).Dispose(); m_spAccountManagement.Dispose();
throw; throw;
} }
} }
@@ -22,9 +22,8 @@ namespace Microsoft.Zune.Subscription
{ {
if (sm_instance == null) if (sm_instance == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_instance == null) if (sm_instance == null)
{ {
SubscriptionManager subscriptionManager = new SubscriptionManager(); SubscriptionManager subscriptionManager = new SubscriptionManager();
@@ -32,10 +31,6 @@ namespace Microsoft.Zune.Subscription
sm_instance = subscriptionManager; sm_instance = subscriptionManager;
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_instance; return sm_instance;
} }
@@ -242,7 +237,7 @@ namespace Microsoft.Zune.Subscription
} }
if (num >= 0) if (num >= 0)
{ {
fixed (char* feedUrlPtr = feedUrl.ToCharArray()) fixed (char* feedUrlPtr = feedUrl))
{ {
ushort* ptr3 = (ushort*)feedUrlPtr; ushort* ptr3 = (ushort*)feedUrlPtr;
try try
@@ -366,7 +361,7 @@ namespace Microsoft.Zune.Subscription
num = ValidateUrl(ref feedUrl); num = ValidateUrl(ref feedUrl);
if (num >= 0) if (num >= 0)
{ {
fixed (char* feedUrlPtr = feedUrl.ToCharArray()) fixed (char* feedUrlPtr = feedUrl))
{ {
ushort* ptr = (ushort*)feedUrlPtr; ushort* ptr = (ushort*)feedUrlPtr;
try try
@@ -48,9 +48,8 @@ namespace Microsoft.Zune.Subscription
private void _007EVirtualSubscriptionEpisodeList() private void _007EVirtualSubscriptionEpisodeList()
{ {
Monitor.Enter(m_lock); lock (m_lock)
try {
{
List<SubscriptionDataProviderItem>.Enumerator enumerator = m_items.GetEnumerator(); List<SubscriptionDataProviderItem>.Enumerator enumerator = m_items.GetEnumerator();
while (enumerator.MoveNext()) while (enumerator.MoveNext())
{ {
@@ -58,26 +57,17 @@ namespace Microsoft.Zune.Subscription
} }
m_items = null; m_items = null;
} }
finally
{
Monitor.Exit(m_lock);
}
} }
internal unsafe void AddItem(IMSMediaSchemaPropertySet* pEpisodeItem) internal unsafe void AddItem(IMSMediaSchemaPropertySet* pEpisodeItem)
{ {
Monitor.Enter(m_lock); lock (m_lock)
try {
{
if (m_items != null) if (m_items != null)
{ {
m_items.Add(new SubscriptionDataProviderItem(m_owner, m_typeCookie, m_feedUrl, pEpisodeItem)); m_items.Add(new SubscriptionDataProviderItem(m_owner, m_typeCookie, m_feedUrl, pEpisodeItem));
} }
} }
finally
{
Monitor.Exit(m_lock);
}
} }
internal unsafe void AsyncRetrieveEpisodeList(SubscriptionSeriesInfo seriesInfo) internal unsafe void AsyncRetrieveEpisodeList(SubscriptionSeriesInfo seriesInfo)
@@ -152,9 +142,8 @@ namespace Microsoft.Zune.Subscription
internal void Sort(string sortProperty) internal void Sort(string sortProperty)
{ {
Monitor.Enter(m_lock); lock (m_lock)
try {
{
if (sortProperty != null) if (sortProperty != null)
{ {
SetSortProperty(sortProperty); SetSortProperty(sortProperty);
@@ -165,10 +154,6 @@ namespace Microsoft.Zune.Subscription
} }
Application.DeferredInvoke(DeferredResetList, null); Application.DeferredInvoke(DeferredResetList, null);
} }
finally
{
Monitor.Exit(m_lock);
}
} }
protected override object OnRequestItem(int index) protected override object OnRequestItem(int index)
+2 -7
View File
@@ -17,9 +17,8 @@ namespace Microsoft.Zune.User
{ {
if (sm_instance == null) if (sm_instance == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_instance == null) if (sm_instance == null)
{ {
UserManager userManager = new UserManager(); UserManager userManager = new UserManager();
@@ -27,10 +26,6 @@ namespace Microsoft.Zune.User
sm_instance = userManager; sm_instance = userManager;
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_instance; return sm_instance;
} }
@@ -15,9 +15,8 @@ namespace Microsoft.Zune.UserCredential
{ {
if (sm_instance == null) if (sm_instance == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_instance == null) if (sm_instance == null)
{ {
UserCredentialManager userCredentialManager = new UserCredentialManager(); UserCredentialManager userCredentialManager = new UserCredentialManager();
@@ -25,10 +24,6 @@ namespace Microsoft.Zune.UserCredential
sm_instance = userCredentialManager; sm_instance = userCredentialManager;
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_instance; return sm_instance;
} }
@@ -67,7 +62,7 @@ namespace Microsoft.Zune.UserCredential
{ {
return -2147024882; return -2147024882;
} }
num = Module.GetSingleton((_GUID)Module._GUID_41c80590_c50b_4d27_b860_7c87f3f0cb54, (void**)(&ptr4)); num = Module.GetSingleton(Module.GUIDIUserCredentialManager, (void**)(&ptr4));
if (num >= 0) if (num >= 0)
{ {
num = Module.Microsoft_002EZune_002EUserCredential_002ECUserCredentialProviderProxy_002EInitialize(ptr2, credentialHandler); num = Module.Microsoft_002EZune_002EUserCredential_002ECUserCredentialProviderProxy_002EInitialize(ptr2, credentialHandler);
@@ -112,9 +112,8 @@ namespace Microsoft.Zune.Util
{ {
if (sm_downloadManager == null) if (sm_downloadManager == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_downloadManager == null) if (sm_downloadManager == null)
{ {
DownloadManager downloadManager = new DownloadManager(); DownloadManager downloadManager = new DownloadManager();
@@ -122,10 +121,6 @@ namespace Microsoft.Zune.Util
sm_downloadManager = downloadManager; sm_downloadManager = downloadManager;
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_downloadManager; return sm_downloadManager;
} }
@@ -427,7 +422,7 @@ namespace Microsoft.Zune.Util
try try
{ {
long num4 = *(long*)(cComPtrNtv_003CIDownloadManager_003E.p); long num4 = *(long*)(cComPtrNtv_003CIDownloadManager_003E.p);
singleton = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, int, IDownloadTask**, int>)(*(ulong*)(*(long*)(*(ulong*)(cComPtrNtv_003CIDownloadManager_003E.p)) + 104)))((nint)num4, num3, (IDownloadTask**)(cComPtrNtv_003CIDownloadTask_003E.p)); singleton = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, int, IDownloadTask**, int>)(*(ulong*)(*(long*)(*(ulong*)(cComPtrNtv_003CIDownloadManager_003E.p)) + 104)))((nint)num4, num3, (IDownloadTask**)(cComPtrNtv_003CIDownloadTask_003E.GetPtrToPtr()));
if (singleton >= 0) if (singleton >= 0)
{ {
long num5 = *(long*)(cComPtrNtv_003CIDownloadTask_003E.p); long num5 = *(long*)(cComPtrNtv_003CIDownloadTask_003E.p);
@@ -441,26 +436,20 @@ namespace Microsoft.Zune.Util
} }
} }
} }
catch finally
{ {
//try-fault cComPtrNtv_003CIDownloadTask_003E.Dispose();
Module.___CxxCallUnwindDtor((delegate*<void*, void>)(delegate*<IDownloadTask*, void>)(&Module.CComPtrNtv_003CIDownloadTask_003E._007Bdtor_007D), cComPtrNtv_003CIDownloadTask_003E.p);
throw;
} }
cComPtrNtv_003CIDownloadTask_003E.Dispose();
num3++; num3++;
} }
while (num3 < num); while (num3 < num);
} }
Application.DeferredInvoke(DeferredUpdateActiveList, list); Application.DeferredInvoke(DeferredUpdateActiveList, list);
} }
catch finally
{ {
//try-fault cComPtrNtv_003CIDownloadManager_003E.Dispose();
Module.___CxxCallUnwindDtor((delegate*<void*, void>)(delegate*<IDownloadManager*, void>)(&Module.CComPtrNtv_003CIDownloadManager_003E._007Bdtor_007D), cComPtrNtv_003CIDownloadManager_003E.p);
throw;
} }
cComPtrNtv_003CIDownloadManager_003E.Dispose();
} }
private void DeferredUpdateActiveList(object args) private void DeferredUpdateActiveList(object args)
@@ -24,9 +24,8 @@ namespace Microsoft.Zune.Util
//IL_0086: Expected I, but got I8 //IL_0086: Expected I, but got I8
if (sm_manager == null) if (sm_manager == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_manager == null) if (sm_manager == null)
{ {
FamilySettingsManager familySettingsManager = new FamilySettingsManager(); FamilySettingsManager familySettingsManager = new FamilySettingsManager();
@@ -55,10 +54,6 @@ namespace Microsoft.Zune.Util
sm_manager = familySettingsManager; sm_manager = familySettingsManager;
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_manager; return sm_manager;
} }
@@ -124,13 +124,10 @@ namespace Microsoft.Zune.Util
} }
} }
} }
catch finally
{ {
//try-fault
cComPtrNtv_003CIAsyncCallback_003E.Dispose(); cComPtrNtv_003CIAsyncCallback_003E.Dispose();
throw;
} }
cComPtrNtv_003CIAsyncCallback_003E.Dispose();
return num; return num;
} }
@@ -142,13 +139,7 @@ namespace Microsoft.Zune.Util
{ {
if (P_0) if (P_0)
{ {
try m_spAsyncCallback.Dispose();
{
}
finally
{
((IDisposable)m_spAsyncCallback).Dispose();
}
} }
} }
+24 -38
View File
@@ -18,9 +18,8 @@ namespace Microsoft.Zune.Util
{ {
if (sm_PhotoManager == null) if (sm_PhotoManager == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_PhotoManager == null) if (sm_PhotoManager == null)
{ {
PhotoManager photoManager = new PhotoManager(); PhotoManager photoManager = new PhotoManager();
@@ -28,10 +27,6 @@ namespace Microsoft.Zune.Util
sm_PhotoManager = photoManager; sm_PhotoManager = photoManager;
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_PhotoManager; return sm_PhotoManager;
} }
@@ -89,16 +84,13 @@ namespace Microsoft.Zune.Util
if (num >= 0) if (num >= 0)
{ {
IMetadataManager* intPtr = ptr; IMetadataManager* intPtr = ptr;
__s_GUID gUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d = Module._GUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d6; _GUID guid_IFolderProvider = Module.GUID_IFolderProvider;
num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, (_GUID)gUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d, (void**)(&ptr2)); num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, guid_IFolderProvider, (void**)(&ptr2));
} }
VARIANT tagVARIANT; VARIANT tagVARIANT = default;
*(short*)(&tagVARIANT) = 0;
// IL initblk instruction
Unsafe.InitBlockUnaligned(ref Unsafe.AddByteOffset(ref tagVARIANT, 2), 0, 22);
if (num >= 0) if (num >= 0)
{ {
fixed (char* szFolderNamePtr = szFolderName.ToCharArray()) fixed (char* szFolderNamePtr = szFolderName)
{ {
ushort* ptr3 = (ushort*)szFolderNamePtr; ushort* ptr3 = (ushort*)szFolderNamePtr;
try try
@@ -116,7 +108,7 @@ namespace Microsoft.Zune.Util
} }
if (num >= 0) if (num >= 0)
{ {
nFolderId = Unsafe.As<VARIANT, int>(ref Unsafe.AddByteOffset(ref tagVARIANT, 8)); nFolderId = Unsafe.As<decimal, int>(ref tagVARIANT.decVal);
} }
} }
} }
@@ -159,20 +151,17 @@ namespace Microsoft.Zune.Util
if (num >= 0) if (num >= 0)
{ {
IMetadataManager* intPtr = ptr; IMetadataManager* intPtr = ptr;
__s_GUID gUID_16a9f8be_e76c_4391_ad74_8df74b7a3c = Module._GUID_16a9f8be_e76c_4391_ad74_8df74b7a3c21; _GUID guid_IFileProvider = Module.GUID_IFileProvider;
num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, (_GUID)gUID_16a9f8be_e76c_4391_ad74_8df74b7a3c, (void**)(&ptr2)); num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, guid_IFileProvider, (void**)(&ptr2));
} }
VARIANT tagVARIANT; VARIANT tagVARIANT = default;
*(short*)(&tagVARIANT) = 0;
// IL initblk instruction
Unsafe.InitBlockUnaligned(ref Unsafe.AddByteOffset(ref tagVARIANT, 2), 0, 22);
if (num >= 0) if (num >= 0)
{ {
IFileProvider* intPtr2 = ptr2; IFileProvider* intPtr2 = ptr2;
num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, int, EMediaTypes, VARIANT*, int>)(*(ulong*)(*(long*)ptr2 + 528)))((nint)intPtr2, nMediaId, EMediaTypes.eMediaTypeImage, &tagVARIANT); num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, int, EMediaTypes, VARIANT*, int>)(*(ulong*)(*(long*)ptr2 + 528)))((nint)intPtr2, nMediaId, EMediaTypes.eMediaTypeImage, &tagVARIANT);
if (num >= 0) if (num >= 0)
{ {
nFolderId = Unsafe.As<VARIANT, int>(ref Unsafe.AddByteOffset(ref tagVARIANT, 8)); nFolderId = Unsafe.As<decimal, int>(ref tagVARIANT.decVal);
} }
} }
} }
@@ -219,16 +208,13 @@ namespace Microsoft.Zune.Util
if (num >= 0) if (num >= 0)
{ {
IMetadataManager* intPtr = ptr; IMetadataManager* intPtr = ptr;
__s_GUID gUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d = Module._GUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d6; _GUID guid_IFolderProvider = Module.GUID_IFolderProvider;
num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, (_GUID)gUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d, (void**)(&ptr2)); num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, guid_IFolderProvider, (void**)(&ptr2));
} }
VARIANT tagVARIANT; VARIANT tagVARIANT = default;
*(short*)(&tagVARIANT) = 0;
// IL initblk instruction
Unsafe.InitBlockUnaligned(ref Unsafe.AddByteOffset(ref tagVARIANT, 2), 0, 22);
if (num >= 0) if (num >= 0)
{ {
fixed (char* szFolderNamePtr = szFolderName.ToCharArray()) fixed (char* szFolderNamePtr = szFolderName)
{ {
ushort* ptr3 = (ushort*)szFolderNamePtr; ushort* ptr3 = (ushort*)szFolderNamePtr;
try try
@@ -246,7 +232,7 @@ namespace Microsoft.Zune.Util
} }
if (num >= 0) if (num >= 0)
{ {
nCreatedFolderId = Unsafe.As<VARIANT, int>(ref Unsafe.AddByteOffset(ref tagVARIANT, 8)); nCreatedFolderId = Unsafe.As<decimal, int>(ref tagVARIANT.decVal);
} }
} }
} }
@@ -291,11 +277,11 @@ namespace Microsoft.Zune.Util
if (num >= 0) if (num >= 0)
{ {
IMetadataManager* intPtr = ptr; IMetadataManager* intPtr = ptr;
__s_GUID gUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d = Module._GUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d6; _GUID guid_IFolderProvider = Module.GUID_IFolderProvider;
num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, (_GUID)gUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d, (void**)(&ptr2)); num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, guid_IFolderProvider, (void**)(&ptr2));
if (num >= 0) if (num >= 0)
{ {
fixed (char* szNewFolderNamePtr = szNewFolderName.ToCharArray()) fixed (char* szNewFolderNamePtr = szNewFolderName)
{ {
ushort* ptr3 = (ushort*)szNewFolderNamePtr; ushort* ptr3 = (ushort*)szNewFolderNamePtr;
try try
@@ -359,8 +345,8 @@ namespace Microsoft.Zune.Util
if (num >= 0) if (num >= 0)
{ {
IMetadataManager* intPtr = ptr; IMetadataManager* intPtr = ptr;
__s_GUID gUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d = Module._GUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d6; _GUID guid_IFolderProvider = Module.GUID_IFolderProvider;
num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, (_GUID)gUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d, (void**)(&ptr2)); num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, guid_IFolderProvider, (void**)(&ptr2));
if (num >= 0) if (num >= 0)
{ {
fixed (int* ptr3 = &mediaIds[0]) fixed (int* ptr3 = &mediaIds[0])
@@ -375,7 +361,7 @@ namespace Microsoft.Zune.Util
catch catch
{ {
//try-fault //try-fault
ptr3 = null; mediaIds = null;
throw; throw;
} }
} }
@@ -423,8 +409,8 @@ namespace Microsoft.Zune.Util
if (num >= 0) if (num >= 0)
{ {
IMetadataManager* intPtr = ptr; IMetadataManager* intPtr = ptr;
__s_GUID gUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d = Module._GUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d6; _GUID guid_IFolderProvider = Module.GUID_IFolderProvider;
num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, (_GUID)gUID_a2889317_d0c7_41d8_abc7_1eb4cb8d46d, (void**)(&ptr2)); num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, _GUID, void**, int>)(*(ulong*)(*(long*)ptr + 24)))((nint)intPtr, guid_IFolderProvider, (void**)(&ptr2));
if (num >= 0) if (num >= 0)
{ {
fixed (char* szPathPtr = szPath.ToCharArray()) fixed (char* szPathPtr = szPath.ToCharArray())
+2 -7
View File
@@ -23,9 +23,8 @@ namespace Microsoft.Zune.Util
//IL_0086: Expected I, but got I8 //IL_0086: Expected I, but got I8
if (sm_PinManager == null) if (sm_PinManager == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_PinManager == null) if (sm_PinManager == null)
{ {
PinManager pinManager = new PinManager(); PinManager pinManager = new PinManager();
@@ -54,10 +53,6 @@ namespace Microsoft.Zune.Util
sm_PinManager = pinManager; sm_PinManager = pinManager;
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_PinManager; return sm_PinManager;
} }
@@ -19,9 +19,8 @@ namespace Microsoft.Zune.Util
{ {
if (sm_radioStationManager == null) if (sm_radioStationManager == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_radioStationManager == null) if (sm_radioStationManager == null)
{ {
RadioStationManager radioStationManager = new RadioStationManager(); RadioStationManager radioStationManager = new RadioStationManager();
@@ -29,10 +28,6 @@ namespace Microsoft.Zune.Util
sm_radioStationManager = radioStationManager; sm_radioStationManager = radioStationManager;
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_radioStationManager; return sm_radioStationManager;
} }
+66 -73
View File
@@ -18,9 +18,8 @@ namespace Microsoft.Zune.Util
{ {
if (sm_updateManager == null) if (sm_updateManager == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_updateManager == null) if (sm_updateManager == null)
{ {
UpdateManager updateManager = new(); UpdateManager updateManager = new();
@@ -28,10 +27,6 @@ namespace Microsoft.Zune.Util
sm_updateManager = updateManager; sm_updateManager = updateManager;
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_updateManager; return sm_updateManager;
} }
@@ -59,51 +54,52 @@ namespace Microsoft.Zune.Util
throw; throw;
} }
UpdateProxy* ptr4 = ptr3; UpdateProxy* ptr4 = ptr3;
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock); try
if (Module.GetSingleton(Module.GUID_UpdateProxy, (void**)(&ptr)) >= 0) {
{ if (Module.GetSingleton(Module.GUID_UpdateProxy, (void**)(&ptr)) >= 0)
m_spUpdateManager.op_Assign(ptr); {
IUpdateManager* p = m_spUpdateManager.p; m_spUpdateManager.op_Assign(ptr);
((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, IUpdateProgress*, int>)(*(ulong*)(*(long*)p + 24)))((nint)p, (IUpdateProgress*)ptr3); IUpdateManager* p = m_spUpdateManager.p;
((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, IUpdateProgress*, int>)(*(ulong*)(*(long*)p + 24)))((nint)p, (IUpdateProgress*)ptr3);
}
} }
} finally
finally {
{ if (0L != (nint)ptr4)
if (0L != (nint)ptr4) {
{ ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, uint>)(*(ulong*)(*(long*)ptr4 + 16)))((nint)ptr4);
((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, uint>)(*(ulong*)(*(long*)ptr4 + 16)))((nint)ptr4); }
if (0L != (nint)ptr)
{
IUpdateManager* intPtr = ptr;
((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, uint>)(*(ulong*)(*(long*)intPtr + 16)))((nint)intPtr);
ptr = null;
}
} }
if (0L != (nint)ptr) }
{
IUpdateManager* intPtr = ptr;
((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, uint>)(*(ulong*)(*(long*)intPtr + 16)))((nint)intPtr);
ptr = null;
}
Monitor.Exit(sm_lock);
}
} }
public unsafe void CancelUpdateCheck() public unsafe void CancelUpdateCheck()
{ {
//IL_002f: Expected I, but got I8 lock (sm_lock)
try {
{ try
Monitor.Enter(sm_lock); {
CComPtrMgd<IUpdateManager> spUpdateManager = m_spUpdateManager; CComPtrMgd<IUpdateManager> spUpdateManager = m_spUpdateManager;
IUpdateManager* p = spUpdateManager.p; IUpdateManager* p = spUpdateManager.p;
if (0L != (nint)p) if (0L != (nint)p)
{ {
IUpdateManager* p2 = spUpdateManager.p; IUpdateManager* p2 = spUpdateManager.p;
((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, int>)(*(ulong*)(*(long*)p2 + 32)))((nint)p2); ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, int>)(*(ulong*)(*(long*)p2 + 32)))((nint)p2);
}
} }
} finally
finally {
{ m_spUpdateManager.Release();
m_spUpdateManager.Release(); }
Monitor.Exit(sm_lock); }
}
} }
public unsafe void InstallUpdate(UpdateProgressHandler updateProgressHandler) public unsafe void InstallUpdate(UpdateProgressHandler updateProgressHandler)
@@ -125,48 +121,45 @@ namespace Microsoft.Zune.Util
throw; throw;
} }
UpdateProxy* ptr3 = ptr2; UpdateProxy* ptr3 = ptr2;
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock); try
IUpdateManager* p = m_spUpdateManager.p;
if (0L == (nint)p)
{ {
CComPtrNtv<IUpdateManager> cComPtrNtv_003CIUpdateManager_003E = new(); IUpdateManager* p = m_spUpdateManager.p;
try if (0L == (nint)p)
{ {
if (Module.GetSingleton(Module.GUID_UpdateProxy, (void**)(cComPtrNtv_003CIUpdateManager_003E.p)) >= 0) CComPtrNtv<IUpdateManager> cComPtrNtv_003CIUpdateManager_003E = new();
try
{ {
IUpdateManager* ptr4 = (IUpdateManager*)(*(ulong*)(cComPtrNtv_003CIUpdateManager_003E.p)); if (Module.GetSingleton(Module.GUID_UpdateProxy, (void**)(cComPtrNtv_003CIUpdateManager_003E.p)) >= 0)
m_spUpdateManager.op_Assign((IUpdateManager*)(*(ulong*)(cComPtrNtv_003CIUpdateManager_003E.p))); {
IUpdateManager* ptr4 = (IUpdateManager*)(*(ulong*)(cComPtrNtv_003CIUpdateManager_003E.p));
m_spUpdateManager.op_Assign((IUpdateManager*)(*(ulong*)(cComPtrNtv_003CIUpdateManager_003E.p)));
}
}
finally
{
cComPtrNtv_003CIUpdateManager_003E.Dispose();
} }
} }
catch CComPtrMgd<IUpdateManager> spUpdateManager = m_spUpdateManager;
IUpdateManager* p2 = spUpdateManager.p;
if (0L != (nint)p2)
{ {
//try-fault IUpdateManager* p3 = spUpdateManager.p;
cComPtrNtv_003CIUpdateManager_003E.Dispose(); ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, IUpdateProgress*, int>)(*(ulong*)(*(long*)p3 + 40)))((nint)p3, (IUpdateProgress*)ptr2);
throw;
} }
cComPtrNtv_003CIUpdateManager_003E.Dispose();
} }
CComPtrMgd<IUpdateManager> spUpdateManager = m_spUpdateManager; finally
IUpdateManager* p2 = spUpdateManager.p;
if (0L != (nint)p2)
{ {
IUpdateManager* p3 = spUpdateManager.p; m_spUpdateManager.Release();
((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, IUpdateProgress*, int>)(*(ulong*)(*(long*)p3 + 40)))((nint)p3, (IUpdateProgress*)ptr2);
} }
} }
finally
{
Module.SafeRelease_003Cclass_0020Microsoft_003A_003AZune_003A_003AUtil_003A_003AUpdateProxy_003E(&ptr3);
m_spUpdateManager.Release();
Monitor.Exit(sm_lock);
}
} }
private UpdateManager() private UpdateManager()
{ {
CComPtrMgd<IUpdateManager> spUpdateManager = new CComPtrMgd<IUpdateManager>(); CComPtrMgd<IUpdateManager> spUpdateManager = new();
try try
{ {
m_spUpdateManager = spUpdateManager; m_spUpdateManager = spUpdateManager;
@@ -194,7 +187,7 @@ namespace Microsoft.Zune.Util
} }
finally finally
{ {
((IDisposable)m_spUpdateManager).Dispose(); m_spUpdateManager.Dispose();
} }
} }
} }
@@ -23,9 +23,8 @@ namespace Microsoft.Zune.Util
{ {
if (sm_win7ShellManager == null) if (sm_win7ShellManager == null)
{ {
try lock (sm_lock)
{ {
Monitor.Enter(sm_lock);
if (sm_win7ShellManager == null) if (sm_win7ShellManager == null)
{ {
Win7ShellManager win7ShellManager = new Win7ShellManager(); Win7ShellManager win7ShellManager = new Win7ShellManager();
@@ -33,10 +32,6 @@ namespace Microsoft.Zune.Util
sm_win7ShellManager = win7ShellManager; sm_win7ShellManager = win7ShellManager;
} }
} }
finally
{
Monitor.Exit(sm_lock);
}
} }
return sm_win7ShellManager; return sm_win7ShellManager;
} }
+4 -12
View File
@@ -26,9 +26,8 @@ namespace Microsoft.Zune.Util
} }
if (s_zuneWebHost == null) if (s_zuneWebHost == null)
{ {
try lock (s_lock)
{ {
Monitor.Enter(s_lock);
if (s_zuneWebHost == null) if (s_zuneWebHost == null)
{ {
ZuneWebHost zuneWebHost = new ZuneWebHost(); ZuneWebHost zuneWebHost = new ZuneWebHost();
@@ -36,10 +35,6 @@ namespace Microsoft.Zune.Util
s_zuneWebHost = zuneWebHost; s_zuneWebHost = zuneWebHost;
} }
} }
finally
{
Monitor.Exit(s_lock);
}
} }
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 28uL)) & 0x8000u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 25uL) >= 5u) if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 28uL)) & 0x8000u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 25uL) >= 5u)
{ {
@@ -67,7 +62,7 @@ namespace Microsoft.Zune.Util
long result; long result;
try try
{ {
Module.GetSingleton((_GUID)Module._GUID_51005f8f_675e_45e1_ae94_8edef996a02e, (void**)(cComPtrNtv_003CIZuneWebHost_003E.p)); Module.GetSingleton((_GUID)Module.GUID_IZuneWebHost, (void**)(cComPtrNtv_003CIZuneWebHost_003E.GetPtrToPtr()));
fixed (char* navUrlPtr = navUrl.ToCharArray()) fixed (char* navUrlPtr = navUrl.ToCharArray())
{ {
ushort* ptr3 = (ushort*)navUrlPtr; ushort* ptr3 = (ushort*)navUrlPtr;
@@ -95,13 +90,10 @@ namespace Microsoft.Zune.Util
result = (nint)ptr; result = (nint)ptr;
} }
} }
catch finally
{ {
//try-fault
cComPtrNtv_003CIZuneWebHost_003E.Dispose(); cComPtrNtv_003CIZuneWebHost_003E.Dispose();
throw;
} }
cComPtrNtv_003CIZuneWebHost_003E.Dispose();
return result; return result;
} }
+2 -7
View File
@@ -3529,9 +3529,8 @@ namespace MicrosoftZuneLibrary
*pfFirmwareUpdateInProgress = false; *pfFirmwareUpdateInProgress = false;
*pfFirmwareRestoreInProgress = false; *pfFirmwareRestoreInProgress = false;
int num = 0; int num = 0;
try lock (m_Lock)
{ {
Monitor.Enter(m_Lock);
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 2u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u) if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 2u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
{ {
Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 24, (_GUID*)Unsafe.AsPointer(ref Module._003FA0xc0985b64_002EWPP_DeviceAPI_cpp_Traceguids)); Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 24, (_GUID*)Unsafe.AsPointer(ref Module._003FA0xc0985b64_002EWPP_DeviceAPI_cpp_Traceguids));
@@ -3577,10 +3576,6 @@ namespace MicrosoftZuneLibrary
int num7 = 0; int num7 = 0;
return num; return num;
} }
finally
{
Monitor.Exit(m_Lock);
}
} }
private unsafe int CreateDeviceAssetSet(IDeviceAssetProvider* pDeviceAssetProvider) private unsafe int CreateDeviceAssetSet(IDeviceAssetProvider* pDeviceAssetProvider)
@@ -28,19 +28,14 @@ namespace MicrosoftZuneLibrary
{ {
Module._ZuneShipAssert(1004u, 2313u); Module._ZuneShipAssert(1004u, 2313u);
} }
Monitor.Enter(m_FirmwareLock); lock (m_FirmwareLock)
try {
{
if (m_fFirmwareProcessSupported && EnsureNativeObject() >= 0) if (m_fFirmwareProcessSupported && EnsureNativeObject() >= 0)
{ {
IFirmwareRestorer* p = m_spFirmwareRestorer.p; IFirmwareRestorer* p = m_spFirmwareRestorer.p;
((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, int*, int>)(*(ulong*)(*(long*)p + 32)))((nint)p, &num); ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, int*, int>)(*(ulong*)(*(long*)p + 32)))((nint)p, &num);
} }
} }
finally
{
Monitor.Exit(m_FirmwareLock);
}
} }
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u) if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
{ {
@@ -236,15 +231,10 @@ namespace MicrosoftZuneLibrary
{ {
Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 87, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids)); Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 87, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
} }
Monitor.Enter(m_FirmwareLock); lock (m_FirmwareLock)
try {
{
m_spFirmwareRestorer.op_Assign(null); m_spFirmwareRestorer.op_Assign(null);
} }
finally
{
Monitor.Exit(m_FirmwareLock);
}
} }
private unsafe int EnsureNativeObject() private unsafe int EnsureNativeObject()
@@ -262,9 +252,8 @@ namespace MicrosoftZuneLibrary
{ {
Module._ZuneShipAssert(1004u, 2582u); Module._ZuneShipAssert(1004u, 2582u);
} }
Monitor.Enter(m_FirmwareLock); lock (m_FirmwareLock)
try {
{
if (!m_fFirmwareProcessSupported) if (!m_fFirmwareProcessSupported)
{ {
int num = -2147024846; int num = -2147024846;
@@ -289,30 +278,20 @@ namespace MicrosoftZuneLibrary
m_spFirmwareRestorer.op_Assign((IFirmwareRestorer*)(*(ulong*)(cComPtrNtv_003CIFirmwareRestorer_003E.p))); m_spFirmwareRestorer.op_Assign((IFirmwareRestorer*)(*(ulong*)(cComPtrNtv_003CIFirmwareRestorer_003E.p)));
} }
} }
catch finally
{ {
//try-fault
cComPtrNtv_003CIFirmwareRestorer_003E.Dispose(); cComPtrNtv_003CIFirmwareRestorer_003E.Dispose();
throw;
} }
cComPtrNtv_003CIFirmwareRestorer_003E.Dispose();
} }
} }
catch finally
{ {
//try-fault
cComPtrNtv_003CIFirmwareUpdater_003E.Dispose(); cComPtrNtv_003CIFirmwareUpdater_003E.Dispose();
throw;
} }
cComPtrNtv_003CIFirmwareUpdater_003E.Dispose();
return result; return result;
} }
return result; return result;
} }
finally
{
Monitor.Exit(m_FirmwareLock);
}
} }
private unsafe void ContinueFirmwareRestoreWorker(object data) private unsafe void ContinueFirmwareRestoreWorker(object data)
@@ -343,9 +322,8 @@ namespace MicrosoftZuneLibrary
{ {
Module._ZuneShipAssert(1004u, 2514u); Module._ZuneShipAssert(1004u, 2514u);
} }
Monitor.Enter(m_FirmwareLock); lock (m_FirmwareLock)
try {
{
if (num >= 0) if (num >= 0)
{ {
num = EnsureNativeObject(); num = EnsureNativeObject();
@@ -362,10 +340,6 @@ namespace MicrosoftZuneLibrary
} }
} }
} }
finally
{
Monitor.Exit(m_FirmwareLock);
}
if (num < 0) if (num < 0)
{ {
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 2u) if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 2u)
@@ -413,9 +387,8 @@ namespace MicrosoftZuneLibrary
{ {
Module._ZuneShipAssert(1004u, 2424u); Module._ZuneShipAssert(1004u, 2424u);
} }
Monitor.Enter(m_FirmwareLock); lock (m_FirmwareLock)
try {
{
if (num >= 0) if (num >= 0)
{ {
num = EnsureNativeObject(); num = EnsureNativeObject();
@@ -428,10 +401,6 @@ namespace MicrosoftZuneLibrary
} }
} }
} }
finally
{
Monitor.Exit(m_FirmwareLock);
}
startFirmwareRestoreArgs.HrStatus = num; startFirmwareRestoreArgs.HrStatus = num;
if (num < 0) if (num < 0)
{ {
@@ -462,9 +431,8 @@ namespace MicrosoftZuneLibrary
{ {
Module._ZuneShipAssert(1004u, 2687u); Module._ZuneShipAssert(1004u, 2687u);
} }
Monitor.Enter(m_FirmwareLock); lock (m_FirmwareLock)
try {
{
num = EnsureNativeObject(); num = EnsureNativeObject();
if (num >= 0) if (num >= 0)
{ {
@@ -486,10 +454,6 @@ namespace MicrosoftZuneLibrary
deferredInvokeHandler(args); deferredInvokeHandler(args);
} }
} }
finally
{
Monitor.Exit(m_FirmwareLock);
}
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u) if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
{ {
Module.WPP_SF_d(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 91, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids), num); Module.WPP_SF_d(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 91, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids), num);
@@ -511,8 +475,7 @@ namespace MicrosoftZuneLibrary
{ {
Module._ZuneShipAssert(1004u, 2758u); Module._ZuneShipAssert(1004u, 2758u);
} }
Monitor.Enter(m_FirmwareLock); lock (m_FirmwareLock)
try
{ {
CComPtrMgd<FirmwareUpdateMediator> spFirmwareMediator = m_spFirmwareMediator; CComPtrMgd<FirmwareUpdateMediator> spFirmwareMediator = m_spFirmwareMediator;
if (spFirmwareMediator.p != null) if (spFirmwareMediator.p != null)
@@ -534,10 +497,6 @@ namespace MicrosoftZuneLibrary
DeferredCancel(); DeferredCancel();
} }
} }
finally
{
Monitor.Exit(m_FirmwareLock);
}
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u) if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
{ {
Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 94, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids)); Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 94, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));

Some files were not shown because too many files have changed in this diff Show More