public static extern uint GetSystemTimeAdjustment()

in iothub/service/src/net451/Common/Interop/UnsafeNativeMethods.cs [93:252]


        public static extern uint GetSystemTimeAdjustment(
            [Out] out int adjustment,
            [Out] out uint increment,
            [Out] out uint adjustmentDisabled
            );

        [DllImport(KERNEL32, SetLastError = true)]
        [ResourceExposure(ResourceScope.None)]
        [SecurityCritical]
        public static extern void GetSystemTimeAsFileTime([Out] out long time);

        [DllImport(WS2_32, SetLastError = true)]
        internal static unsafe extern int WSARecv
        (
            IntPtr handle, WSABuffer* buffers, int bufferCount, out int bytesTransferred,
            ref int socketFlags,
            NativeOverlapped* nativeOverlapped,
            IntPtr completionRoutine);

        [DllImport(WS2_32, SetLastError = true)]
        internal static unsafe extern bool WSAGetOverlappedResult(
            IntPtr socketHandle,
            NativeOverlapped* overlapped,
            out int bytesTransferred,
            bool wait,
            out uint flags);

        ////[DllImport(KERNEL32, SetLastError = true)]
        ////[return: MarshalAs(UnmanagedType.Bool)]
        ////[ResourceExposure(ResourceScope.None)]
        ////[SecurityCritical]
        ////static extern bool GetComputerNameEx
        ////    (
        ////    [In] ComputerNameFormat nameType,
        ////    [In, Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpBuffer,
        ////    [In, Out] ref int size
        ////    );

        ////[SecurityCritical]
        ////internal static string GetComputerName(ComputerNameFormat nameType)
        ////{
        ////    int length = 0;
        ////    if (!GetComputerNameEx(nameType, null, ref length))
        ////    {
        ////        int error = Marshal.GetLastWin32Error();

        ////        if (error != ERROR_MORE_DATA)
        ////        {
        ////            throw Fx.Exception.AsError(new System.ComponentModel.Win32Exception(error));
        ////        }
        ////    }

        ////    if (length < 0)
        ////    {
        ////        Fx.AssertAndThrow("GetComputerName returned an invalid length: " + length);
        ////    }

        ////    StringBuilder stringBuilder = new StringBuilder(length);
        ////    if (!GetComputerNameEx(nameType, stringBuilder, ref length))
        ////    {
        ////        int error = Marshal.GetLastWin32Error();
        ////        throw Fx.Exception.AsError(new System.ComponentModel.Win32Exception(error));
        ////    }

        ////    return stringBuilder.ToString();
        ////}

        [DllImport(KERNEL32)]
        [ResourceExposure(ResourceScope.None)]
        [SecurityCritical]
        internal static extern bool IsDebuggerPresent();

        [DllImport(KERNEL32)]
        [ResourceExposure(ResourceScope.Process)]
        [SecurityCritical]
        internal static extern void DebugBreak();

        [DllImport(KERNEL32, CharSet = CharSet.Unicode)]
        [ResourceExposure(ResourceScope.Process)]
        [SecurityCritical]
        internal static extern void OutputDebugString(string lpOutputString);

        //
        // Callback
        //
        [SecurityCritical]
        internal unsafe delegate void EtwEnableCallback(
            [In] ref Guid sourceId,
            [In] int isEnabled,
            [In] byte level,
            [In] long matchAnyKeywords,
            [In] long matchAllKeywords,
            [In] void* filterData,
            [In] void* callbackContext
            );

        [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventRegister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        [SecurityCritical]
        internal static extern unsafe uint EventRegister(
                    [In] ref Guid providerId,
                    [In]EtwEnableCallback enableCallback,
                    [In]void* callbackContext,
                    [In][Out]ref long registrationHandle
                    );

        [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventUnregister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        [SecurityCritical]
        internal static extern uint EventUnregister([In] long registrationHandle);

        [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventWrite", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        [SecurityCritical]
        internal static extern unsafe uint EventWrite(
                [In] long registrationHandle,
                [In] ref EventDescriptor eventDescriptor,
                [In] uint userDataCount,
                [In] EventData* userData
                );

        [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventWriteTransfer", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        [SecurityCritical]
        internal static extern unsafe uint EventWriteTransfer(
                [In] long registrationHandle,
                [In] ref EventDescriptor eventDescriptor,
                [In] ref Guid activityId,
                [In] ref Guid relatedActivityId,
                [In] uint userDataCount,
                [In] EventData* userData
                );

        [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventWriteString", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        [SecurityCritical]
        internal static extern unsafe uint EventWriteString(
                [In] long registrationHandle,
                [In] byte level,
                [In] long keywords,
                [In] char* message
                );

        [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventActivityIdControl", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        [SecurityCritical]
        internal static extern unsafe uint EventActivityIdControl([In] int ControlCode, [In][Out] ref Guid ActivityId);

        [DllImport(ADVAPI32, CharSet = System.Runtime.InteropServices.CharSet.Unicode, SetLastError = true)]
        [ResourceExposure(ResourceScope.None)]
        [SecurityCritical]
        internal static extern bool ReportEvent(SafeHandle hEventLog, ushort type, ushort category,
                                                uint eventID, byte[] userSID, ushort numStrings, uint dataLen, HandleRef strings,
                                                byte[] rawData);

        [DllImport(ADVAPI32, CharSet = System.Runtime.InteropServices.CharSet.Unicode, SetLastError = true)]
        [ResourceExposure(ResourceScope.Machine)]
        [SecurityCritical]
        internal static extern SafeEventLogWriteHandle RegisterEventSource(string uncServerName, string sourceName);

        // NOTE: a macro in win32
        internal unsafe static bool HasOverlappedIoCompleted(
            NativeOverlapped* overlapped)
        {
            return overlapped->InternalLow != (IntPtr)STATUS_PENDING;
        }