PDA

View Full Version : Securing code for a laptop, any of you following the practice I describe?



Howard Kaikow
11-25-2004, 06:00 PM
I've never had a VBA capable notebook.

Expect to get one early next year, so I have been thinking about the implications for VBA code security. This caused me to do the following.

1. I split my gloabal utilities template into two pieces. One piece has little more than the code for my toolbars and menus, call this Utilities-1. The other has the rest.

2. I convertered ALL the code in Utilities-1 to VB 6 and compiled an ActiveX DLL. So there is now, in effect NO code in Utilities-1.dot. Just code of the form:
Public Sub HKCreateToolBar()
clsWordVB1.HKCreateToolBar
End Sub


This protects all the code in HKCreateToolbar from prying eyes.

3. I just finished a similar effort for the code in the Normal template.

So, if somebody prys in, or steals, my notebook, at least they cannot see my source code.

Note that most of the code was easy to convert to a VB DLL, but some was not so simple. I had eased the task because I already had VB 6 Forms for some code that also was already running in VB 6.

I could carry the VB 6 source separately on a CD, or I could be really paranoid and not even have the source with me when I travel. Worst case is I have to tolerate Word's default's until I get home. I will travel with only essential source code.

Jacob Hilderbrand
11-25-2004, 09:30 PM
Make sure you have a copy of the code so you can access it when you want. All this effort will likely hinder you more than anyone else.

If the laptop was stolen I doubt the thief would care about some VBA code (if they even knew what VBA was). They would just format the hard drive and pawn it off.

TonyJollans
11-26-2004, 06:49 AM
I'm with Jake. Unless your work is in some very specialised area it is unlikely any thief would really care about your VBA code. And prying eyes can surely be deterred with a simple password.

Only other point I would make is that you would probably be better off without code in Normal.dot which needs securing.

As for travelling with source code - only you know whether that is a requirement for your work. Would you want to refer to it - or rebuild your DLLs - or what?

Howard Kaikow
11-26-2004, 08:20 AM
Make sure you have a copy of the code so you can access it when you want. All this effort will likely hinder you more than anyone else.
The code is obviously available in the VB 6 project on my desktops.
In general, the macros facilitate editing and have no impact on just reading files, the main purpose of having the notebook when travelling.


If the laptop was stolen I doubt the thief would care about some VBA code (if they even knew what VBA was). They would just format the hard drive and pawn it off.
Smarter thieves know that that information content is far more valuable than hardware.

Howard Kaikow
11-26-2004, 08:39 AM
I'm with Jake. Unless your work is in some very specialised area it is unlikely any thief would really care about your VBA code. And prying eyes can surely be deterred with a simple password.
I'd be travelling to highly specialized meetings.

Smarter thieves know that information content, and code, are far more valuable than hardware.


Only other point I would make is that you would probably be better off without code in Normal.dot which needs securing.
Normal.dot has no more security issues than any other template. Making Normal.dot read-only is sufficient protection.


As for travelling with source code - only you know whether that is a requirement for your work. Would you want to refer to it - or rebuild your DLLs - or what?
The macros are general macros. One could live without them. They facilitate editing, and programming, but the main purpose of having the notebook when travelling is for reading documents.

Any macros specific to the tasks for the meetings would indeed be in source form, if not in templates, at least in VB 6 projects.

Password protection of VBA projects is useless.

Side-effects of this exercise were

1. Split out those macros necessary to support the toolbar and menu customizations from the other macros/code in my global templates.

2. Find that I still had some WordBasic objects I had forgotten to convert. At least one cannot be converted to VBA. Another, I'm not sure about as I have not tried since back in the daze of Word 97. I might attack the latter this weekend.

3. Both Normal.dot and my global template are now very small. I suspect that this speeds the loading of Word, as I ASSuME that loading a compiled DLL will take less time than loading source code in template files.

TonyJollans
11-26-2004, 12:39 PM
I'd agree with your assumption about DLLs loading faster - and running faster (but it is, for me too, an assumption). I'm not entirely sure what is loaded in a global template (other than Normal) - as it can't be edited there is no reason I can think of to load uncompiled source code.

I can't help thinking you're being a bit paranoid if you're talking about general routines which simply go to make your life easier - although, that said, I worked at IBM many years ago and they were at their most obsessive when talking about the simple tools which they thought gave them a competitive edge so who am I to disagree?

It sounds like your exercise has resulted in some long overdue housekeeping - probably something we could all use a bit of :)

Howard Kaikow
11-26-2004, 05:37 PM
I'd agree with your assumption about DLLs loading faster - and running faster (but it is, for me too, an assumption).
In general code in a DLL will run faster than source that first needs to be compiled.

The physical template will load faster because there's less code.


I'm not entirely sure what is loaded in a global template (other than Normal) - as it can't be edited there is no reason I can think of to load uncompiled source code.
One can edit the code in ANY template, global or not.

The only difference is that some things, such as styles, are not directly available from a template loaded as a global template.


I can't help thinking you're being a bit paranoid if you're talking about general routines which simply go to make your life easier
Even the simpler code takes time to write.
Why should I needlessly give that away?


It sounds like your exercise has resulted in some long overdue housekeeping - probably something we could all use a bit of :)
Over the past few years, I've been bit by bit cleaning up my VBA code, or outright converting to VB 6, with the expectation of facilitating conversion to VB .NET.

TonyJollans
11-26-2004, 06:09 PM
One can edit the code in ANY template, global or not.

The only difference is that some things, such as styles, are not directly available from a template loaded as a global template.I agree about the styles, but how do you directly edit code in a global template when loaded as a global template?

Howard Kaikow
11-26-2004, 06:39 PM
I agree about the styles, but how do you directly edit code in a global template when loaded as a global template?The easy way is to edit a copy, then replace after closing Word.

Another way is to first unload the template, edit, then reload.

One should never have to edit a loaded template, they are not supposed to be dynamic critters. Rather, edit a copy, then replace when convenient.

Note: I am not responsible for any postings made today.
I finally cracked, i.e., gave in and violated my religion by purchasing Partition Magic today.

Oh, I am so ashamed!

TonyJollans
11-27-2004, 03:23 AM
I agree about the styles, but how do you directly edit code in a global template when loaded as a global template?
The easy way is to edit a copy, then replace after closing Word.

Another way is to first unload the template, edit, then reload.

One should never have to edit a loaded template, they are not supposed to be dynamic critters. Rather, edit a copy, then replace when convenient.

Exactly my point. You can only edit a global template after opening it independently. When loaded only as a global template it is not editable and therefore there is no requirement for uncompiled code to be loaded. I do not know exactly what is loaded but the source code is inaccessible and there is, therefore, no need for it to be loaded.

Incidentally you can open a global template for editing and make changes and have them take effect immediately without unloading and reloading the template. But, still, it has to be opened for editing in order for the source code to be available.

Do have fun with Partition Magic! I much prefer to control where things go and to avoid the need for dynamic repartitioning. I now regularly reinstall Windows and am getting better at it each time I do it, and can repartition 'properly' should I ever need to - it also keeps my machine running really sweetly.

Howard Kaikow
11-27-2004, 04:56 AM
Exactly my point. You can only edit a global template after opening it independently. When loaded only as a global template it is not editable and therefore there is no requirement for uncompiled code to be loaded. I do not know exactly what is loaded but the source code is inaccessible and there is, therefore, no need for it to be loaded.
The code is available, and unprotected, because it is in the template. One can directly open the template so the code is not protected.

I'm done withthis thread.

It's way pasy my bedtime.
I foolishly decided to install Firefox a few hours ago and have been playing with the critter. Gotta get to bed!!!