News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

FILESCAN

Started by felipe, August 07, 2018, 09:59:48 AM

Previous topic - Next topic

felipe

Now that i readed again your first reply i think you mean to just give the right path to the function (as an example, like if was another drive letter)  :idea:. But i still don't know how to get that info from the OS. I will keep thinking about it...(maybe... :icon_mrgreen:)

aw27

Felipe,

Sure, you can even use your application to find the solution because a good carpenter does not depend on the chisel or, as we say here, when we don't have a dog we can hunt with a cat (in English, make do with what we have).  :t

daydreamer

Nice work felipe :t
Do it recognize .com files too?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007

Yes, GetBinaryType does recognise COM files, too:

remote Win32     0
COM              1
16-bit DOS       1
16-bit Windows   2


include \masm32\include\masm32rt.inc
.code
start:
  print "remote Win32", 9
  push eax
  invoke GetBinaryType, chr$("\\Notebook9\Users\JJ\test.exe"), esp  ; modify according to your setup
  pop ecx
  inkey str$(ecx)
  exit
end start

hutch--

This is what MSDN says on the function.

SCS_32BIT_BINARY 0
A 32-bit Windows-based application

SCS_64BIT_BINARY 6
A 64-bit Windows-based application.

SCS_DOS_BINARY 1
An MS-DOS based application

SCS_OS216_BINARY 5
A 16-bit OS/2-based application

SCS_PIF_BINARY 3
A PIF file that executes an MS-DOS based application

SCS_POSIX_BINARY 4
A POSIX – based application

SCS_WOW_BINARY 2
A 16-bit Windows-based application

aw27

All right! I decided to give the solution right now because people is leaning towards mind blowing alternatives when all required is a small batch file. Yes, you read well, a batch file.  :biggrin:

zedd151

Quote from: AW on August 11, 2018, 04:42:12 AM
....because people is leaning towards mind blowing alternatives.....  :biggrin:

You're funny.  :biggrin:
I was looking into more complex alternatives too.

jj2007

Doesn't work here; it just displays the name of the remote PC and waits forever (and I can see that PC in Explorer).

What works is this - but I cannot access the remote machine's Windows folder:
C:\Windows\system32>dir \\RemotePC\Users\Default\*.dat
Il volume nell'unità \\RemotePC\Users è Acer
Numero di serie del volume: xxxxxxxxxx

Directory di \\RemotePC\Users\Default

09/06/2018  18:08           262,144 NTUSER.DAT

felipe

But that looks that you still execute something in the remote machine isn't it?  :idea:
Anyway, i was thinking in an assembly program... :(

:P

aw27

Quote
Doesn't work here; it just displays the name of the remote PC and waits forever (and I can see that PC in Explorer).
I see the problem. Insert this into the batch file (the reference point is the :: If disconnected) and replace the mypassword (the administrator password on the remote computer).

:: If disconnected:
NET USE \\%RemotePC% /delete
NET USE \\%RemotePC%\IPC$ /USER:administrator mypassword

Quote
Anyway, i was thinking in an assembly program...
You can modify your program accordingly in order to simply check the bitness of explorer.exe. This will correspond to the bitness of the OS

mineiro

Quote from: AW on August 10, 2018, 12:37:29 AM
A related exercise, would be to check whether the MyRemoteSystem is 32-bit or 64-bit OS. Anyone?
Hello sir José, I hope you're fine.
I was thinking about searching for string "(x86)" inside root folder.
The environment variable path to "Arquivos de programas" that changes from language to language, well, "Program Files". Can be done using .bat files; not sure if windows 7 to up have "find"(grep) program, so with a simple dir list can be done.
This is a no brain solution, well, simple solution.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

zedd151

Quote from: mineiro on August 11, 2018, 11:23:21 AM
... Can be done using .bat files; not sure if windows 7 to up have "find"(grep) program, so with a simple dir list can be done.

Hey, you guys are cheating, this is an assembly forum, not a bat forum.   :icon_mrgreen:


® TM DC Comics  to make this post legal.    8)

mineiro

hehehe :), nice.

;-----edited
We can use GetEnvironmentVariable function and some 'cmp' instructions. I think that "shell execute" can do this job.
Why make things simple if we can make it harder  :icon_cool:
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

aw27

@mineiro,Esq.

Quote
We can use GetEnvironmentVariable function
But we are not executing on the Remote computer.
So, GetEnvironmentVariable would spell the variables of the Local computer not the Remote one.

Quote
I was thinking about searching for string "(x86)" inside root folder
There is no Administrative Share that provides you the Root folder.
There is also no rule that folders with (x86) in the name can only be that standard Windows folder you are thinking about.

@zedd,
Quote
this is an assembly forum, not a bat forum
It is true, but the idea was just to show how easy it is.
Conversion to ASM is trivial unless you don't know the equivalent for the NET USE commands on the Windows API. Do you?  :exclaim:


zedd151

Quote from: AW on August 11, 2018, 05:02:33 PM
@zedd,
It is true, but the idea was just to show how easy it is.
Of course.   :t You still sent everyone on a 'wild goose' chase with that one.

Quote
Conversion to ASM is trivial unless you don't know the equivalent for the NET USE commands on the Windows API. Do you?  :exclaim:
No.