本文整理汇总了C#中UIntPtr类的典型用法代码示例。如果您正苦于以下问题:C# UIntPtr类的具体用法?C# UIntPtr怎么用?C# UIntPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIntPtr类属于命名空间,在下文中一共展示了UIntPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: WithRefsWithReturn
public object WithRefsWithReturn(
ref string param1,
ref int param2,
ref short param3,
ref long param4,
ref uint param5,
ref ushort param6,
ref ulong param7,
ref bool param8,
ref double param9,
ref decimal param10,
ref int? param11,
ref object param12,
ref char param13,
ref DateTime param14,
ref Single param15,
ref IntPtr param16,
ref UInt16 param17,
ref UInt32 param18,
ref UInt64 param19,
ref UIntPtr param20
)
{
throw new Exception("Foo");
}
开发者ID:vlaci,项目名称:Anotar,代码行数:25,代码来源:OnException.cs
示例2: ReadProcessMemory
static extern bool ReadProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
[Out] byte[] lpBuffer,
UIntPtr nSize,
[Out] out UIntPtr lpNumberOfBytesRead
);
开发者ID:zeffy,项目名称:huehax,代码行数:7,代码来源:NativeMethods.cs
示例3: TestCtor_VoidPointer_ToPointer
public static unsafe void TestCtor_VoidPointer_ToPointer()
{
void* pv = new UIntPtr(42).ToPointer();
VerifyPointer(new UIntPtr(pv), 42);
VerifyPointer((UIntPtr)pv, 42);
}
开发者ID:kkurni,项目名称:corefx,代码行数:7,代码来源:UIntPtr.cs
示例4: PosTest1
public bool PosTest1()
{
bool retVal = true;
const string c_TEST_ID = "P001";
const string c_TEST_DESC = "PosTest1: random valid UInt64 value";
string errorDesc;
UIntPtr actualUIntPtr;
bool actualResult;
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
try
{
UInt64 ui = this.GetValidUInt64();
actualUIntPtr = new UIntPtr(ui);
actualResult = actualUIntPtr.ToUInt64() == ui;
if (!actualResult)
{
errorDesc = "Actual UIntPtr value is not " + ui + " as expected: Actual(" + actualUIntPtr + ")";
TestLibrary.TestFramework.LogError("001" + " TestId-" + c_TEST_ID, errorDesc);
retVal = false;
}
}
catch (Exception e)
{
errorDesc = "Unexpected exception: " + e;
TestLibrary.TestFramework.LogError("002" + " TestId-" + c_TEST_ID, errorDesc);
retVal = false;
}
return retVal;
}
开发者ID:CheneyWu,项目名称:coreclr,代码行数:35,代码来源:uintptrctor_uint64.cs
示例5: WorkOnInstanceAndLocal
private void WorkOnInstanceAndLocal()
{
UIntPtr localInt;
int i, j;
for ( i = 0; i < 100; i++ )
{
int index = randomNumGen.Next(0, ValueArraySize);
instanceInt_1 = ValueArray[index];
Thread.Sleep(index);
localInt = instanceInt_1;
for ( j = 0; j < ValueArraySize; j++ )
if ( ValueArray[j] == localInt )
break;
if (j == ValueArraySize )
throw new Exception("WorkOnInstanceAndLocal: Atomicity of Read/Write violated - " + localInt);
}
UIntPtr localInt_1;
localInt_1 = (UIntPtr)(1 + 1);
if((UInt32)localInt_1 != 2)
throw new Exception("Loc_7453fg! Major Error here");
localInt_1 = (UIntPtr)(UInt32.MaxValue + UInt32.MinValue);
if((UInt32)localInt_1 != UInt32.MaxValue)
throw new Exception("Loc_2375dsfg! Major Error here");
localInt_1 = (UIntPtr)(Int16.MaxValue * 2);
if((UInt32)localInt_1 != 65534)
throw new Exception("Loc_3975sg! Major Error here, " + localInt_1);
localInt_1 = (UIntPtr)UInt32.MaxValue;
if(localInt_1.GetHashCode() != 2147483647)
throw new Exception("Loc_5086dsfg! Major Error here, " + localInt_1.GetHashCode());
if(localInt_1.ToString() != "4294967295")
throw new Exception("Loc_24967esdfg! Major Error here, " + localInt_1.ToString());
}
开发者ID:ArildF,项目名称:masters,代码行数:32,代码来源:co8552uintptr.cs
示例6: PosTest1
public bool PosTest1()
{
bool retVal = true;
const string c_TEST_ID = "P001";
const string c_TEST_DESC = "PosTest1: UIntPtr.Zero vs UIntPtr(0)";
string errorDesc;
UIntPtr srcUIntPtr, expUIntPtr;
bool actualResult;
TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
try
{
expUIntPtr = new UIntPtr();
srcUIntPtr = UIntPtr.Zero;
actualResult = srcUIntPtr.Equals(expUIntPtr);
if (!actualResult)
{
errorDesc = "Source UIntPtr value does not equal" + expUIntPtr + " as expected: Actual(" + srcUIntPtr + ")";
TestLibrary.TestFramework.LogError("001" + " TestId-" + c_TEST_ID, errorDesc);
retVal = false;
}
}
catch (Exception e)
{
errorDesc = "Unexpected exception: " + e;
TestLibrary.TestFramework.LogError("002" + " TestId-" + c_TEST_ID, errorDesc);
retVal = false;
}
return retVal;
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:35,代码来源:uintptrequals.cs
示例7: runTest
public virtual bool runTest()
{
Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
int iCountErrors = 0;
int iCountTestcases = 0;
String strLoc = "Loc_000oo";
UIntPtr ip1;
UIntPtr ip2;
UInt32 iValue;
try {
strLoc = "Loc_743wg";
iValue = 16;
ip1 = new UIntPtr(iValue);
ip2 = new UIntPtr(iValue);
iCountTestcases++;
if(!ip1.Equals(ip2)){
iCountErrors++;
Console.WriteLine("Err_865sg! Wrong value returned");
}
strLoc = "Loc_9047tdsg";
iValue = 16;
ip1 = new UIntPtr(iValue);
ip2 = new UIntPtr(iValue*2);
iCountTestcases++;
if(ip1.Equals(ip2)){
iCountErrors++;
Console.WriteLine("Err_9765sgf! Wrong value returned");
}
strLoc = "Loc_98736zdg";
iValue = 16;
ip1 = new UIntPtr(iValue);
iCountTestcases++;
if(ip1.Equals(iValue)){
iCountErrors++;
Console.WriteLine("Err_9756gf! Wrong value returned");
}
strLoc = "Loc_98736zdg";
iValue = 16;
ip1 = new UIntPtr(iValue);
iCountTestcases++;
if(ip1.Equals(null)){
iCountErrors++;
Console.WriteLine("Err_973sdg! Wrong value returned");
}
} catch (Exception exc_general ) {
++iCountErrors;
Console.WriteLine(s_strTFAbbrev +" Error Err_8888yyy! strLoc=="+ strLoc +", exc_general=="+exc_general);
}
if ( iCountErrors == 0 )
{
Console.Error.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
return true;
}
else
{
Console.Error.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
return false;
}
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:59,代码来源:co8537equals_obj.cs
示例8: VirtualAlloc
public static IntPtr VirtualAlloc(
SafeHandle baseAddress,
UIntPtr size,
int allocationType,
int protection)
{
return Interop.Kernel32.VirtualAlloc(baseAddress, size, allocationType, protection);
}
开发者ID:dotnet,项目名称:corefx,代码行数:8,代码来源:Interop.Windows.cs
示例9: MapViewOfFile
public static SafeMemoryMappedViewHandle MapViewOfFile(
SafeMemoryMappedFileHandle hFileMappingObject,
int desiredAccess,
long fileOffset,
UIntPtr numberOfBytesToMap)
{
return Interop.mincore.MapViewOfFileFromApp(hFileMappingObject, desiredAccess, fileOffset, numberOfBytesToMap);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:8,代码来源:Interop.Windows.NETCore50.cs
示例10: Outer
private static void Outer()
{
float f = 42.0f;
double d = 43.0;
IntPtr ptr = new IntPtr(0x42424242);
UIntPtr uptr = new UIntPtr(0x43434343);
Middle();
}
开发者ID:southpolenator,项目名称:WinDbgCs,代码行数:8,代码来源:LocalVariables.cs
示例11: VirtualAlloc
public static IntPtr VirtualAlloc(
SafeHandle baseAddress,
UIntPtr size,
int allocationType,
int protection)
{
return Interop.mincore.VirtualAllocFromApp(baseAddress, size, allocationType, protection);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:8,代码来源:Interop.Windows.NETCore50.cs
示例12: MemAlloc
internal static IntPtr MemAlloc(UIntPtr sizeInBytes, uint flags)
{
IntPtr allocatedMemory = Interop.mincore.HeapAlloc(Interop.mincore.GetProcessHeap(), flags, sizeInBytes);
if (allocatedMemory == IntPtr.Zero)
{
throw new OutOfMemoryException();
}
return allocatedMemory;
}
开发者ID:hanin,项目名称:corert,代码行数:9,代码来源:Interop.MemAllocFree.cs
示例13: MemAlloc
internal static IntPtr MemAlloc(UIntPtr sizeInBytes)
{
IntPtr allocatedMemory = Interop.Sys.MemAlloc(sizeInBytes);
if (allocatedMemory == IntPtr.Zero)
{
throw new OutOfMemoryException();
}
return allocatedMemory;
}
开发者ID:tijoytom,项目名称:corert,代码行数:9,代码来源:Interop.MemAllocFree.cs
示例14: MemReAlloc
internal static IntPtr MemReAlloc(IntPtr ptr, UIntPtr oldSize, UIntPtr newSize, uint flags)
{
IntPtr allocatedMemory = Interop.mincore.HeapReAlloc(Interop.mincore.GetProcessHeap(), flags, ptr, newSize);
if (allocatedMemory == IntPtr.Zero)
{
throw new OutOfMemoryException();
}
return allocatedMemory;
}
开发者ID:hanin,项目名称:corert,代码行数:9,代码来源:Interop.MemReAlloc.cs
示例15: MemReAlloc
internal unsafe static IntPtr MemReAlloc(IntPtr ptr, UIntPtr newSize)
{
IntPtr allocatedMemory = Interop.Sys.MemReAlloc(ptr, newSize);
if (allocatedMemory == IntPtr.Zero)
{
throw new OutOfMemoryException();
}
return allocatedMemory;
}
开发者ID:tijoytom,项目名称:corert,代码行数:9,代码来源:Interop.MemReAlloc.cs
示例16: FirstPassFrameEntered
internal static void FirstPassFrameEntered(object exceptionObj, byte* enteredFrameIP, UIntPtr enteredFrameSP)
{
s_cachedEventMask = InternalCalls.RhpGetRequestedExceptionEvents();
if ((s_cachedEventMask & ExceptionEventKind.FirstPassFrameEntered) == 0)
return;
InternalCalls.RhpSendExceptionEventToDebugger(ExceptionEventKind.FirstPassFrameEntered, enteredFrameIP, enteredFrameSP);
}
开发者ID:justinvp,项目名称:corert,代码行数:9,代码来源:ExceptionHandling.cs
示例17: BeginFirstPass
internal static void BeginFirstPass(object exceptionObj, byte* faultingIP, UIntPtr faultingFrameSP)
{
s_cachedEventMask = InternalCalls.RhpGetRequestedExceptionEvents();
if ((s_cachedEventMask & ExceptionEventKind.Thrown) == 0)
return;
InternalCalls.RhpSendExceptionEventToDebugger(ExceptionEventKind.Thrown, faultingIP, faultingFrameSP);
}
开发者ID:justinvp,项目名称:corert,代码行数:9,代码来源:ExceptionHandling.cs
示例18: runTest
public virtual bool runTest()
{
Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
int iCountErrors = 0;
int iCountTestcases = 0;
String strLoc = "Loc_000oo";
UIntPtr ip1;
UInt32 iValue;
try {
strLoc = "Loc_743wg";
iValue = 16;
ip1 = new UIntPtr(iValue);
iCountTestcases++;
if(ip1.GetHashCode() != iValue){
iCountErrors++;
Console.WriteLine("Err_865sg! Wrong value returned");
}
strLoc = "Loc_87453sg";
iValue = 0;
ip1 = new UIntPtr(iValue);
iCountTestcases++;
if(ip1.GetHashCode() != iValue){
iCountErrors++;
Console.WriteLine("Err_9743sg! Wrong value returned");
}
strLoc = "Loc_87453sg";
iValue = UInt32.MaxValue;
ip1 = new UIntPtr(iValue);
iCountTestcases++;
if(ip1.GetHashCode() != 2147483647){
iCountErrors++;
Console.WriteLine("Err_97253rdg! Wrong value returned, {0} {1}", ip1.GetHashCode(), iValue);
}
strLoc = "Loc_87453sg";
iValue = UInt32.MinValue;
ip1 = new UIntPtr(iValue);
iCountTestcases++;
if(ip1.GetHashCode() != iValue){
iCountErrors++;
Console.WriteLine("Err_93756sg! Wrong value returned");
}
} catch (Exception exc_general ) {
++iCountErrors;
Console.WriteLine(s_strTFAbbrev +" Error Err_8888yyy! strLoc=="+ strLoc +", exc_general=="+exc_general);
}
if ( iCountErrors == 0 )
{
Console.Error.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
return true;
}
else
{
Console.Error.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
return false;
}
}
开发者ID:ArildF,项目名称:masters,代码行数:56,代码来源:co8539gethashcode.cs
示例19: MemReAllocWithZeroInitializeNoThrow
internal static unsafe IntPtr MemReAllocWithZeroInitializeNoThrow(IntPtr ptr, UIntPtr oldSize, UIntPtr newSize)
{
IntPtr allocatedMemory = Interop.Sys.MemReAlloc(ptr, newSize);
if (allocatedMemory != IntPtr.Zero && (long) newSize > (long) oldSize)
{
IntPtr pBuffer = (IntPtr) (((byte *) allocatedMemory) + (long) oldSize);
Interop.Sys.MemSet(pBuffer, 0, (UIntPtr) ((long) newSize - (long) oldSize));
}
return allocatedMemory;
}
开发者ID:tijoytom,项目名称:corert,代码行数:10,代码来源:Interop.MemAllocWithZeroInitializeNoThrow.cs
示例20: runTest
public virtual bool runTest()
{
Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
int iCountErrors = 0;
int iCountTestcases = 0;
String strLoc = "Loc_000oo";
UInt32 iValue;
UIntPtr ip1;
try {
strLoc = "Loc_743wg";
iValue = 16;
ip1 = new UIntPtr(iValue);
iCountTestcases++;
if(ip1.ToString() != iValue.ToString()){
iCountErrors++;
Console.WriteLine("Err_2975sf! Wrong value returned");
}
strLoc = "Loc_0084wf";
iValue = 0;
ip1 = new UIntPtr(iValue);
iCountTestcases++;
if(ip1.ToString() != iValue.ToString()){
iCountErrors++;
Console.WriteLine("Err_974325sdg! Wrong value returned");
}
strLoc = "Loc_93476sdg";
iValue = UInt32.MaxValue;
ip1 = new UIntPtr(iValue);
iCountTestcases++;
if(ip1.ToString() != iValue.ToString()){
iCountErrors++;
Console.WriteLine("Err_07536tsg! Wrong value returned");
}
iValue = UInt32.MinValue;
ip1 = new UIntPtr(iValue);
if(ip1.ToString() != iValue.ToString()){
iCountErrors++;
Console.WriteLine("Err_9875wrsg! Wrong value returned");
}
} catch (Exception exc_general ) {
++iCountErrors;
Console.WriteLine(s_strTFAbbrev +" Error Err_8888yyy! strLoc=="+ strLoc +", exc_general=="+exc_general);
}
if ( iCountErrors == 0 )
{
Console.Error.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
return true;
}
else
{
Console.Error.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
return false;
}
}
开发者ID:ArildF,项目名称:masters,代码行数:54,代码来源:co8542tostring.cs
注:本文中的UIntPtr类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论