Click here to Skip to main content
15,909,546 members
Home / Discussions / Work Issues
   

Work Issues

 
QuestionPlease Guide Me Pin
Ashish Porwal15-Jan-07 5:07
Ashish Porwal15-Jan-07 5:07 
AnswerRe: Please Guide Me Pin
Tim Craig19-Jan-07 18:40
Tim Craig19-Jan-07 18:40 
QuestionTraining for ASP.NET 2.0 Pin
ikorenbl11-Jan-07 6:15
ikorenbl11-Jan-07 6:15 
AnswerRe: Training for ASP.NET 2.0 Pin
Rahithi24-Jan-07 5:10
Rahithi24-Jan-07 5:10 
QuestionDirectory Path Stored in mySQL Pin
Crash_beta9-Jan-07 18:24
Crash_beta9-Jan-07 18:24 
Questionplease help me! Pin
ali_reza_zareian7-Jan-07 11:05
ali_reza_zareian7-Jan-07 11:05 
AnswerRe: please help me! Pin
Ed.Poore7-Jan-07 11:31
Ed.Poore7-Jan-07 11:31 
QuestionFiles and I really need it............ Pin
KOKEMO1-Jan-07 1:52
KOKEMO1-Jan-07 1:52 
Hello Guys .
I Have written a program in FASM which opens a file and converts all the capital letters into low and vice versa. and i ahve pasted them in here.so people working with fasm can see but i want this program in MASM whcik i have not worked with that. Anyone here can send me the Equivalent of this program to my Email please Smile | :) A pogram which opens a file and converts the capital letters into high and the vice versa(in MASM). Thanx alot and here is the codes :::OMG | :OMG: Rose | [Rose]

Email ::: fight_2_death@hotmai.com


;// EXE Format
;// PE_SIG: OBTTFS-36454
format PE GUI 4.0
include 'C:\FASM\Include\Win32ax.inc'

;// Data section
section '.data' data readable writable

;// Initializations for OPENFILENAME Structure
ofn_szOutFile db 256 dup(?)
ofn_szFilter db 'All Files (*.*)',0,'*.*',0,0

s_OFN OPENFILENAME 0,0,0,ofn_szFilter,0,0,0,ofn_szOutFile,0100h,0,0,0,0,OFN_FILEMUSTEXIST + OFN_PATHMUSTEXIST, \
0,0,0,0,0,0

;// s_ErrorMessage used by GET_LAST_ERROR_PROC
s_ErrorMessage db 256 dup(?)

;// Allocate a dwWritten
dwWritten dd 0


;// Code section
section '.code' code readable executable

;// MAIN CODE
proc main

;// File Handle Holder
local hFileHandle:DWORD

;// Initialize OFN Struct
mov [s_OFN.lStructSize],sizeof.OPENFILENAME
invoke GetOpenFileName,s_OFN
cmp eax,0 ;// Zero is returned when user closes the dialog of presses cancel
je .ExitProcess_JUMP

;// We have the file, open it and convert
invoke CreateFile,ofn_szOutFile,GENERIC_READ + GENERIC_WRITE, FILE_SHARE_READ, \
0,OPEN_EXISTING,0,0

cmp eax, INVALID_HANDLE_VALUE
jne @F ;// Jump to the next @@ label

;// We have a wrong handle, Tell the user, then exit
call GET_LAST_ERROR_PROC
invoke ExitProcess,0

;//------------------------------- Handle valid, continue
@@:
mov [hFileHandle],eax

;// Get File Size
local iFileSize:DWORD
invoke GetFileSize,[hFileHandle],0
mov [iFileSize],eax
cmp [iFileSize],0
je .InvalidFileSize
cmp [iFileSize],40*1024*1024 ;// Set our limit to 40MB, since usuall RAM's these day are alteast 128MB
;// And, our paging is also active
jg .FileTooBig
jmp .StartConversion

;// Invalid File Size, File too big,
.InvalidFileSize:
invoke MessageBox,0,'File is empty, nothing to convert.','Abort',16
invoke CloseHandle,[hFileHandle]
invoke ExitProcess,0

.FileTooBig:
invoke MessageBox,0,'File is too big, please specify a smaller file.','Abort',16
invoke CloseHandle,[hFileHandle]
invoke ExitProcess,0

;// FileSize valid, start conversion
.StartConversion:

local i:DWORD, hHeap: DWORD, dLastError: DWORD, pData: DWORD ;// I is out counter

;// Allocate pData equal to file size
invoke GetProcessHeap
mov [hHeap],eax
cmp eax,0
jne @f

;// Error
invoke MessageBox,0,'Unknow error occured.','Abort',0
invoke CloseHandle,[hFileHandle]
invoke ExitProcess,0

;// We have the HEAP
@@:
invoke HeapAlloc,[hHeap],0,[iFileSize]
cmp eax,0
jne @f

;// Memory allocation failed
invoke MessageBox,0,'Unable to allocate memory.','Low Resource',16
invoke CloseHandle,[hFileHandle]
invoke ExitProcess,0

;// We have the memory
@@:
mov [pData],eax

;// Read the file
invoke ReadFile,[hFileHandle],[pData],[iFileSize],dwWritten,0 ;// Note that dwWritten is not used in this function
cmp eax,0
jne @f

call GET_LAST_ERROR_PROC
invoke HeapFree,[hHeap],0,[pData]
invoke CloseHandle,[hFileHandle]
invoke ExitProcess,0

;Continue, file read successful
@@:
mov [i],0
mov ebx,[pData]
;// Start of Loop
.ConversionLoop:
;// Check i
mov eax,[i]
cmp eax,[iFileSize]
jge .ExitLoop

;// Check for case
mov al,byte [ebx]
mov ah,0

.if (al <= 'Z') & (al >= 'A')
add al,'a'-'A'
mov [ebx],al
.elseif (al <= 'z') & (al >= 'a')
sub al,'a'-'A'
mov [ebx],al
.endif

;// Increase i and repeat
inc ebx
inc [i]
jmp .ConversionLoop

;// End of Loop
.ExitLoop:
;// Write to file
invoke SetFilePointer,[hFileHandle],0,0,FILE_BEGIN
invoke WriteFile,[hFileHandle],[pData],[iFileSize],dwWritten,0 ;// Note that dwWritten is not used in this function
cmp eax,0
jne @f

;// File Write Failed
call GET_LAST_ERROR_PROC
invoke HeapFree,[hHeap],0,[pData]
invoke CloseHandle,[hFileHandle]
invoke ExitProcess,0

;// End of our process
@@:
invoke MessageBox,0,'File conversion completed successfuly','Complete',64

;// Release Memory
invoke HeapFree,[hHeap],0,[pData]
;//------------------------------- Close the file
invoke CloseHandle,[hFileHandle]


;// Terminate APP
.ExitProcess_JUMP:

invoke ExitProcess,0

endp

;// GetLastError Procedures finds the failure reason in system-level
proc GET_LAST_ERROR_PROC
invoke GetLastError
invoke FormatMessage,FORMAT_MESSAGE_FROM_SYSTEM,0,eax,0,s_ErrorMessage,256,0
invoke MessageBox,0,s_ErrorMessage,'Error',16
endp


;// End of program
.end main
AnswerRe: Files and I really need it............ Pin
Dave Kreskowiak3-Mar-07 10:43
mveDave Kreskowiak3-Mar-07 10:43 
Questionassembly Pin
KOKEMO23-Dec-06 20:44
KOKEMO23-Dec-06 20:44 
AnswerRe: assembly Pin
Paul Conrad25-Dec-06 18:48
professionalPaul Conrad25-Dec-06 18:48 
AnswerRe: assembly Pin
Dave Kreskowiak3-Mar-07 10:42
mveDave Kreskowiak3-Mar-07 10:42 
QuestionMicrosoft certification exam questions Pin
Mekong River16-Dec-06 14:57
Mekong River16-Dec-06 14:57 
AnswerRe: Microsoft certification exam questions Pin
Steve Maier20-Dec-06 7:24
professionalSteve Maier20-Dec-06 7:24 
Questionprintscreen problems Pin
RomTibi12-Dec-06 9:15
RomTibi12-Dec-06 9:15 
AnswerRe: printscreen problems Pin
Dave Kreskowiak3-Mar-07 10:40
mveDave Kreskowiak3-Mar-07 10:40 
QuestionWhat's an Integration Programmer? Pin
Dominic Pettifer5-Dec-06 6:22
Dominic Pettifer5-Dec-06 6:22 
AnswerRe: What's an Integration Programmer? Pin
Leah_Garrett5-Dec-06 16:30
Leah_Garrett5-Dec-06 16:30 
GeneralRe: What's an Integration Programmer? Pin
Paul Conrad6-Dec-06 9:52
professionalPaul Conrad6-Dec-06 9:52 
AnswerRe: What's an Integration Programmer? Pin
Trollslayer6-Dec-06 11:09
mentorTrollslayer6-Dec-06 11:09 
QuestionFreelance software developer websites Pin
elmoe01014-Dec-06 15:45
elmoe01014-Dec-06 15:45 
AnswerRe: Freelance software developer websites Pin
Vasudevan Deepak Kumar6-Dec-06 7:18
Vasudevan Deepak Kumar6-Dec-06 7:18 
QuestionWhats does "Utilities Business Sector" mean? Pin
Dominic Pettifer4-Dec-06 12:44
Dominic Pettifer4-Dec-06 12:44 
AnswerRe: Whats does "Utilities Business Sector" mean? Pin
MatrixCoder4-Dec-06 13:21
MatrixCoder4-Dec-06 13:21 
AnswerRe: Whats does "Utilities Business Sector" mean? Pin
Leah_Garrett4-Dec-06 13:23
Leah_Garrett4-Dec-06 13:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.