Examples of Memory


Examples of com.airhacks.enhydrator.transform.Memory

        this.sinks = sinks;
        this.deadLetterQueue = dlq;
        this.sql = sql;
        this.params = params;
        this.stopOnError = stopOnError;
        this.memory = new Memory();

    }
View Full Code Here

Examples of com.cburch.logisim.std.memory.Memory

      new Base(),
      new Gates(),
      new Wiring(),
      new Plexers(),
      new Arithmetic(),
      new Memory(),
      new Io(),
    });
  }
View Full Code Here

Examples of com.loomcom.symon.devices.Memory

    protected Memory mem;

    protected void setUp() throws Exception {
        this.cpu = new Cpu();
        this.bus = new Bus(0x0000, 0xffff);
        this.mem = new Memory(0x0000, 0xffff);
        bus.addCpu(cpu);
        bus.addDevice(mem);

        // Load the reset vector.
        bus.write(0xfffc, Bus.DEFAULT_LOAD_ADDRESS & 0x00ff);
View Full Code Here

Examples of com.sun.jna.Memory

        public NativeArgs(String progname, String[] args) {
            //
            // Allocate some native memory to pass the args down to the native layer
            //
            argsCopy = new Memory[args.length + 2];
            argvMemory = new Memory(argsCopy.length * Pointer.SIZE);
           
            //
            // Insert the program name as argv[0]
            //
            Memory arg = new Memory(progname.length() + 4);
            arg.setString(0, progname, false);
            argsCopy[0] = arg;
           
            for (int i = 0; i < args.length; i++) {
                arg = new Memory(args[i].length() + 1);
                arg.setString(0, args[i], false);
                argsCopy[i + 1] = arg;
            }
            argvMemory.write(0, argsCopy, 0, argsCopy.length);
            argvRef = new PointerByReference(argvMemory);
            argcRef = new IntByReference(args.length + 1);
View Full Code Here

Examples of com.sun.jna.Memory

    if (MyAdvapi.INSTANCE.OpenProcessToken(hp, MyAdvapi.TOKEN_READ, hToken))
    {
      IntByReference dwSize = new IntByReference();
      MyAdvapi.INSTANCE.GetTokenInformation(hToken.getValue(), MyAdvapi.TokenUser, null, 0, dwSize);
      {
        Memory pTokenUser = new Memory(dwSize.getValue());
        if (MyAdvapi.INSTANCE.GetTokenInformation(hToken.getValue(), MyAdvapi.TokenUser, pTokenUser, dwSize.getValue(), dwSize))
        {
          MyAdvapi.TOKEN_USER tokenUser = new MyAdvapi.TOKEN_USER(pTokenUser);
          Pointer lpSid = tokenUser.User.Sid;
          Memory lpName = new Memory(256);
          IntByReference cchName = new IntByReference();
          cchName.setValue(256);
          Memory lpReferencedDomainName = new Memory(256);
          IntByReference cchReferencedDomainName = new IntByReference();
          cchReferencedDomainName.setValue(256);
          IntByReference peUse = new IntByReference();
          if (MyAdvapi.INSTANCE.LookupAccountSidW(null, lpSid, lpName, cchName, lpReferencedDomainName, cchReferencedDomainName, peUse))

            result._user = lpReferencedDomainName.getString(0, true) + "\\" + lpName.getString(0, true);
          ;
          // System.out.println(result._user);
        }
      }
      if (result._user == null)
View Full Code Here

Examples of com.sun.jna.Memory

            if (readVirtualMemoryToStructure(peb.ProcessParameters, userParams))
            {
              // System.out.println("MaximumLength "+userParams.CommandLine.MaximumLength);
              if (userParams.CommandLine.MaximumLength > 0)
              {
                Memory stringBuffer = new Memory(userParams.CommandLine.MaximumLength);
                // System.out.println(""+3);
                if (readVirtualMemoryToMemory(userParams.CommandLine.Buffer, stringBuffer))
                  result = stringBuffer.getString(0, true);
              }         
             
              if (userParams.CurrentDirectoryPath.MaximumLength > 0)
              {
                Memory stringBuffer = new Memory(userParams.CurrentDirectoryPath.MaximumLength);
                if (readVirtualMemoryToMemory(userParams.CurrentDirectoryPath.Buffer, stringBuffer))
                  _workingDir = stringBuffer.getString(0, true);
              }
              if (userParams.WindowTitle.MaximumLength > 0)
              {
                Memory stringBuffer = new Memory(userParams.WindowTitle.MaximumLength);
                if (readVirtualMemoryToMemory(userParams.WindowTitle.Buffer, stringBuffer))
                  _title = stringBuffer.getString(0, true);
              }
              if (userParams.Environment != null)
              {
                // get size of environment strings
                MEMORY_BASIC_INFORMATION memInfo = new MEMORY_BASIC_INFORMATION();
                int memInfoSize = memInfo.size(); //x64 = 48, x32 = 28
                int bytesRead = MyKernel32.INSTANCE.VirtualQueryEx(hProcess.getPointer(), userParams.Environment, memInfo.getPointer(),
                    memInfoSize);
                memInfo.read();
                if (bytesRead == 0)
                {
                  _logger.warning("error getting environment in VirtualQueryEx " + Native.getLastError());
                }
                else if (MyKernel32.PAGE_NOACCESS == memInfo.Protect || MyKernel32.PAGE_EXECUTE == memInfo.Protect)
                {
                  _logger.warning("error getting environment in VirtualQueryEx no access right");
                }
                else
                {
                  long envSize = Math.min(Pointer.nativeValue(memInfo.RegionSize), 32767); //Max Size http://msdn.microsoft.com/en-us/library/ms682653%28v=vs.85%29.aspx       
                 
                  Memory mem = new Memory(envSize);
                  readProcessMemory(userParams.Environment, mem);

                  List<String> envStrings = new ArrayList<String>();
                  String env = null;
                  int l = 0;
                  while (!"".equals(env))
                  {
                    env = mem.getString(l, true);
                    if (env != null && env.length() != 0)
                    {
                      envStrings.add(env);
                      l += env.length() * 2 + 2;
                    }
View Full Code Here

Examples of com.sun.jna.Memory

            {
              // System.out.println("MaximumLength " +
              // userParams.CommandLine.MaximumLength);
              // System.out.println("Length " +
              // userParams.CommandLine.Length);
              Memory stringBuffer = new Memory(userParams.CommandLine.Length);
              // System.out.println("64 " + 3);
              if (readVirtualMemoryToMemory(userParams.CommandLine.Buffer, stringBuffer))
                result = stringBuffer.getString(0, true);
            }

          }
      }
    }
View Full Code Here

Examples of com.sun.jna.Memory

  boolean doesUserHavePrivilege(String lpPrivilegeName)

  {
    PointerByReference hToken = new PointerByReference();
    IntByReference dwSize = new IntByReference();
    Memory lpPrivileges;
    MyAdvapi.LUID PrivilegeLuid = new MyAdvapi.LUID();
    int i;
    boolean bResult = false;

    if (!MyAdvapi.INSTANCE.OpenProcessToken(MyKernel32.INSTANCE.GetCurrentProcess(), MyAdvapi.INSTANCE.TOKEN_QUERY, hToken))
      return false;

    MyAdvapi.INSTANCE.GetTokenInformation(hToken.getValue(), MyAdvapi.TokenPrivileges, null, 0, dwSize);

    lpPrivileges = new Memory(dwSize.getValue());

    if (!MyAdvapi.INSTANCE.GetTokenInformation(hToken.getValue(), MyAdvapi.TokenPrivileges, lpPrivileges, dwSize.getValue(), dwSize))
    {
      return false;
    }
View Full Code Here

Examples of com.sun.jna.Memory

  {
    if (english)
      objectName = translate(objectName);
    Bag bag = new HashBag();
    int pdhStatus = Pdhdll.ERROR_SUCCESS;
    Memory szCounterListBuffer = null;
    IntByReference dwCounterListSize = new IntByReference();
    Memory szInstanceListBuffer = null;
    IntByReference dwInstanceListSize = new IntByReference();
    String szThisInstance = null;

    // Determine the required buffer size for the data.
    pdhStatus = Pdhdll.INSTANCE.PdhEnumObjectItemsA(null, // real time
        // source
        null, // local machine
        objectName, // object to enumerate
        szCounterListBuffer, // pass NULL and 0
        dwCounterListSize, // to get length required
        szInstanceListBuffer, // buffer size
        dwInstanceListSize, //
        Pdhdll.PERF_DETAIL_WIZARD, // counter detail level
        0);

    if (pdhStatus == Pdhdll.PDH_MORE_DATA)
    {
      // Allocate the buffers and try the call again.
      szCounterListBuffer = new Memory(dwCounterListSize.getValue() * 4);
      szInstanceListBuffer = new Memory((dwInstanceListSize.getValue() * 4));

      if ((szCounterListBuffer != null) && (szInstanceListBuffer != null))
      {
        pdhStatus = Pdhdll.INSTANCE.PdhEnumObjectItemsA(null, // real
            // time
            // source
            null, // local machine
            objectName, // object to enumerate
            szCounterListBuffer, // buffer to receive counter
            // list
            dwCounterListSize, szInstanceListBuffer, // buffer to
            // receive
            // instance
            // list
            dwInstanceListSize, Pdhdll.PERF_DETAIL_WIZARD, // counter
            // detail
            // level
            0);

        if (pdhStatus == Pdhdll.ERROR_SUCCESS)
        {
          // System.out.println ("Enumerating Processes:");

          // Walk the instance list. The list can contain one
          // or more null-terminated strings. The last string
          // is followed by a second null-terminator.
          int i = 0;
          for (szThisInstance = szInstanceListBuffer.getString(0); szThisInstance != null && szThisInstance.length() > 0; i += szThisInstance
              .length() + 1, szThisInstance = szInstanceListBuffer.getString(i))
          {
            // System.out.println( szThisInstance);
            bag.add(szThisInstance);

          }
View Full Code Here

Examples of com.sun.jna.Memory

    // System.out.println(">> "+ret + " " +
    // Integer.toHexString(hkey.getValue()));

    int BufferSize = 1;
    int BYTEINCREMENT = 1024;
    Memory PerfData = new Memory(BufferSize);
    PerfData.clear();
    IntByReference PBufferSize = new IntByReference();

    PBufferSize.setValue(BufferSize);

    // System.out.println("Allocating memory...");
    for (ret = Advapi32.INSTANCE.RegQueryValueExA(hkey.getValue(), "Counter", null, null, PerfData, PBufferSize); ret == Advapi32.ERROR_MORE_DATA; ret = Advapi32.INSTANCE
        .RegQueryValueExA(hkey.getValue(), "Counter", null, null, PerfData, PBufferSize))
    {

      // Get a buffer that is big enough.

      BufferSize += BYTEINCREMENT;
      PBufferSize = new IntByReference();
      PBufferSize.setValue(BufferSize);
      PerfData = new Memory(BufferSize);
      PerfData.clear();
    }
    // System.out.println("Final buffer size is " +PBufferSize.getValue());
    if (ret != Pdhdll.ERROR_SUCCESS)
      System.out.println(Integer.toHexString(ret));
    else
    {
      String key;
      String counter;
      int i = 0;
      while (i < PBufferSize.getValue())
      {
        key = PerfData.getString(i);
        i += key.length() + 1;
        counter = PerfData.getString(i);
        i += counter.length() + 1;
        // System.out.println(counter+":"+key);
        if (counter.length() > 0 && key.length() > 0)
          try
          {
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.