title: Can I get correct DLL module list for tasklist /m when checking 32 bit program on a 64bit machine?
body: <p>Command <code>tasklist</code> on windows has really useful feature: it can list all <code>dll</code> modules for a process, or all processes. Command bellow will list all DLL files used by <code>explorer.exe</code>:</p>
  
  <pre><code>tasklist /fi "ImageName eq explorer.exe" /m
  </code></pre>
  
  <p>Looks like this (shortened, translated to english):</p>
  
  <pre><code>Process name              PID      Modules
  ========================= ======== ============================================
  explorer.exe                  1104 ntdll.dll, kernel32.dll, KERNELBASE.dll,
                                     ADVAPI32.dll, msvcrt.dll, sechost.dll,
                                     RPCRT4.dll, GDI32.dll, USER32.dll, LPK.dll,
                                     USP10.dll, SHLWAPI.dll, SHELL32.dll,
                                     ole32.dll, OLEAUT32.dll, EXPLORERFRAME.dll,
                                     DUser.dll, DUI70.dll, IMM32.dll, MSCTF.dll,
  </code></pre>
  
  <p>The problem is that this doesn't work so well for 64-bit processes:</p>
  
  <pre><code>C:\&gt;tasklist /fi "ImageName eq firefox.exe" /m
  
  Process name              PID      Modules
  ========================= ======== ============================================
  firefox.exe                   4980 ntdll.dll, wow64.dll, wow64win.dll,
                                     wow64cpu.dll
  </code></pre>
  
  <p>What you see is incomplete, it looks more like this:</p>
  
  <p><img src="https://i.stack.imgur.com/l1qGY.png" alt="image description"></p>
  
  <p>My question then is: Can I start tasklist as 32 bit program or otherwise ensure it will return correct values? I need to call tasklist from another program (Java) and get the list of loaded DLL files. I need this to ensure I do not attempt to load DLL twice.</p>