Examples of WString


Examples of com.sun.jna.WString

    private ITypeLib loadShellTypeLib() {
        // Microsoft Shell Controls And Automation
        CLSID.ByReference clsid = new CLSID.ByReference();
        // get CLSID from string
        HRESULT hr = Ole32.INSTANCE.CLSIDFromString(new WString(
                                                                "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}"), clsid);
        COMUtils.checkRC(hr);
        assertEquals(0, hr.intValue());

        // get user default lcid
View Full Code Here

Examples of com.sun.jna.WString

    do {
      repeat = false;
      memory = new Memory(nLength);
      IntByReference lpnSize = new IntByReference();
      boolean succeded = Advapi32.INSTANCE.GetFileSecurity(new WString(
          fileName), infoType, memory, nLength, lpnSize);

      if (!succeded) {
        int lastError = Kernel32.INSTANCE.GetLastError();
        memory.clear();
View Full Code Here

Examples of com.sun.jna.WString

        final int infoType = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
                DACL_SECURITY_INFORMATION;

        final IntByReference lpnSize = new IntByReference();
        boolean succeeded = Advapi32.INSTANCE.GetFileSecurity(
                new WString(absoluteFilePath),
                infoType,
                null,
                0, lpnSize);

        if (!succeeded) {
            final int lastError = Kernel32.INSTANCE.GetLastError();
            if (W32Errors.ERROR_INSUFFICIENT_BUFFER != lastError) {
                throw new Win32Exception(lastError);
            }
        }

        final int nLength = lpnSize.getValue();
        final Memory securityDescriptorMemoryPointer = new Memory(nLength);
        succeeded = Advapi32.INSTANCE.GetFileSecurity(new WString(
                absoluteFilePath), infoType, securityDescriptorMemoryPointer, nLength, lpnSize);

        if (!succeeded) {
            securityDescriptorMemoryPointer.clear();
            throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
View Full Code Here

Examples of com.sun.jna.WString

    }

    public static final HWND createWindowEx(final int exStyle, final String className, final String windowName, final int style, final int x, final int y,
            final int width, final int height, final HWND parent, final HMENU menu, final HINSTANCE instance, final LPVOID param) {
        final HWND hWnd = User32.INSTANCE
                .CreateWindowEx(exStyle, new WString(className), windowName, style, x, y, width, height, parent, menu, instance, param);
        if (hWnd == null)
            throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
        return hWnd;
    }
View Full Code Here

Examples of com.sun.jna.WString

        fileop.wFunc = ShellAPI.FO_DELETE;
        String[] paths = new String[files.length];
        for (int i=0;i < paths.length;i++) {
            paths[i] = files[i].getAbsolutePath();
        }
        fileop.pFrom = new WString(fileop.encodePaths(paths));
        fileop.fFlags = ShellAPI.FOF_ALLOWUNDO|ShellAPI.FOF_NO_UI;
        int ret = shell.SHFileOperation(fileop);
        if (ret != 0) {
            throw new IOException("Move to trash failed: " + fileop.pFrom + ": " +
                                  Kernel32Util.formatMessageFromLastErrorCode(ret));
View Full Code Here

Examples of com.sun.jna.WString

  /**
   * Instantiates a new win32 window test.
   */
  public Win32WindowDemo() {
    // define new window class
    WString windowClass = new WString("MyWindowClass");
    HMODULE hInst = Kernel32.INSTANCE.GetModuleHandle("");

    WNDCLASSEX wClass = new WNDCLASSEX();
    wClass.hInstance = hInst;
    wClass.lpfnWndProc = Win32WindowDemo.this;
View Full Code Here

Examples of com.sun.jna.WString

        if (pDisp == null)
            throw new COMException("pDisp (IDispatch) parameter is null!");

        // variable declaration
        WString[] ptName = new WString[] { new WString(name) };
        DISPIDByReference pdispID = new DISPIDByReference();

        // Get DISPID for name passed...
        HRESULT hr = pDisp.GetIDsOfNames(Guid.IID_NULL, ptName, 1,
                LOCALE_USER_DEFAULT, pdispID);
View Full Code Here

Examples of com.sun.jna.WString

      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()));
    }   
   
    public void testNetUserAdd() {
      USER_INFO_1 userInfo = new USER_INFO_1();
      userInfo.usri1_name = new WString("JNANetapi32TestUser");
      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(Kernel32Util.getComputerName(), 1, userInfo, null)) {
            return;
        }
View Full Code Here

Examples of com.sun.jna.WString

          Kernel32Util.getComputerName(), userInfo.usri1_name.toString()));
    }
   
    public void testNetUserChangePassword() {
      USER_INFO_1 userInfo = new USER_INFO_1();
      userInfo.usri1_name = new WString("JNANetapi32TestUser");
      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(Kernel32Util.getComputerName(), 1, userInfo, null)) {
            return;
        }
View Full Code Here

Examples of com.sun.jna.WString

                    if (value == null)
                        return null;
                    if (value instanceof String[]) {
                        return new StringArray((String[])value, true);
                    }
                    return new WString(value.toString());
                }
                public Object fromNative(Object value, FromNativeContext context) {
                    if (value == null)
                        return null;
                    return value.toString();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.