Esempio n. 1
0
int dcomperm_main(int argc, char **argv)
{
#ifdef TESTING
    printf("args:\n");
    for (int i = 0; i < argc; i++) {
      printf("#%d: %s\n", i, argv[i]);
    }
    char c = getchar();
#endif

    if (argc < 2) {
        ShowUsage (TEXT("No option specified."));
        return 95;  // error.
    }

    if (_tcscmp (_tcsupr (argv [1]), TEXT("-DA")) == 0)
        HandleDAOption (argc, argv);
    else if (_tcscmp (_tcsupr (argv [1]), TEXT("-DL")) == 0)
        HandleDLOption (argc, argv);
    else if (_tcscmp (_tcsupr (argv [1]), TEXT("-AA")) == 0)
        HandleAAOption (argc, argv);
    else if (_tcscmp (_tcsupr (argv [1]), TEXT("-AL")) == 0)
        HandleALOption (argc, argv);
    else if (_tcscmp (_tcsupr (argv [1]), TEXT("-RUNAS")) == 0)
        HandleRunAsOption (argc, argv);
    else {
        ShowUsage (TEXT("Invalid option specified."));
        return 98;  // error.
    }
    return 0;  // no error.
}
Esempio n. 2
0
extern "C" void
_tmain (
    int argc,
    TCHAR **argv
    )
{
    if (argc < 2)
        ShowUsage (TEXT("No option specified."));

    if (_tcscmp (_tcsupr (argv [1]), TEXT("-DA")) == 0)
        HandleDAOption (argc, argv); else

    if (_tcscmp (_tcsupr (argv [1]), TEXT("-DL")) == 0)
        HandleDLOption (argc, argv); else

    if (_tcscmp (_tcsupr (argv [1]), TEXT("-AA")) == 0)
        HandleAAOption (argc, argv); else

    if (_tcscmp (_tcsupr (argv [1]), TEXT("-AL")) == 0)
        HandleALOption (argc, argv); else

    if (_tcscmp (_tcsupr (argv [1]), TEXT("-RUNAS")) == 0)
        HandleRunAsOption (argc, argv); else

    ShowUsage (TEXT("Invalid option specified."));
}
extern "C" void _tmain (
    int cArgs,
    TCHAR **pptszArgv
    )
{
    if (cArgs < 2) ShowUsage (_T("No option specified."));

    if (_tcsicmp (pptszArgv [1], _T("-DA")) == 0)
    {
        HandleDefaultAccessOption (cArgs, pptszArgv); 
    }
    else if (_tcsicmp (pptszArgv [1], _T("-DL")) == 0)
    {
        HandleDefaultLaunchOption (cArgs, pptszArgv); 
    }
    else if (_tcsicmp (pptszArgv [1], _T("-AA")) == 0)
    {
        HandleApplicationAccessOption (cArgs, pptszArgv);
    }
    else if (_tcsicmp (pptszArgv [1], _T("-AL")) == 0)
    {
        HandleApplicationLaunchAndActivateOption (cArgs, pptszArgv); 
    }
    else if (_tcsicmp (pptszArgv [1], _T("-MA")) == 0)
    {
        HandleMachineAccessOption (cArgs, pptszArgv);
    }
    else if (_tcsicmp (pptszArgv [1], _T("-ML")) == 0)
    {
        HandleMachineLaunchAndActivateOption (cArgs, pptszArgv); 
    }
    else if (_tcsicmp (pptszArgv [1], _T("-RUNAS")) == 0)
    {
        HandleRunAsOption (cArgs, pptszArgv); 
    }
    else
    {
        ShowUsage (_T("Invalid option specified."));
    }
    
}