spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

How to tell if Windows partition is active by a path on it?


Check this Link (http://msdn.microsoft.com/en-us/library/windows/desktop/aa365451(v=vs.85).aspx)

PARTITION_INFORMATION has BootIndicator. but it is not guarantee about the running windows was booted by that partition.

Edited It is a example function tested on Windows7. I think 'activate' partition is not your goal. The 'activate' has meaning such as bootable USB device. I don't like WMI but it could be help your goal (http://msdn.microsoft.com/en-us/library/windows/desktop/bb986746(v=vs.85).aspx)

BOOL
__stdcall
TP_IsPartitionActivated(
__in    LPCWSTR pPartition,
__out   PBOOL   pbIsActivated
)
{
    HANDLE  hDevice = INVALID_HANDLE_VALUE;
    PARTITION_INFORMATION_EX  
szPartitionInformation;
    DWORD cbReturned = 0x00;

    if (pPartition == NULL || pbIsActivated ==
NULL) { return FALSE; }

    __try
    {
        hDevice = CreateFileW(pPartition, 0x00,
0x00, NULL, OPEN_EXISTING, 0x00, NULL);
        if (hDevice == INVALID_HANDLE_VALUE) {
return FALSE; }

        RtlZeroMemory(&szPartitionInformation,
sizeof(szPartitionInformation));
        if (FALSE != DeviceIoControl(hDevice,
IOCTL_DISK_GET_PARTITION_INFO_EX, NULL, 0x00,
(LPVOID)&szPartitionInformation,
sizeof(PARTITION_INFORMATION_EX), &cbReturned,
NULL))
        {
            if (PARTITION_STYLE_MBR ==
szPartitionInformation.PartitionStyle)
            {
                *pbIsActivated =
szPartitionInformation.Mbr.BootIndicator;
            }
            else
            {
            }

            return TRUE;
        }
        else
        {
            cbReturned = GetLastError();
            wprintf(L"%08X(%d)
", cbReturned, cbReturned);
        }
    }
    __finally
    {
        if (hDevice != INVALID_HANDLE_VALUE) {
CloseHandle(hDevice); }
    }

    return FALSE;
}

Call like

WCHAR   szPartition[] = L"\\.\C:";
BOOL    bIsActivated = FALSE;

if (FALSE != TP_IsPartitionActivated(szPartition,
&bIsActivated))
{
    wprintf(L"%s 
", bIsActivated == FALSE ? L"not activated" :
L"activated");
}
else
{
    wprintf(L"function fail
");
}

Categories : C++

Related to : How to tell if Windows partition is active by a path on it?
Set groups polices on windows - active directory from PHP
If adLDAP and PHP's native LDAP functions don't support this, you can write a PowerShell script and execute it from PHP using the exec() function. See PowerShell Group Policy reference to get started. Searching the net will give you some ready to use examples of how to assign policies to a group using PowerShell. Good luck!

Categories : PHP
How to access windows Active Directory anonymously?
AFAIK nowadays it's pretty uncommon to allow an anonymous login to an ldap server Ask the admin of the Active Directory server, if 1) is (partially) allowed You don't need to have the passwords of every user to access anybodies phone number; try to impersonate your JBoss app with a single account specifically setup for you web app, having just enough rights to read what you need Before doing any

Categories : Java
Verify if Active Directory windows authorization is correctly set up in MVC5 app?
The default behavior of an app running Windows Auth is to log you in automatically. However, if you attempt to access some part of the site that your user is not authorized to, it can fall back to an actual login form to give you the opportunity to "upgrade" your permissions by logging into another account than the one you're running with on the system. Long and short, if you're getting thrown to

Categories : C#
row number over partition
Use Dense_Rank() Ranking Function SELECT Dense_rank()OVER (partition BY name ORDER BY cdt) Rn, rvdt, cdt, name, template FROM #temp OUTPUT : Rn rvdt cdt name template -- ----------------------- ----------------------- ---- ---------- 1 2014-11-11 22:56:27.000 2014-10-11 23:56:27.000 Joe Tempalte 1 1 2014-11-1

Categories : Sql Server
Count both sides of a partition in ReQL
Create an index on isQualified r.table('Candidate').indexCreate("isQualified"); Then use it to count r.expr({ 'qualified': r.table('Candidate').getAll(true, {index: "isQualified"}).count() 'unqualified': r.table('Candidate').getAll(false, {index: "isQualified"}).count(), }) This is way faster as the server doesn't have to iterate through all the documents, but just has to traverse a B-tr

Categories : Database
Recently Add
C++: error C2143: syntax error : missing ';' before '<'
Converting 2s compliment to a decimal. Output is double
how do you compare a string to a vector value?
Converting a long double to double with upward (or downward) rounding
C++: operator<< overloading in the nested classes
Unclear behavior with csv processing using getline
C++ Visual Studio Error: IntelliSense: expected a statement
Game of Nim - showing the remaining numbers and letting a player pick their name?
malloc 1D array in struct
How to create an array of smart pointers?
c++ swapping unique_ptr's
Functions as arguments
Any Fast & Efficient way to generate a 3D Grid?
Is string[] not a type?
C++ typeid(x).name() returns ph
Counting / Printing Path - From (1,1) to (m, n)
C++ input function that calls itself
Error: array must be initialized with a brace-enclosed initializer
SDL_ConvertSurface() causes break
C++ std deviation function?
libcURL Progress Function not being called
What is QList's maximum size?
Run batch with C++
Read a file and write its contents to another C++
extract from stringstream into 2D vector
How to stop Scons adding lib infront of a shared library
Blocking vs non-blocking mode in TCP sockets using C++
SDL2 toggle SDL_WINDOW_RESIZABLE state for fake fullscreen
How can I assign value to specific vector's index?
Operator Overloading with Constant Iterators
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.