Exemplo n.º 1
0
BOOL CUPSD2(const char * domainuser, 
		  const char *password, 
		  PSECURITY_DESCRIPTOR psdSD,
		  PBOOL isAuthenticated,
		  PDWORD pdwAccessGranted)	// returns bitmask with accessrights
{
	char domain[MAXLEN];
	const char *user = 0;
	domain[0] = '\0';
	TCHAR user2[MAXLEN];
	TCHAR domain2[MAXLEN];
	TCHAR password2[MAXLEN];
	TCHAR *prefix = NULL;

	user = SplitString(domainuser,'\\',domain);

#if defined (_UNICODE) || defined (UNICODE)
	mbstowcs(user2, user, MAXLEN);
	mbstowcs(domain2, domain, MAXLEN);
	mbstowcs(password2, password, MAXLEN);
#else
	strcpy(user2, user);
	strcpy(domain2, domain);
	strcpy(password2, password);
#endif

	// On NT4, prepend computer- or domainname if username is unqualified.
	if (isNT4() && _tcscmp(domain2, _T("")) == 0) {
		if (!QualifyName(user2, domain2)) {
			_tcscpy(domain2, _T("\0"));
		}
	}
	return SSPLogonUser(domain2, user2, password2, psdSD, isAuthenticated, pdwAccessGranted);
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
    BOOL rc=FALSE;
    TCHAR szInstallDir[MAX_PATH];
    HMODULE hExe = GetModuleHandle(NULL);

  /** @todo r=bird:
   * And by the way, we're only missing the coding style dmik uses now
   * and this file would contain the complete set.  */
  if(2!=argc || (stricmp(argv[1], "/i") && stricmp(argv[1], "/u")))
    displayHelpAndExit(argv[0]);

  /* This program is only for installing drivers on NT4 */
  if(!isNT4()){
    printf("This program only runs on NT4\n");
    return -1;
  }

  if (!GetModuleFileName(hExe, &szInstallDir[0], sizeof(szInstallDir)))
    {
      printf("GetModuleFileName failed! rc = %d\n", GetLastError());
      return -1;
    }

  TCHAR *lastBackslash = wcsrchr(szInstallDir, L'\\');

  if (!lastBackslash)
    {
      printf("Invalid path name!\n");
      return -1;
    }

  *lastBackslash=L'\0';

  /* Install video driver. Mouse driver installation is done by overwriting
     the image path in the setup script. */
  if(!stricmp(argv[1], "/i")){
    rc=installVideoDriver(szInstallDir);
  }
  else{
    /* No video driver uninstallation yet. Do we need it? */
  }

  if(FALSE==rc)
    printf("Some failure occurred during driver installation.\n");
  return !rc; /* Return != 0 on failure. */
}
Exemplo n.º 3
0
int main (int argc, char **argv)
{
    int rc = 0;

    /* This program is only for installing drivers on NT4 */
    if (!isNT4())
    {
        printf("This program only runs on NT4\n");
        return -1;
    }

    /* Delete the "InvalidDisplay" key which causes the display
     applet to be started on every boot. For some reason this key
     isn't removed after setting the proper resolution and even not when
     doing a driverreinstall.  */
    RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\GraphicsDrivers\\InvalidDisplay"));
    RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\GraphicsDrivers\\NewDisplay"));

    return rc;
}