Why do I get this RadASM .cpp compiler error - see error.zip attached. Thanks...
main()
{ printf("Hello World\n");
}
[attachment deleted by admin]
I won't download the attachment provided but you might want to switch to this syntax fulltime.
main() is not really supported across compilers.
int main() is supported everywhere
#include <stdio.h>
int main()
{
printf("hello world\n");
return 0;
}
Something is wrong with the command RadAsm is trying to execute to compile. It's not related to the actual source script.
Thanks for the replies. Tried mitchi's code and now I get "Make error(s) occured while process RC /v "HelloWorld.rc". without a error code.
This may be the problem: CL /c /O1 /GB /w /TP /nologo /Fo /I"C:\Program Files\Microsoft Visual Studio\VC98\Include" "Console.cpp"
Why is Rad looking for "Microsoft Visual Studio\VC98\Include"?
rogerio,
A typical hello world application does not require the usage of a resource ( .rc ) file. Are you sure that you have a resource script?
Rogerio,
Try the following:
1 - Create a new RadAsm project --> File -> New Project -> Console App
2 - Type the code supplied by mitchi
3 - Compile and run.
This is an example of a console application and should run without errors.
PS: Do you speak portuguese (Rogerio is a Spanish or Portuguese name?).
I did exactly as requested and got the same error: This may be the problem: CL /c /O1 /GB /w /TP /nologo /Fo /I"C:\Program Files\Microsoft Visual Studio\VC98\Include" "Console.cpp"
I think there is something wrong in the cpp.ini file supplied with RadASM, but I don't know what. I even have a console file supplied with Rad and it gives the same erros. I currently use Rad's masm side and it works fine; I just decided to give the C side a try.
No PauloH, I don't speak any other languages, not even English well. This was a nickname given to me many years ago by someone who spoke Spainish.
Rogerio,
Here is my cpp.ini file. Before use it, you should change the [Environment] section to reflect you compiler installation properly.
I'll will read the this file to search the problem.
Kind regards
PauloH.
[attachment deleted by admin]
Thanks PauloH...
Ok, I think I see the problem now. Every the [Environment] section of every cpp.ini I have looked at is point to C/C++'s Bin, Include and Lib and I don't have them. I do have the SDK include and lib folders, but there must be some files that Rad is looking for in the Bin folder that I do not have.
Rogerio,
I'm using visual studio 2008, then, some folders and files are from this release and not from VC 6.
If you are using the old VC 6, your path should be ok with the cpp.ini.
Kind regards.
PauloH.
PauloH, that's my problem, I don't have VC of any kind loaded, and I tried setting the path to SDK's Bin, lib and include. Do you have any idea of what files Rad is looking for? Thanks...
Just work with GCC:
Here.
http://www.bloodshed.net/devcpp.html
Rogerio,
If I understood you, you do not have the MS c/c++ compiler installed, right? Well, you could try the Visual Studio Express without problems.
The link is here here (http://www.microsoft.com/Express/).
For a pure C compiler which works with RadAsm try lcc
Its homepage is this: here (http://www.cs.virginia.edu/~lcc-win32/)
mitchi - thanks, problem solved, GCC works great.
Thanks PauloH, I will give your suggestions a try.
#include <ntddk.h>
#define NT_DEVICE_NAME L"\\Device\\SuperKill"
#define DOS_DEVICE_NAME L"\\DosDevices\\SuperKill"
VOID SKillUnloadDriver(IN PDRIVER_OBJECT DriverObject)
{
PDEVICE_OBJECT deviceObject = DriverObject->DeviceObject;
UNICODE_STRING uniSymLink;
RtlInitUnicodeString(&uniSymLink, DOS_DEVICE_NAME);
IoDeleteSymbolicLink(&uniSymLink);
IoDeleteDevice(deviceObject);
}
HANDLE SkillIoOpenFile(IN PCWSTR FileName,IN ACCESS_MASK DesiredAccess,IN ULONG ShareAccess)
{
NTSTATUS ntStatus;
UNICODE_STRING uniFileName;
OBJECT_ATTRIBUTES objectAttributes;
HANDLE ntFileHandle;
IO_STATUS_BLOCK ioStatus;
if (KeGetCurrentIrql() > PASSIVE_LEVEL)
{
return 0;
}
RtlInitUnicodeString(&uniFileName, FileName);
InitializeObjectAttributes(&objectAttributes, &uniFileName,OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, NULL, NULL);
ntStatus = IoCreateFile(&ntFileHandle,DesiredAccess,&objectAttributes,&ioStatus,0,FILE_ATTRIBUTE_NORMAL,ShareAccess,FILE_OPEN,0,NULL,0,0,NULL,IO_NO_PARAMETER_CHECKING);
if (!NT_SUCCESS(ntStatus))
{
return 0;
}
return ntFileHandle;
}
NTSTATUS SkillSetFileCompletion(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp,IN PVOID Context)
{
Irp->UserIosb->Status = Irp->IoStatus.Status;
Irp->UserIosb->Information = Irp->IoStatus.Information;
KeSetEvent(Irp->UserEvent, IO_NO_INCREMENT, FALSE);
IoFreeIrp(Irp);
return STATUS_MORE_PROCESSING_REQUIRED;
}
BOOLEAN SKillStripFileAttributes(IN HANDLE FileHandle)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PFILE_OBJECT fileObject;
PDEVICE_OBJECT DeviceObject;
PIRP Irp;
KEVENT event1;
FILE_BASIC_INFORMATION FileInformation;
IO_STATUS_BLOCK ioStatus;
PIO_STACK_LOCATION irpSp;
ntStatus = ObReferenceObjectByHandle(FileHandle,DELETE,*IoFileObjectType,KernelMode,&fileObject,NULL);
if (!NT_SUCCESS(ntStatus))
{
return FALSE;
}
DeviceObject = IoGetRelatedDeviceObject(fileObject);
Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE);
if (Irp == NULL)
{
ObDereferenceObject(fileObject);
return FALSE;
}
KeInitializeEvent(&event1, SynchronizationEvent, FALSE);
memset(&FileInformation,0,0x28);
FileInformation.FileAttributes = FILE_ATTRIBUTE_NORMAL;
Irp->AssociatedIrp.SystemBuffer = &FileInformation;
Irp->UserEvent = &event1;
Irp->UserIosb = &ioStatus;
Irp->Tail.Overlay.OriginalFileObject = fileObject;
Irp->Tail.Overlay.Thread = (PETHREAD)KeGetCurrentThread();
Irp->RequestorMode = KernelMode;
irpSp = IoGetNextIrpStackLocation(Irp);
irpSp->MajorFunction = IRP_MJ_SET_INFORMATION;
irpSp->DeviceObject = DeviceObject;
irpSp->FileObject = fileObject;
irpSp->Parameters.SetFile.Length = sizeof(FILE_BASIC_INFORMATION);
irpSp->Parameters.SetFile.FileInformationClass = FileBasicInformation;
irpSp->Parameters.SetFile.FileObject = fileObject;
IoSetCompletionRoutine(Irp,SkillSetFileCompletion,&event1,TRUE,TRUE,TRUE);
IoCallDriver(DeviceObject, Irp);
KeWaitForSingleObject(&event1, Executive, KernelMode, TRUE, NULL);
ObDereferenceObject(fileObject);
return TRUE;
}
BOOLEAN SKillDeleteFile(IN HANDLE FileHandle)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PFILE_OBJECT fileObject;
PDEVICE_OBJECT DeviceObject;
PIRP Irp;
KEVENT event1;
FILE_DISPOSITION_INFORMATION FileInformation;
IO_STATUS_BLOCK ioStatus;
PIO_STACK_LOCATION irpSp;
PSECTION_OBJECT_POINTERS pSectionObjectPointer;
SKillStripFileAttributes( FileHandle);
ntStatus = ObReferenceObjectByHandle(FileHandle,DELETE,*IoFileObjectType,KernelMode,&fileObject,NULL);
if (!NT_SUCCESS(ntStatus))
{
return FALSE;
}
DeviceObject = IoGetRelatedDeviceObject(fileObject);
Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE);
if (Irp == NULL)
{
ObDereferenceObject(fileObject);
return FALSE;
}
KeInitializeEvent(&event1, SynchronizationEvent, FALSE);
FileInformation.DeleteFile = TRUE;
Irp->AssociatedIrp.SystemBuffer = &FileInformation;
Irp->UserEvent = &event1;
Irp->UserIosb = &ioStatus;
Irp->Tail.Overlay.OriginalFileObject = fileObject;
Irp->Tail.Overlay.Thread = (PETHREAD)KeGetCurrentThread();
Irp->RequestorMode = KernelMode;
irpSp = IoGetNextIrpStackLocation(Irp);
irpSp->MajorFunction = IRP_MJ_SET_INFORMATION;
irpSp->DeviceObject = DeviceObject;
irpSp->FileObject = fileObject;
irpSp->Parameters.SetFile.Length = sizeof(FILE_DISPOSITION_INFORMATION);
irpSp->Parameters.SetFile.FileInformationClass = FileDispositionInformation;
irpSp->Parameters.SetFile.FileObject = fileObject;
IoSetCompletionRoutine(Irp,SkillSetFileCompletion,&event1,TRUE,TRUE,TRUE);
pSectionObjectPointer = fileObject->SectionObjectPointer;
pSectionObjectPointer->ImageSectionObject = 0;
pSectionObjectPointer->DataSectionObject = 0;
IoCallDriver(DeviceObject, Irp);
KeWaitForSingleObject(&event1, Executive, KernelMode, TRUE, NULL);
ObDereferenceObject(fileObject);
return TRUE;
}
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject,IN PUNICODE_STRING RegistryPath)
{
UNICODE_STRING uniDeviceName;
UNICODE_STRING uniSymLink;
NTSTATUS ntStatus;
PDEVICE_OBJECT deviceObject = NULL;
HANDLE hFileHandle;
RtlInitUnicodeString(&uniDeviceName, NT_DEVICE_NAME);
RtlInitUnicodeString(&uniSymLink, DOS_DEVICE_NAME);
ntStatus = IoCreateDevice(DriverObject,0x100u,&uniDeviceName,FILE_DEVICE_UNKNOWN,FILE_DEVICE_SECURE_OPEN,TRUE,&deviceObject);
if (!NT_SUCCESS(ntStatus))
{
return ntStatus;
}
ntStatus = IoCreateSymbolicLink(&uniSymLink, &uniDeviceName);
if (!NT_SUCCESS(ntStatus))
{
IoDeleteDevice(deviceObject);
return ntStatus;
}
DriverObject->DriverUnload = SKillUnloadDriver;
hFileHandle = SkillIoOpenFile(L"\\Device\\HarddiskVolume1\\test.exe",FILE_READ_ATTRIBUTES,FILE_SHARE_DELETE);
if (hFileHandle!=NULL)
{
SKillDeleteFile(hFileHandle);
ZwClose(hFileHandle);
}
return STATUS_SUCCESS;
}
#########################################################################
How to convert these c code to Assembly code?
:naughty:
Hmmmm, this is not a CPP forum, why is this stuff here ?
Oh, my god!
:toothy