Package com.sun.jna.platform.win32.WinDef

Examples of com.sun.jna.platform.win32.WinDef.HDC


     * Return the domain controller for a current computer.
     * @return
     *  Domain controller information.
     */
    public static DomainController getDC() {
        PDOMAIN_CONTROLLER_INFO pdci = new PDOMAIN_CONTROLLER_INFO();
        int rc = Netapi32.INSTANCE.DsGetDcName(null, null, null, null, 0, pdci);
      if (W32Errors.ERROR_SUCCESS != rc) {
            throw new Win32Exception(rc);
      }
      DomainController dc = new DomainController();
View Full Code Here


  public static void main(String[] args) {
    junit.textui.TestRunner.run(Ole32Test.class);
  }

  public void testCoCreateGUID() {
    GUID pguid = new GUID();
    assertEquals(W32Errors.S_OK, Ole32.INSTANCE.CoCreateGuid(pguid));
    assertTrue(pguid.Data1 != 0 || pguid.Data2 != 0 || pguid.Data3 != 0
        && pguid.Data4 != null);
  }
View Full Code Here

  }

  public void testCoCreateInstance() {
    HRESULT hrCI = Ole32.INSTANCE.CoInitializeEx(null, 0);

    GUID guid = Ole32Util
        .getGUIDFromString("{00021401-0000-0000-C000-000000000046}"); // Shell object
    GUID riid = Ole32Util
        .getGUIDFromString("{000214EE-0000-0000-C000-000000000046}"); // IShellLinkA

    PointerByReference pDispatch = new PointerByReference();

    HRESULT hr = Ole32.INSTANCE.CoCreateInstance(guid, null, // pOuter =
View Full Code Here

   *  String representation of a GUID, including { }.
   * @return
   *  A GUID.
   */
  public static GUID getGUIDFromString(String guidString) {
    GUID lpiid = new GUID();
      HRESULT hr = Ole32.INSTANCE.IIDFromString(guidString, lpiid);
      if (! hr.equals(W32Errors.S_OK)) {
        throw new RuntimeException(hr.toString());
      }
      return lpiid;
View Full Code Here

   *  GUID.
   * @return
   *  String representation of a GUID.
   */
  public static String getStringFromGUID(GUID guid) {
    GUID pguid = new GUID(guid.getPointer());
      int max = 39;
      char[] lpsz = new char[max];
      int len = Ole32.INSTANCE.StringFromGUID2(pguid, lpsz, max);
      if (len == 0) {
        throw new RuntimeException("StringFromGUID2");
View Full Code Here

   * Generate a new GUID.
   * @return
   *  New GUID.
   */
  public static GUID generateGUID() {
    GUID pguid = new GUID();
      HRESULT hr = Ole32.INSTANCE.CoCreateGuid(pguid);
      if (! hr.equals(W32Errors.S_OK)) {
        throw new RuntimeException(hr.toString());
      }
      return pguid;
View Full Code Here

                serverName, userName,
                    0, bufptr, LMCons.MAX_PREFERRED_LENGTH, entriesread, totalentries);
            if (rc != LMErr.NERR_Success) {
                throw new Win32Exception(rc);
            }
            GROUP_USERS_INFO_0 lgroup = new GROUP_USERS_INFO_0(bufptr.getValue());     
            GROUP_USERS_INFO_0[] lgroups = (GROUP_USERS_INFO_0[]) lgroup.toArray(entriesread.getValue());
            ArrayList<Group> result = new ArrayList<Group>();
            for (GROUP_USERS_INFO_0 lgpi : lgroups) {
                Group lgp = new Group();
                if (lgpi.grui0_name != null) {
                  lgp.name = lgpi.grui0_name.toString();
View Full Code Here

                serverName, userName,
                    0, 0, bufptr, LMCons.MAX_PREFERRED_LENGTH, entriesread, totalentries);
            if (rc != LMErr.NERR_Success) {
                throw new Win32Exception(rc);
            }
            LOCALGROUP_USERS_INFO_0 lgroup = new LOCALGROUP_USERS_INFO_0(bufptr.getValue());     
            LOCALGROUP_USERS_INFO_0[] lgroups = (LOCALGROUP_USERS_INFO_0[]) lgroup.toArray(entriesread.getValue());
            ArrayList<Group> result = new ArrayList<Group>();
            for (LOCALGROUP_USERS_INFO_0 lgpi : lgroups) {
                LocalGroup lgp = new LocalGroup();
                if (lgpi.lgrui0_name != null) {
                  lgp.name = lgpi.lgrui0_name.toString();
View Full Code Here

      }
        assertTrue(Kernel32.INSTANCE.CloseHandle(phToken.getValue()));
    }
   
    public void testImpersonateLoggedOnUser() {
      USER_INFO_1 userInfo = new USER_INFO_1();
      userInfo.usri1_name = new WString("JNAAdvapi32TestImp");
      userInfo.usri1_password = new WString("!JNAP$$Wrd0");
      userInfo.usri1_priv = LMAccess.USER_PRIV_USER;
        // ignore test if not able to add user (need to be administrator to do this).
      if (LMErr.NERR_Success != Netapi32.INSTANCE.NetUserAdd(null, 1, userInfo, null)) {
View Full Code Here

        PointerByReference bufptr = new PointerByReference();
        int rc = -1;
        try {
            rc = Netapi32.INSTANCE.NetUserGetInfo(domainName, accountName, (short)23, bufptr);
            if (rc == LMErr.NERR_Success) {
                USER_INFO_23 info_23 = new USER_INFO_23(bufptr.getValue());
                UserInfo userInfo = new UserInfo();
                if (info_23.usri23_comment != null) {
                  userInfo.comment = info_23.usri23_comment.toString();
                }
                userInfo.flags = info_23.usri23_flags;
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.win32.WinDef.HDC

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.