Comments (22)
With winioctl.h now compile, but when try to use my DLL including ImScsiCreateDevice with DLL_EXPORT I get "1 = unable to use the DLL file".
If I remove AMI routine in my dll it turn to work.
Do it not possibile to use in dll?
If you just include aimapi.h and other header dependencies and use #pragma comment
or similar to link to aimapi.lib, this should work and your DLL should be able to import functions through a depency on aimapi.dll.
from arsenal-image-mounter.
It work now ty 👍
from arsenal-image-mounter.
You could take a look at the source code for aim_ll.exe:
from arsenal-image-mounter.
I tryed to mount a vhd but not able:
#include <windows.h>
#include <iostream>
#include "common.h"
#include "aimapi.h"
#pragma comment(lib,"aimapi.lib")
int main()
{
//LPWSTR letter = new TCHAR[3];
//wmemcpy(letter, L"F:", 3);
DEVICE_NUMBER device_number;
device_number.LongNumber = IMSCSI_AUTO_DEVICE_NUMBER;
DWORD sector_size = 4096;
DWORD flags = IMSCSI_DEVICE_TYPE_HD| IMSCSI_TYPE_VM;// IMSCSI_TYPE_FILE | IMSCSI_TYPE_PROXY | IMSCSI_PROXY_TYPE_SHM
BOOL aim = ImScsiCreateDeviceEx(
NULL,
INVALID_HANDLE_VALUE,
&device_number,
NULL,
§or_size,
NULL,
&flags,
L"\\??\\vhdaccess\\??\\awealloc\\??\\E:\\Temp\\temp.vhd",
//L"\\??\\E:\\Temp\\temp.vhd",
NULL,
FALSE,//TRUE
NULL,//letter
FALSE
);
wprintf(L"end aim: %d err: %d, id: %06x, sect: %d", aim GetLastError(), device_number.LongNumber, sector_size);
//std::cout << "Hello World!\n";
return 0;
}
from arsenal-image-mounter.
I tryed to mount a vhdx but not able:
#include <windows.h> #include "aimapi.h" #pragma comment(lib,"aimapi.lib") #include <iostream> int main() { BOOL ami=ImScsiCreateDevice(NULL, INVALID_HANDLE_VALUE, NULL, 0, 0, 0, 0, L"\\\\?\\vhdaccess\\??\\awealloc\\??\\c:\\temp.vhd", TRUE, (LPWSTR)L"Q:", FALSE); std::cout << "Hello World!\n"; }
You have the Adapter
and DeviceNumber
parameters in the wrong order. Also, the NativePath
parameter should be FALSE
in this case.
from arsenal-image-mounter.
Changed NativePath.
I see Adapter and DeviceNumber parameters ordered as 2 and 3; why wrong?
I set (LPWSTR)L"Q:", but the lettere is in vhdx, as set it?
from arsenal-image-mounter.
Changed NativePath.
I see Adapter and DeviceNumber parameters ordered as 2 and 3; why wrong?
No sorry, my mistake. You are right!
I set (LPWSTR)L"Q:", but the lettere is in vhdx, as set it?
I do not understand what you mean here. The parameter for mount point looks correct if you want Q: as drive letter.
Also note that what you are trying to do only works for vhd just like in your example code, note vhdx.
from arsenal-image-mounter.
my mistake I use vhd not vhdx. You are right!
I mean that I set letter in vhd from OS disk management and aim not need it.
What about error list that not compile it?
from arsenal-image-mounter.
Yes you need to include common.h as well. There are some type definitions in there.
from arsenal-image-mounter.
Adding common.h I'm able to compile it.
But when I execute, it return without nothing do or write to console.
from arsenal-image-mounter.
Adding common.h I'm to compile it.
But when I execute, it return without nothing do or write to console.
You need to check return value of API function and call GetLastError
to find out what is going wrong.
from arsenal-image-mounter.
The problem is that API function not return value and not execute next instruction.
It is as have a silent crash.
from arsenal-image-mounter.
The problem is that API function not return value and not execute next instruction.
It is as have a silent crash.
Run a debug build inside Visual Studio and select to stop at exceptions etc and see what happens.
from arsenal-image-mounter.
You are right! I have to use debug:
Unhandled exception at 0x00007FF9610C3310 (aimapi.dll) in ConsoleApplication1.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'.
The thread 0x15a8 has exited with code 0 (0x0).
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'.
Exception thrown at 0x00007FF95FFA3310 (aimapi.dll) in ConsoleApplication1.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
Unhandled exception at 0x00007FF95FFA3310 (aimapi.dll) in ConsoleApplication1.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
The program '[10180] ConsoleApplication1.exe' has exited with code 0 (0x0).
I updated the source.
from arsenal-image-mounter.
I updated the source.
Now it not have error and work fine with regular mount vhd file.
But I need a again a few step, why L"\\?\vhdaccess\??\awealloc\??\E:\Temp\temp.vhd" not work.
I get device but not mount volume:
Device number 000100
Device is \\?\PhysicalDrive4
Image file: \??\vhdaccess\??\awealloc\??\E:\Temp\temp.vhd
Size: 2147483648 bytes (2 GB), Queued unbuffered I/O Image File, HDD, Modified.
same vhd file work fine with command line:
aim_ll.exe -a -f \\?\vhdaccess\??\awealloc\??\E:\Temp\temp.vhd
Device number 000100
Device is \\?\PhysicalDrive4
Image file: \??\vhdaccess\??\awealloc\??\E:\Temp\temp.vhd
Size: 2147483648 bytes (2 GB), Queued unbuffered I/O Image File, HDD, Modified.
Contains volume \\?\Volume{2c975252-ec13-11ed-bb88-5e6c3a1f8af4}\
Mounted at F:\
from arsenal-image-mounter.
Now it mount if I use | IMSCSI_TYPE_VM and ??\vhdaccess
but it have set "online" from os disk manager.
Which piece I still miss?
p.s.
I solved this too.
The problem is I use a vhd already mounted.
But also here, via aim_ll.exe it worked in the same way.
from arsenal-image-mounter.
Now it mount if I use | IMSCSI_TYPE_VM and ??\vhdaccess
but it have set "online" from os disk manager.
Which piece I still miss?p.s.
I solved this too.
The problem is I use a vhd already mounted.
But also here, via aim_ll.exe it worked in the same way.
IMSCSI_TYPE_VM is not correct here. It would just allocate a large amount of virtual memory for the entire disk size at once, which is not what you want here.
from arsenal-image-mounter.
You are right! code work also without IMSCSI_TYPE_VM.
I have other strange problem.
This code compile and work fine in console application.
But if I use same code in dll library I get:
Severity Code Description Project File Line Suppression State
Error (active) E0020 identifier "PSTORAGE_DEVICE_NUMBER" is undefined Test c:\aimapi.h 494
Error C2061 syntax error: identifier 'PSTORAGE_DEVICE_NUMBER' Test 494
how is it possible?
from arsenal-image-mounter.
Here is documentation about that structure and what header files you need to include:
https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-storage_device_number
from arsenal-image-mounter.
With winioctl.h now compile, but when try to use my DLL including ImScsiCreateDevice with extern "C" _declspec(dllexport) I get "1 = unable to use the DLL file".
If I remove AMI routine in my dll it turn to work.
Do it not possibile to use in dll?
from arsenal-image-mounter.
Do it is normal that if I include aimapi.lib again I need aimapi.dll ?
from arsenal-image-mounter.
Do it is normal that if I include aimapi.lib again I need aimapi.dll ?
Yes.
from arsenal-image-mounter.
Related Issues (20)
- Request: CSO/ZSO Support HOT 1
- I encountered a problem HOT 12
- Using AIM in WinPE HOT 3
- Dynamic Ramdisk with aim_ll HOT 6
- VHDX Dynamic Memory Management HOT 2
- vhd work in awe and not as file HOT 8
- No volumes attached if move vhd from other pc HOT 16
- Contextual menu absent HOT 1
- BitLocker password prompting HOT 5
- Force ImScsiRemoveDeviceByMountPoint HOT 1
- Cannot access Arsenal Image Mounter driver HOT 6
- RAMDisk - only half of the allocated memory can be used HOT 1
- aim_ll & the format prompt HOT 2
- Some dependencies seem to be missing for the driver installers. HOT 2
- Is it possible to log the mounter driver operation? (aim_ll -a -P not leading to automount) HOT 1
- VMDK Mount and write makes computer totally unusable at all sometimes HOT 10
- Unable to mount multiple VMDK disks sequentially with aim_cli.exe on Windows Server2022 HOT 4
- Write cache Major problem on Arsenal HOT 13
- Support "Disk device, write temporary" mode for iso disc images HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arsenal-image-mounter.