UAC

Windows specific questions.
Post Reply
j'ordos
Posts: 75
Joined: May 02, 2008 16:33

UAC

Post by j'ordos »

Hi, I created a small utility which runs in console mode. It copies a few files (none of which reside in a program files or windows folder) and then opens a file (same) where it alters a few bytes depending on user input. For some reason this ticks off windows and it requests administrator rights each time I attempt to run the compiled .exe (hard drive access). I have another program which is almost exactly the same but doesn't cause UAC warnings. What could the cause be?

full code:

Code: Select all

print "A Patcher v1.5"
print "=============="

#include "file.bi"

dim as ubyte btmp,btmp2
dim as ushort utmp
dim as integer itmp,itmp2
dim as integer file
dim as single percent
dim as string stmp
dim yesno(1) as string => {"Disabled","Enabled"}

'version detection and filepath check
dim as integer ufover
dim as integer length=filelen("Ufoexe\UFO2P.EXE")
select case length
case 0
    print "Error: Couldn't find Ufoexe\UFO2P.EXE!"
    sleep
    end
case 1702206
    print "English pentium version of UFO2P.EXE detected."
    ufover=0
case 1711875
    print "German version of UFO2P.EXE detected."
    ufover=1
case 1705790
    print "English 486 version of UFO2P.EXE detected."
    ufover=2
case else
    print "Unknown filesize (UFO2P.EXE). Warning: problems may occur if you continue!"
    print "Select version:"
    print "0. English pentium version"
    print "1. German version"
    print "2. English 486 version"
    print "3. Exit"
    input "Choice: ",ufover
    if ufover<0 or ufover>2 then end
end select  'UFO2P.EXE
dim as integer tacver
length=filelen("Tacexe\TACP.EXE")
select case length
case 0
    print "Error: Couldn't find Tacexe\TACP.EXE!"
    sleep
    end
case 3170298
    print "English pentium version of TACP.EXE detected."
    tacver=0
case 3163823
    print "German version of TACP.EXE detected."
    tacver=1
case 3161594
    print "English 486 version of TACP.EXE detected."
    tacver=2
case else
    print "Unknown filesize (TACP.EXE). Warning: problems may occur if you continue!"
    print "Select version:"
    print "0. English pentium version"
    print "1. German version"
    print "2. English 486 version"
    print "3. Exit"
    input "Choice: ",tacver
    if tacver<0 or tacver>2 then end
end select  'TACP.EXE

'create backups (UFO2P.EXE)
if fileexists("APOC'BAK\ufoexe\UFO2P.EXE")=-1 then
    print "Apoc'd 3.x detected."
    input "Restore UFO2P.EXE backup? (Y/N)",stmp
    if lcase(stmp)="y" then
        if filecopy("APOC'BAK\ufoexe\UFO2P.EXE","Ufoexe\UFO2P.EXE")=0 then
            print "Backup restored."
        else
            print "Backup NOT restored."
        endif
    endif
elseif fileexists("Ufoexe\UFO2P.BAK")=0 then
    filecopy("Ufoexe\UFO2P.EXE","Ufoexe\UFO2P.bak")
    print "Created backup of UFO2P.EXE. (UFO2P.bak)"
else
    input "Restore UFO2P.BAK? (Y/N)",stmp
    if lcase(stmp)="y" then
        if filecopy("Ufoexe\UFO2P.bak","Ufoexe\UFO2P.EXE")=0 then
            print "Backup restored."
        else
            print "Backup NOT restored."
        endif
    endif
endif

'create backups (TACP.EXE)
if fileexists("APOC'BAK\tacexe\TACP.EXE")=-1 then
    input "Restore TACP.EXE backup? (Y/N)",stmp
    if lcase(stmp)="y" then
        if filecopy("APOC'BAK\tacexe\TACP.EXE","Tacexe\TACP.EXE")=0 then
            print "Backup restored."
        else
            print "Backup NOT restored."
        endif
    endif
elseif fileexists("Tacexe\TACP.BAK")=0 then
    filecopy("Tacexe\TACP.EXE","Tacexe\TACP.bak")
    print "Created backup of TACP.EXE. (TACP.bak)"
else
    input "Restore TACP.BAK? (Y/N)",stmp
    if lcase(stmp)="y" then
        if filecopy("Tacexe\TACP.bak","Tacexe\TACP.EXE")=0 then
            print "Backup restored."
        else
            print "Backup NOT restored."
        endif
    endif
endif

dim offsetufo(16,2) as integer
offsetufo(0,1)=9708 'default
offsetufo(0,2)=3584
offsetufo(1,1)=2420 'building guards&vigilant guards setting
offsetufo(1,2)=2356
offsetufo(2,1)=2432 'base raiders setting
offsetufo(2,2)=2368
offsetufo(3,1)=-102 'agent hire list
offsetufo(3,2)=-166
offsetufo(4,1)=-1024'max polcars
offsetufo(4,2)=-1088
offsetufo(5,1)=3296 'starting polcars
offsetufo(5,2)=3232
offsetufo(6,1)=788  'max polcars2
offsetufo(6,2)=724
offsetufo(7,1)=383  'ufodrop
offsetufo(7,2)=319
offsetufo(8,1)=786  'illegal vehicles
offsetufo(8,2)=722
offsetufo(9,1)=-748 'gaterand (slow)
offsetufo(9,2)=-812
offsetufo(10,1)=-333'gaterand (fast)
offsetufo(10,2)=-397
offsetufo(11,1)=-756'ufotimer (slow)
offsetufo(11,2)=-820
offsetufo(12,1)=-340'ufotimer (fast)
offsetufo(12,2)=-404
offsetufo(13,1)=2276'Forceweb add_aequip
offsetufo(13,2)=2212
offsetufo(14,1)=-752'ufotimer (slow)
offsetufo(14,2)=-816
offsetufo(15,1)=-336'ufotimer (fast)
offsetufo(15,2)=-400
offsetufo(16,1)=-332'ufotimer (fast) !!!
offsetufo(16,2)=-396

dim offsettac(5,2) as integer
offsettac(0,1)=-8672    'default
offsettac(0,2)=-8704
offsettac(1,1)=-420     'netmode
offsettac(1,2)=-420
offsettac(2,1)=-2015    'DD
offsettac(2,2)=-2063
offsettac(3,1)=-1493    'Forceweb add_aequip
offsettac(3,2)=-1493
offsettac(4,1)=120      'turret weapons
offsettac(4,2)=120
offsettac(5,1)=128      'turret controller
offsettac(5,2)=128

print ""
file=freefile
open "ufoexe\UFO2P.EXE" for binary shared as #file
if err<>0 then
    print "Couldn't open ufoexe\UFO2P.EXE!"
    sleep
    end
endif

seek #file,1321417+offsetufo(0,ufover)
get #file, ,btmp
if btmp<>0 and btmp<>1 then
    print "Apocalypse Designer flag: invalid data, skipping."
    goto SKIPDESIGN
endif
print "Note: requires citydemo file in ufodata folder!"
print "current status: "+yesno(btmp)
input "Enable 'Apocalypse Designer' mode? (Y/N/A)",stmp
if lcase(stmp)="y" then
	Print "Enabling Apocalypse Designer...",
    btmp=1
Elseif lcase(stmp)="n" then
    print "Disabling Apocalypse Designer...",
    btmp=0
else
    goto SKIPDESIGN
endif
seek #file,1321417+offsetufo(0,ufover)
put #file, ,btmp
print "OK"

SKIPDESIGN:
print ""
seek #file,1119076+offsetufo(1,ufover)
get #file, ,btmp
seek #file,seek(file)+3
get #file, ,btmp2
btmp+=btmp2
if btmp<>120 then
    print "Stun raiding bug: invalid data at ";1119076+offsetufo(1,ufover)
    goto SKIPSTUNRAID
endif
print "current status: "+yesno(1-(btmp2-3))
input "Disable stun raiding? (Y/N/A)",stmp
if lcase(stmp)="y" then
	Print "Disabling stun raiding...",
    btmp=116
    btmp2=4
Elseif lcase(stmp)="n" then
    print "Enabling stun raiding...",
    btmp=117
    btmp2=3
else
    goto SKIPSTUNRAID
endif
seek #file,1119076+offsetufo(1,ufover)
put #file, ,btmp
seek #file,seek(file)+3
put #file, ,btmp2
print "OK"

SKIPSTUNRAID:
print ""
seek #file,1119085+offsetufo(1,ufover)
get #file, ,btmp
if btmp<>2 and btmp<>4 then
    print "Vigilant guards: invalid data at ";1119085+offsetufo(1,ufover)
    goto SKIPALGUARD
endif
print "current status: "+yesno(1-sgn(btmp-2))
input "Guards present during investigations? (Y/N/A)",stmp
if lcase(stmp)="y" then
	Print "Enabling vigilant guards...",
    btmp=2
Elseif lcase(stmp)="n" then
    print "Disabling vigilant guards...",
    btmp=4
else
    goto SKIPALGUARD
endif
seek #file,1119085+offsetufo(1,ufover)
put #file, ,btmp
print "OK"

SKIPALGUARD:
print ""
input "Increase agents for hire? (Y/N)",stmp
if lcase(stmp)="y" then
    print "A random number between 0 and maximum is added to the hire list each day."
    seek #file,904254+offsetufo(3,ufover)
    get #file, ,btmp
    if btmp=184 then
        Input "Maximum of human agents&techs (default: 3) [0 - 8]: ",btmp
        Print "Altering agents&techs...",
        Seek #file,904255+offsetufo(3,ufover)
        put #file, ,btmp
        print "OK"
    else
        print "humans: Invalid data, skipped"
    endif

    seek #file,904412+offsetufo(3,ufover)
    get #file, ,btmp
    if btmp=184 then
        Input "Maximum of hybrids (default: 1) [0 - 8]: ",btmp
        Print "Altering hybrids...",
        Seek #file,904413+offsetufo(3,ufover)
        put #file, ,btmp
        print "OK"
    else
        print "hybrids: Invalid data, skipped"
    endif

    seek #file,904537+offsetufo(3,ufover)
    get #file, ,btmp
    if btmp=184 then
        Input "Maximum of androids (default: 1) [0 - 8]: ",btmp
        Print "Altering androids...",
        Seek #file,904538+offsetufo(3,ufover)
        put #file, ,btmp
        print "OK"
    else
        print "androids: Invalid data, skipped"
    endif
endif

NOCANFODDER:
print ""
print "Only changes the limit, not the actual number of guards."
input "Increase organizations' ground force limits? (Y/N)",stmp
if lcase(stmp)="y" then
    seek #file,1119132+offsetufo(1,ufover)
    get #file, ,btmp
    if btmp=131 then
        Input "Building guards limit (default: 20) [0 - 36] : ",btmp
        print "Altering guards limit...",
        seek #file,1119134+offsetufo(1,ufover)
        put #file, ,btmp
        seek #file,seek(file)+3
        put #file, ,btmp
        print "OK"
    else
        print "Building guards limit: invalid data, skipped"
    endif

    seek #file,1119383+offsetufo(2,ufover)
    get #file, ,btmp
    if btmp=131 then
        Input "Base raiders limit (default: 20) [0 - 36] : ",btmp
        print "Altering raiders limit...",
        seek #file,1119385+offsetufo(2,ufover)
        put #file, ,btmp
        seek #file,seek(file)+3
        put #file, ,btmp
        print "OK"
    else
        print "Base raiders limit: invalid data, skipped"
    endif
endif

print ""
seek #file,1119393+offsetufo(2,ufover)
get #file, ,btmp
if btmp<>191 then
    print "Corporate raiders: invalid data at ";seek(file)
    goto SKIPFIXRAID
endif
get #file, ,btmp
print "current status: "+yesno(sgn(btmp-9))
input "Fix incorrect base raider unit type? (Y/N/A)",stmp
if lcase(stmp)="y" then
	Print "Enabling raider fix...",
    btmp=13
Elseif lcase(stmp)="n" then
    print "Disabling raider fix...",
    btmp=9
else
    goto SKIPFIXRAID
endif
seek #file,1119394+offsetufo(2,ufover)
put #file, ,btmp
print "OK"

SKIPFIXRAID:
print ""
input "Increase Police presence in the city? (Y/N)",stmp
if lcase(stmp)="y" then
    seek #file,1162175+offsetufo(5,ufover)
    get #file, ,btmp
    if btmp=131 then
        print "Note: no effect in savegames."
        input "Number of starting Police Cars (default: 3) : ",btmp
        seek #file,1162177+offsetufo(5,ufover)
        put #file, ,btmp
        print "Set"
    else
        print "Starting Police Cars: invalid data, skipped"
    endif

    seek #file,1162178+offsetufo(5,ufover)
    get #file, ,btmp
    if btmp=131 then
        print "Note: no effect in savegames."
        input "Number of starting Police Hovercars (default: 3) : ",btmp
        seek #file,1162180+offsetufo(5,ufover)
        put #file, ,btmp
        print "Set"
    else
        print "Starting Police Hovercars: invalid data, skipped"
    endif

    input "Number of maximum Police Cars/Hovercars (default: 5) : ",btmp
    seek #file,764353+offsetufo(4,ufover)
    print "Altering max Police Cars...",
    get #file, ,btmp2
    if btmp2=102 then
        seek #file,764355+offsetufo(4,ufover)
        put #file, ,btmp
        print "OK"
    else
        print "Invalid data, skipping"
    endif
    seek #file,764378+offsetufo(4,ufover)
    print "Altering max Police Hovercars...",
    get #file, ,btmp2
    if btmp2=102 then
        seek #file,764381+offsetufo(4,ufover)
        put #file, ,btmp
        print "OK"
    else
        print "Invalid data, skipping"
    endif
    seek #file,1000643+offsetufo(6,ufover)
    print "Altering global maximum...",
    get #file, ,btmp2
    if btmp2=186 then
        seek #file,1000644+offsetufo(6,ufover)
        put #file, ,btmp
        print "OK"
    else
        print "Invalid data, skipping"
    endif
endif

print ""
seek #file,1004092+offsetufo(8,ufover)
get #file, ,btmp
if btmp=250 then
    input "Make illegal flyer actions less optimistic? (Y/N)",stmp
    if lcase(stmp)="y" then
        input "Number of illegal vehicles? (default: 2) : ",btmp
        seek #file,1004093+offsetufo(8,ufover)
        put #file, ,btmp
        print "Set"
    endif
else
    print "Illegal swarms: invalid data, skipped."
endif

print ""
seek #file,709185+offsetufo(9,ufover)
get #file, ,btmp
if btmp=232 or btmp=144 then
    print "Current status: "+yesno(1-sgn(btmp-144))
    input "Static Dimension Gates? (Y/N/A)",stmp
    if lcase(stmp)="y" then
        seek #file,709185+offsetufo(9,ufover)
        print "Disabling randomization on fast timer mission start..."
        btmp=144
        put #file, ,btmp
        itmp=-1869574000
        put #file, ,itmp
        print "OK"

        seek #file,850617+offsetufo(10,ufover)
        print "Disabling randomization on slow timer mission start..."
        btmp=144
        put #file, ,btmp
        itmp=-1869574000
        put #file, ,itmp
        print "OK"
    elseif lcase(stmp)="n" then
        seek #file,709185+offsetufo(9,ufover)
        print "Enabling randomization on fast timer mission start..."
        btmp=232
        put #file, ,btmp
        select case as const ufover
        case 0
            itmp=154455
        case 1
            itmp=154907
        case 2
            itmp=154907
        case else
            print "Forgot me!"
        end select
        put #file, ,itmp
        print "OK"

        seek #file,850617+offsetufo(10,ufover)
        print "Enabling randomization on slow timer mission start..."
        btmp=232
        put #file, ,btmp
        select case as const ufover
        case 0
            itmp=13023
        case 1
            itmp=13060
        case 2
            itmp=13060
        end select
        put #file, ,itmp
        print "OK"
    endif
else
    print "Gate Shuffle: invalid data, skipping."
endif

print ""
print "Doesn't affect the first incursion."
input "Increase UFO mission frequency? (Y/N)",stmp
If Lcase(stmp)="y" then
	Input "Percentage of original frequency: (0-65535) ",utmp
	Seek #file,709114+offsetufo(11,ufover)
    print "Fast timer: Altering random amount 1...",
    get #file, ,btmp
    if btmp=184 then
        percent=28.2*utmp
        itmp=int(percent)
        seek #file,709115+offsetufo(11,ufover)
        put #file, ,itmp
        print "OK"
    else
        print "Invalid data, skipped"
    endif
	Seek #file,709139+offsetufo(14,ufover)
    print "Fast timer: Altering random amount 2...",
    get #file, ,btmp
    if btmp=184 then
        percent=36*utmp
        itmp=int(percent)
        seek #file,709140+offsetufo(14,ufover)
        put #file, ,itmp
        print "OK"
    else
        print "Invalid data, skipped"
    endif
	Seek #file,709168+offsetufo(14,ufover)
    print "Fast timer: Altering fixed amount...",
    get #file, ,btmp
    if btmp=129 then
        percent=302.08*utmp
        itmp=int(percent)
        seek #file,709170+offsetufo(14,ufover)
        put #file, ,itmp
        print "OK"
    else
        print "Invalid data, skipped"
    endif

	Seek #file,850546+offsetufo(12,ufover)
    print "Normal timer: Altering random amount 1...",
    get #file, ,btmp
    if btmp=184 then
        percent=28.2*utmp
        itmp=int(percent)
        seek #file,850547+offsetufo(12,ufover)
        put #file, ,itmp
        print "OK"
    else
        print "Invalid data, skipped"
    endif
	Seek #file,850571+offsetufo(15,ufover)
    print "Normal timer: Altering random amount 2...",
    get #file, ,btmp
    if btmp=184 then
        percent=36*utmp
        itmp=int(percent)
        seek #file,850572+offsetufo(15,ufover)
        put #file, ,itmp
        print "OK"
    else
        print "Invalid data, skipped"
    endif
	Seek #file,850603+offsetufo(16,ufover)
    print "Normal timer: Altering fixed amount...",
    get #file, ,btmp
    if btmp=141 then
        percent=302.08*utmp
        itmp=int(percent)
        seek #file,850605+offsetufo(16,ufover)
        put #file, ,itmp
        print "OK"
    else
        print "Invalid data, skipped"
    endif
endif

print ""
seek #file,644416+offsetufo(7,ufover)
get #file, ,btmp
if btmp<>116 and btmp<>117 then
    print "No drop troops: invalid data."
    goto SKIPNODROP
endif
print "current status: "+yesno(sgn(btmp-116))
input "No UFO troop drops in the city? (Y/N/A)",stmp
if lcase(stmp)="y" then
	Print "Enabling scarecrow UFOs...",
    btmp=117
Elseif lcase(stmp)="n" then
    print "Disabling scarecrow UFOs...",
    btmp=116
else
    goto SKIPNODROP
endif
seek #file,644416+offsetufo(7,ufover)
put #file, ,btmp
print "OK"

SKIPNODROP:
print ""
input "Enable Forceweb and Dimension Destabiliser fix? (Y/N/A)",stmp
if lcase(stmp)="y" then
    seek #file,1113308+offsetufo(13,ufover)
    get #file, ,btmp
    if btmp=131 then
        print "UFO2P: Fixing Forceweb spawning problem...",
        seek #file,1113310+offsetufo(13,ufover)
        btmp=255
        put #file, ,btmp
        print "OK"
    else
        print "UFO2P: Forceweb fix: invalid data, skipped"
    endif
elseif lcase(stmp)="n" then
    seek #file,1113308+offsetufo(13,ufover)
    get #file, ,btmp
    if btmp=131 then
        print "Restoring Forceweb spawning problem...",
        seek #file,1113310+offsetufo(13,ufover)
        btmp=32
        put #file, ,btmp
        print "OK"
    else
        print "UFO2P: Forceweb fix: invalid data, skipped"
    endif
endif

close
file=freefile
open "tacexe\TACP.EXE" for binary shared as #file
if err<>0 then
    print "Couldn't open tacexe\TACP.EXE!"
    sleep
    end
endif

if lcase(stmp)="y" then
    seek #file,739878+offsettac(3,tacver)
    get #file, ,btmp
    if btmp=131 then
        print "TACP: Fixing Forceweb spawning problem...",
        seek #file,739880+offsettac(3,tacver)
        btmp=255
        put #file, ,btmp
        print "OK"
    else
        print "TACP: Forceweb fix: invalid data, skipped"
    endif
    seek #file,762446+offsettac(2,tacver)
    get #file, ,btmp
    if btmp=117 or btmp=235 then
        print "Fixing Dimension Destabiliser damage problem...",
        seek #file,762446+offsettac(2,tacver)
        btmp=235
        put #file, ,btmp
        print "OK"
    else
        print "Dimension Destabiliser fix: invalid data, skipped"
    endif
elseif lcase(stmp)="n" then
    seek #file,739878+offsettac(3,tacver)
    get #file, ,btmp
    if btmp=131 then
        print "TACP: Restoring Forceweb spawning problem...",
        seek #file,739880+offsettac(3,tacver)
        btmp=32
        put #file, ,btmp
        print "OK"
    else
        print "TACP: Forceweb fix: invalid data, skipped"
    endif
    seek #file,762446+offsettac(2,tacver)
    get #file, ,btmp
    if btmp=117 or btmp=235 then
        print "Restoring Dimension Destabiliser damage problem...",
        seek #file,762446+offsettac(2,tacver)
        btmp=117
        put #file, ,btmp
        print "OK"
    else
        print "Dimension Destabiliser fix: invalid data, skipped"
    endif
endif

print ""
seek #file,519187+offsettac(5,tacver)
get #file, ,btmp
if btmp<>187 then
    print "remote controlled turrets: invalid data at ";seek(file)
    goto SKIPRCT
endif
get #file, ,btmp
print "current status: "+yesno(1-btmp)
input "Enable player controlled security turrets? (Y/N/A)",stmp
if lcase(stmp)="y" then
    print "Enabling RC turrets..."
    btmp=0
elseif lcase(stmp)="n" then
    print "Disabling RC turrets..."
    btmp=1
else
    goto SKIPRCT
endif
seek #file,519188+offsettac(5,tacver)
put #file, ,btmp
print "OK"

SKIPRCT:
print ""
print "Read apatcher.txt for the list of weapons."
input "Edit security turret weapons? (Y/N)",stmp
if lcase(stmp)="y" then
    seek #file, 519632+offsettac(4,tacver)
    get #file, ,btmp
    if btmp=186 then
        input "Security Station weapon: (default: 16) ",btmp
        put #file, ,btmp
        print "Set"
    else
        print "Security Station weapon: invalid data, skipped"
    endif
    seek #file, 519651+offsettac(4,tacver)
    get #file, ,btmp
    if btmp=186 then
        input "Security Station clip #1: (default: 17) ",btmp
        put #file, ,btmp
        print "Set"
    else
        print "Security Station clip #1: invalid data, skipped"
    endif
    seek #file, 519668+offsettac(4,tacver)
    get #file, ,btmp
    if btmp=186 then
        input "Security Station clip #2: (default: 17) ",btmp
        put #file, ,btmp
        print "Set"
    else
        print "Security Station clip #2: invalid data, skipped"
    endif
    seek #file, 519690+offsettac(4,tacver)
    get #file, ,btmp
    if btmp=186 then
        input "Adv. Security Station weapon: (default: 41) ",btmp
        put #file, ,btmp
        print "Set"
    else
        print "Adv. Security Station weapon: invalid data, skipped"
    endif
endif

print ""
seek #file,440271+offsettac(1,tacver)
get #file, ,btmp
seek #file,seek(file)+11+4*sgn(tacver)
get #file, ,btmp2
if (btmp<>1 and btmp2<>2) and (btmp<>3 and btmp2<>3) then
    print "Netmode: invalid data at ";seek(file)
    print "Var: ";btmp
    goto SKIPNET
endif
print "Be sure to read apatcher.txt for instructions!"
btmp+=btmp2
print "current status: "+yesno(sgn(btmp-3))
input "Activate multiplayer hotseat? (Y/N/A)",stmp
if lcase(stmp)="y" then
	Print "Enabling netmode...",
    btmp=3
    btmp2=3
Elseif lcase(stmp)="n" then
    print "Disabling netmode...",
    btmp=1
    btmp2=2
else
    goto SKIPNET
endif
seek #file,440271+offsettac(1,tacver)
put #file, ,btmp
seek #file,seek(file)+11+4*sgn(tacver)
put #file, ,btmp2
print "OK"

SKIPNET:
print ""
seek #file,1271819+offsettac(0,tacver)
get #file, ,btmp
if btmp<>0 and btmp<>1 then
    print "Training mode: invalid data at ";seek(file)
    goto SKIPTRAIN
endif
print "Automatic tactical resolution. AI takes control over your troops and entire map is visible."
print "current status: "+yesno(btmp)
input "Activate training mode? (Y/N/A)",stmp
if lcase(stmp)="y" then
	Print "Enabling training mode...",
    btmp=1
Elseif lcase(stmp)="n" then
    print "Disabling training mode...",
    btmp=0
else
    goto SKIPTRAIN
endif
seek #file,1271819+offsettac(0,tacver)
put #file, ,btmp
print "OK"

SKIPTRAIN:
close
print ""
print "Press any key..."
sleep
end
edit: running windows 7 64bit btw. :)
j_milton
Posts: 458
Joined: Feb 11, 2010 17:35

Just a guess...

Post by j_milton »

Not sure, but your program attempts to modify executable files. If there is any security in Windows at all this is the sort of thing that one would want to be restricted
bcohio2001
Posts: 556
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Post by bcohio2001 »

each time I attempt to run the compiled .exe
By the way you say it, you are getting the warning BEFORE the program starts. If I am correct in this assumption, then it is not your program itself.

I get a warning message with other programs. I have Vista and Win7 is probably not that much different. When you get the message again. See if there is a checkbox saying "Do not show this warning ....". Check the box. And see if the warning comes back.
j'ordos
Posts: 75
Joined: May 02, 2008 16:33

Post by j'ordos »

Not sure, but your program attempts to modify executable files. If there is any security in Windows at all this is the sort of thing that one would want to be restricted
I'd agree, but I have another program that does almost exactly the same thing (backs up the same files and modifies the same files, though the exact bytes being changed are different :) ), windows doesn't see any problem with that one.
By the way you say it, you are getting the warning BEFORE the program starts. If I am correct in this assumption, then it is not your program itself.

I get a warning message with other programs. I have Vista and Win7 is probably not that much different. When you get the message again. See if there is a checkbox saying "Do not show this warning ....". Check the box. And see if the warning comes back.
It does indeed pop-up before the program starts, but isn't that the case with all UAC messages? I can't uncheck the message, I only get a link to the control panel where I can alter the security level. (currently at 'standard') It's probably more a windoze issue but I wonder what it doesn't like about my program.
Sisophon2001
Posts: 1706
Joined: May 27, 2005 6:34
Location: Cambodia, Thailand, Lao, Ireland etc.
Contact:

Post by Sisophon2001 »

What is your programs name?

If the phrase "setu", "instal" or "update" are used in your exe name, then vista will think it is an installer and pop up the box and request administrator rights.

Garvan
j'ordos
Posts: 75
Joined: May 02, 2008 16:33

Post by j'ordos »

Ah, it's called 'apatcher'. Patch sounds like it might also qualify for such a rule.
edit: you're right, renaming the program solves the problem. Anyway to circumvent this without renaming?
Zippy
Posts: 1295
Joined: Feb 10, 2006 18:05

Post by Zippy »

Try adding a manifest:

http://msdn.microsoft.com/en-us/library/bb756929.aspx

...
level=asInvoker
uiAccess=False
...

Don't miss the need to include the marker in your .rc, then the unwritten need to include same .rc when you compile.. Note I haven't tested this.
McLovin
Posts: 82
Joined: Oct 21, 2008 1:15
Contact:

Post by McLovin »

Further to what Zippy has said, here is what I use in my manifests:

Code: Select all

    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
       <security>
          <requestedPrivileges>
             <requestedExecutionLevel level="asInvoker" uiAccess="false" />
          </requestedPrivileges>
       </security>
    </trustInfo>    
Zippy
Posts: 1295
Joined: Feb 10, 2006 18:05

Post by Zippy »

@McLovin
Your feedback is appreciated, and drove me to post an example for future reference.

======

The following was tested on Vista

1. Create/save/compile this as "setup.exe":

Code: Select all

print "Test.. Sleeping.."
sleep
Execute this, you should get an "Allow"/"Cancel" alert.

2. Create/save this text file in the same dir as setup.bas, as "setup.exe.manifest":
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
processorArchitecture="X86"
name="Setup"
type="win32"/>
<description>Description of your application</description>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
3. Create/save [or add to existing .rc] this text file in the same dir as setup.bas, as "setup.rc":
#define MANIFEST_RESOURCE_ID 1
MANIFEST_RESOURCE_ID RT_MANIFEST "Setup.exe.manifest"
4. Compile from comandline in same dir as setup.bas:
fbc setup.bas setup.rc
5. Excute setup.exe again, there should be no UAC prompting prior to execution. There may [will] be prompting if your program does something that requires elevation (i.e., copying files to protected areas).

Need: to change manifest and .rc to reflect varying program names.
j'ordos
Posts: 75
Joined: May 02, 2008 16:33

Post by j'ordos »

Thanks! I'm currently at a windows 2k3 pc but I'll be sure to try it this weekend. At least I can tell it doesn't break compatibility with older windows OS's :)
Post Reply