Desktop Functions: Smart Device Functions:
|
Search Results for "TEST" in [All]ntdll
static void ObjectManagerTest() using System.IO; // for test main (FileStream) only using System.Text; // for test main (Encoding) only using System.Threading; // for test main (Thread.Sleep) only using System.Diagnostics; // for test main (Trace.Write[Line]) only
#region test main
// create a test file:
string path2file = "test.fle";
string contents = "contents of test.fle";
// wait a little (1.5 sec) and modify test file attributes:
// run the test:
//path2file=test.fle
#endregion test main
public void Test() Tested on Win8.1 x64 by @gsuberland, but not thoroughly.
public void Test() shell326: api teste However, tests indicates that the upon return, the contents of both iconPath and index parameters are the same after the function returns successfully.
public partial class IconTest : Form
public IconTest() 8: IsNetDrive
/// Tests whether a drive is a network drive.
/// An integer that indicates which drive letter you want to test.
''' Tests whether a drive is a network drive.
''' An integer that indicates which drive letter you want to test.
/// Tests whether the current user is a member of the Administrator's group.
''' Tests whether the current user is a member of the Administrator's group. 10: PathCleanupSpec
fileSpec.Append("Bad*file?<test>.txt"); 11: SHBindToParent
return MyComputer; // must test for string.Empty
SHCreateDirectoryEx(IntPtr.Zero, @"D:\test\", IntPtr.Zero); 13: ShellExecuteEx Be careful with the string structure fields: UnmanagedType.LPTStr will be marshalled as unicode string so only the first character will be recognized by the function. Use UnmanagedType.LPStr instead. [Tested on Win7] 14: SHFormatDrive The hwnd field should be the handle of the required parent calling window (see http://msdn.microsoft.com/en-us/library/bb762169.aspx). passing in <parent window>.Handle (in C#) works in XP, but in Vista it does not. What works on Vista is passing in 0 (IntPtr.Zero). I have tested this on WP SP2 and it works there as well. Public Class SHGetNameFromIDList#_TEST (not 100% certain this is correct, need to test) urlmon17: CopyMemory
Public Module CopyMemoryTest 18: FindMimeFromData
//rename crystal.jpg to .gif to test functionality!
result = FindMimeFromData(0, "file://c:/test/form1.frm", vbNullString, 0, vbNullString, 0, buffAddr, 0) odbc3219: SQLBindCol
//Set the environment attribute SQL_ATTR_ODBC_VERSION to the latest version of ODBC driver ole32
void TestCancel(); 21: CoTestCancel
static extern int CreateStreamOnHGlobal(IntPtr hGlobal, bool fDeleteOnRelease,
Declare Function CreateStreamOnHGlobal Lib "ole32" (ByVal hGlobal As IntPtr, ByVal fDeleteOnRelease As Boolean, ByRef ppstm As UCOMIStream) As Long
[System.Runtime.InteropServices.DllImport("OLE32.DLL", EntryPoint = "CreateStreamOnHGlobal")] // Create a COM stream from a pointer in unmanaged memory
extern public static int CreateStreamOnHGlobal(IntPtr ptr, bool delete, out System.Runtime.InteropServices.ComTypes.IStream pOutStm);
if (CreateStreamOnHGlobal(nativePtr, true, out comStream) == S_OK) // Create IStream from allocated memory that has buffer data 24: OleSave
[System.Runtime.InteropServices.DllImport("OLE32.DLL", EntryPoint = "CreateStreamOnHGlobal")]
extern public static int CreateStreamOnHGlobal(IntPtr ptr, bool delete, out System.Runtime.InteropServices.ComTypes.IStream pOutStm);
if (CreateStreamOnHGlobal(ptrIStream, true, out IPtrStream) == 0) 25: OleSaveToStream
[System.Runtime.InteropServices.DllImport("OLE32.DLL", EntryPoint = "CreateStreamOnHGlobal")]
extern public static int CreateStreamOnHGlobal(IntPtr ptr, bool delete, out System.Runtime.InteropServices.ComTypes.IStream pOutStm);
if (CreateStreamOnHGlobal(ptrIStream, true, out IPtrStream) == 0) 26: STGC 28: StgOpenStorage
WriteStorage(storageRoot, fileName, writer);
private static void WriteStorage(StorageInfo storageInfo, string storageName, XmlWriter writer)
writer.WriteStartElement("storage");
writer.WriteAttributeString("name", storageName);
WriteStorage(subStorage, subStorage.Name, writer);
string hexData = ConvertStreamBytesToHex(stream);
writer.WriteStartElement("stream");
writer.WriteAttributeString("name", stream.Name);
writer.WriteAttributeString("data", hexData);
private static string ConvertStreamBytesToHex(StreamInfo streamInfo) kernel3229: AddConsoleAlias // Tested added during 1-pass copy & paste of windows console fuctions 30: AttachConsole,
/// I have NOT tested interprocess attaching in .NET so dont blame me if it doesnt work! </summary> 31: AttachConsole
/// I have NOT tested interprocess attaching in .NET so dont blame me if it doesnt work! </summary> 32: BackupRead
uint nNumberOfBytesToRead, out uint lpNumberOfBytesRead, bool bAbort,
Private Shared Function BackupRead(hFile As IntPtr, lpBuffer As IntPtr, nNumberOfBytesToRead As UInteger, ByRef lpNumberOfBytesRead As UInteger, bAbort As Boolean, bProcessSecurity As Boolean, _ 33: BackupWrite
uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten, bool bAbort, 34: ConsoleFunctions This has not been tested and is provided for convenience as a roll-up of the individual console functions here on pinvoke.net into one location.
// TODO: Test - what's an out uint[] during interop? This probably isn't quite right, but provides a starting point: 35: CopyFile
long TotalBytesTransferred,
long StreamBytesTransferred,
ByVal TotalBytesTransferred As Long, ByVal StreamSize As Long, ByVal StreamBytesTransferred As Long, _
Public Function GetBytesTransfered() As Int64
GetBytesTransfered = CLng(ammountTransfered) 36: CopyFileEx
long TotalBytesTransferred,
long StreamBytesTransferred,
ByVal TotalBytesTransferred As Long, ByVal StreamSize As Long, ByVal StreamBytesTransferred As Long, _
Public Function GetBytesTransfered() As Int64
GetBytesTransfered = CLng(ammountTransfered) 37: CreateFile
/// <param name="BytesToWrite"></param>
unsafe public void Write(byte[] Buffer, int BytesToWrite, Int64 AtOffset)
ums.Write(Buffer, 0, BytesToWrite);
/// <param name="BytesToRead"></param>
unsafe public int Read(byte[] Buffer, int BytesToRead, Int64 AtOffset)
byte[] ba = new byte[BytesToRead];
return ums.Read(Buffer, 0, BytesToRead);
private static extern IntPtr MapViewOfFile(IntPtr hFileMapping, FileMapAccess dwDesiredAccess, Int32 dwFileOffsetHigh, Int32 dwFileOffsetLow, Int32 dwNumberOfBytesToMap);
internal static IntPtr MapViewOfFile(IntPtr hFileMapping, FileMapAccess dwDesiredAccess, Int64 ddFileOffset, Int32 dwNumberOfBytesToMap)
return MapViewOfFile(hFileMapping, dwDesiredAccess, Hi, Lo, dwNumberOfBytesToMap);
Int32 dwNumberOfBytesToFlush);
/// <param name="BytesToWrite"></param>
unsafe public void Write(byte[] Buffer, int BytesToWrite, Int64 AtOffset)
ums.Write(Buffer, 0, BytesToWrite);
/// <param name="BytesToRead"></param>
unsafe public int Read(byte[] Buffer, int BytesToRead, Int64 AtOffset)
byte[] ba = new byte[BytesToRead];
return ums.Read(Buffer, 0, BytesToRead);
private static extern IntPtr MapViewOfFile(IntPtr hFileMapping, FileMapAccess dwDesiredAccess, Int32 dwFileOffsetHigh, Int32 dwFileOffsetLow, Int32 dwNumberOfBytesToMap);
internal static IntPtr MapViewOfFile(IntPtr hFileMapping, FileMapAccess dwDesiredAccess, Int64 ddFileOffset, Int32 dwNumberOfBytesToMap)
return MapViewOfFile(hFileMapping, dwDesiredAccess, Hi, Lo, dwNumberOfBytesToMap);
Int32 dwNumberOfBytesToFlush); 39: CreateHardLink
CreateHardLink(@"D:\someDir\test1.txt", @"D:\someDir\test.txt",IntPtr.Zero); 40: CreateNamedPipe
/// There is a test driver class at the end of this file which can be cannibalized for sample usage code.
public class NamedPipeTest
/// Test / demo code:
NamedPipeStream stream = NamedPipeStream.Create("testpipe", NamedPipeStream.ServerMode.Bidirectional);
NamedPipeStream stream = new NamedPipeStream(@"\\.\pipe\testpipe", FileAccess.ReadWrite); 41: DefineDosDevice
VolumeFunctions.DefineDosDevice(0, @"Y:", @"c:\test\folder\name\");
@"C:\test\folder\name"); 42: DeviceIoControl
Private Sub test(ByVal VerParam As GETVERSIONOUTPARAMS, ByVal hdrive As Integer)
'Issue a Command GET VERSION and test results
test(VersionParams, hdrive)
void Test()
Class Test
IntPtr hMod = LoadLibraryEx(@"D:\Test\StringResource\Debug\StringResource.exe", IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE);
class Test
new LocaleFunctions.EnumLocalesProcExDelegate(Test.EnumLocalesProcEx);
LOCALE_SSHORTESTDAYNAME1 =0x00000060, // Shortest day name for Monday
LOCALE_SSHORTESTDAYNAME2 =0x00000061, // Shortest day name for Tuesday
LOCALE_SSHORTESTDAYNAME3 =0x00000062, // Shortest day name for Wednesday
LOCALE_SSHORTESTDAYNAME4 =0x00000063, // Shortest day name for Thursday
LOCALE_SSHORTESTDAYNAME5 =0x00000064, // Shortest day name for Friday
LOCALE_SSHORTESTDAYNAME6 =0x00000065, // Shortest day name for Saturday
LOCALE_SSHORTESTDAYNAME7 =0x00000066, // Shortest day name for Sunday class Test
new LocaleFunctions.EnumLocalesProcExDelegate(Test.EnumLocalesProcEx);
LOCALE_SSHORTESTDAYNAME1 =0x00000060, // Shortest day name for Monday
LOCALE_SSHORTESTDAYNAME2 =0x00000061, // Shortest day name for Tuesday
LOCALE_SSHORTESTDAYNAME3 =0x00000062, // Shortest day name for Wednesday
LOCALE_SSHORTESTDAYNAME4 =0x00000063, // Shortest day name for Thursday
LOCALE_SSHORTESTDAYNAME5 =0x00000064, // Shortest day name for Friday
LOCALE_SSHORTESTDAYNAME6 =0x00000065, // Shortest day name for Saturday
LOCALE_SSHORTESTDAYNAME7 =0x00000066, // Shortest day name for Sunday 47: FlushViewOfFile
uint dwNumberOfBytesToFlush); 48: GetBinaryType
[ValidateScript({Test-Path $_.FullName})] 49: GetConsoleAlias // Untested, added during 1-pass copy & paste of windows console fuctions // Untested, added during 1-pass copy & paste of windows console fuctions // Untested, added during 1-pass copy & paste of windows console fuctions // Untested, added during 1-pass copy & paste of windows console fuctions // Untested, added during 1-pass copy & paste of windows console fuctions // Untested, added during 1-pass copy & paste of windows console fuctions
// has been a while since I did this, test before use
// has been a while since I did this, test before use // Untested, added during 1-pass copy & paste of windows console fuctions // Untested, added during 1-pass copy & paste of windows console fuctions
private void cmdTest_Click(object sender, EventArgs e) // Untested, added during 1-pass copy & paste of windows console fuctions // Untested, added during 1-pass copy & paste of windows console fuctions Cut off search results after 60. Please refine your search. |